mirror of
https://github.com/JasonsGong/JasonsGong.github.io.git
synced 2024-11-24 11:49:36 +08:00
8860 lines
5.9 MiB
8860 lines
5.9 MiB
<?xml version="1.0" encoding="utf-8"?>
|
||
<search>
|
||
<entry>
|
||
<title>项目实战-黑马头条</title>
|
||
<url>/posts/64695.html</url>
|
||
<content><![CDATA[<h1 id="一-项目介绍"><a href="#一-项目介绍" class="headerlink" title="一.项目介绍"></a>一.项目介绍</h1><h2 id="1-项目概述"><a href="#1-项目概述" class="headerlink" title="1.项目概述"></a>1.项目概述</h2><p> 随着智能手机的普及,人们更加习惯于通过手机来看新闻。由于生活节奏的加快,很多人只能利用碎片时间来获取信息,因此,对于移动资讯客户端的需求也越来越高。黑马头条项目正是在这样背景下开发出来。黑马头条项目采用当下火热的微服务+大数据技术架构实现。本项目主要着手于获取最新最热新闻资讯,通过大数据分析用户喜好精确推送咨询新闻。</p>
|
||
<p><img src="/pictures/image-20230810153039562.png" alt="image-20230810153039562"></p>
|
||
<h2 id="2-业务说明"><a href="#2-业务说明" class="headerlink" title="2.业务说明"></a>2.业务说明</h2><p><strong>功能架构图</strong></p>
|
||
<p><img src="/pictures/image-20230810153700690.png" alt="image-20230810153700690"></p>
|
||
<h2 id="3-技术栈"><a href="#3-技术栈" class="headerlink" title="3.技术栈"></a>3.技术栈</h2><ul>
|
||
<li>Spring-Cloud-Gateway : 微服务之前架设的网关服务,实现服务注册中的API请求路由,以及控制流速控制和熔断处理都是常用的架构手段,而这些功能Gateway天然支持</li>
|
||
<li>运用Spring Boot快速开发框架,构建项目工程;并结合Spring Cloud全家桶技术,实现后端个人中心、自媒体、管理中心等微服务。</li>
|
||
<li>运用Spring Cloud Alibaba Nacos作为项目中的注册中心和配置中心</li>
|
||
<li>运用mybatis-plus作为持久层提升开发效率</li>
|
||
<li>运用Kafka完成内部系统消息通知;与客户端系统消息通知;以及实时数据计算</li>
|
||
<li>运用Redis缓存技术,实现热数据的计算,提升系统性能指标</li>
|
||
<li>使用Mysql存储用户数据,以保证上层数据查询的高性能</li>
|
||
<li>使用Mongo存储用户热数据,以保证用户热数据高扩展和高性能指标</li>
|
||
<li>使用FastDFS作为静态资源存储器,在其上实现热静态资源缓存、淘汰等功能</li>
|
||
<li>运用Hbase技术,存储系统中的冷数据,保证系统数据的可靠性</li>
|
||
<li>运用ES搜索技术,对冷数据、文章数据建立索引,以保证冷数据、文章查询性能</li>
|
||
<li>运用AI技术,来完成系统自动化功能,以提升效率及节省成本。比如实名认证自动化</li>
|
||
<li>PMD&P3C : 静态代码扫描工具,在项目中扫描项目代码,检查异常点、优化点、代码规范等,为开发团队提供规范统一,提升项目代码质量</li>
|
||
</ul>
|
||
<p><strong>技术栈</strong></p>
|
||
<p><img src="/pictures/image-20230809170653756.png" alt="image-20230809170653756"></p>
|
||
<p><strong>解决方案</strong></p>
|
||
<p><img src="/pictures/image-20230809170929986.png" alt="image-20230809170929986"></p>
|
||
<h1 id="二-环境搭建"><a href="#二-环境搭建" class="headerlink" title="二.环境搭建"></a>二.环境搭建</h1><h2 id="1-Linxu环境的搭建"><a href="#1-Linxu环境的搭建" class="headerlink" title="1.Linxu环境的搭建"></a>1.Linxu环境的搭建</h2><h3 id="1-1-虚拟机的安装"><a href="#1-1-虚拟机的安装" class="headerlink" title="1.1 虚拟机的安装"></a>1.1 虚拟机的安装</h3><p><strong>1.解压分享的虚拟机镜像文件</strong></p>
|
||
<p><img src="/pictures/image-20230811103629846.png" alt="image-20230811103629846"></p>
|
||
<p><strong>2.使用VmWare打开.vmx文件</strong><br><img src="/pictures/image-20230811103800217.png" alt="image-20230811103800217"></p>
|
||
<p><strong>3.配置虚拟机的网络环境</strong></p>
|
||
<p><img src="/pictures/image-20230811104150226.png" alt="image-20230811104150226"></p>
|
||
<p><img src="/pictures/image-20230811104320075.png" alt="image-20230811104320075"></p>
|
||
<p><strong>4.开启虚拟机</strong></p>
|
||
<p><img src="/pictures/image-20230811104523506.png" alt="image-20230811104523506"></p>
|
||
<p><strong>5.使用FinalShell连接此虚拟机</strong></p>
|
||
<p>用户名: root 密码:root IP地址: 192.168.200.130</p>
|
||
<p><img src="/pictures/image-20230811104741394.png" alt="image-20230811104741394"></p>
|
||
<h3 id="1-2-Linux软件安装"><a href="#1-2-Linux软件安装" class="headerlink" title="1.2 Linux软件安装"></a>1.2 Linux软件安装</h3><p><strong><a href="https://qingling.icu/posts/20683.html">Linux中开发环境的搭建 | The Blog (qingling.icu)</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><ul>
|
||
<li><p><strong>JDK1.8</strong></p>
|
||
</li>
|
||
<li><p><strong>Intellij Idea</strong></p>
|
||
</li>
|
||
<li><p><strong>maven-3.6.1</strong></p>
|
||
</li>
|
||
<li><p><strong>Git</strong></p>
|
||
</li>
|
||
</ul>
|
||
<h3 id="2-2-后端工程的搭建"><a href="#2-2-后端工程的搭建" class="headerlink" title="2.2 后端工程的搭建"></a>2.2 后端工程的搭建</h3><p><img src="/pictures/image-20230811160530674.png" alt="image-20230811160530674"></p>
|
||
<p>解压heima-leadnews.zip文件并用IDEA工具打开</p>
|
||
<p><img src="/pictures/image-20230811152915886.png" alt="image-20230811152915886"></p>
|
||
<p>编码格式的设置</p>
|
||
<p><img src="/pictures/image-20230811154426723.png" alt="image-20230811154426723"></p>
|
||
<h1 id="三-app端功能开发"><a href="#三-app端功能开发" class="headerlink" title="三.app端功能开发"></a>三.app端功能开发</h1><h2 id="1-app登录"><a href="#1-app登录" class="headerlink" title="1.app登录"></a>1.app登录</h2><p>登录相关的表结构</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th><strong>表名称</strong></th>
|
||
<th><strong>说明</strong></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>ap_user</td>
|
||
<td>APP用户信息表</td>
|
||
</tr>
|
||
<tr>
|
||
<td>ap_user_fan</td>
|
||
<td>APP用户粉丝信息表</td>
|
||
</tr>
|
||
<tr>
|
||
<td>ap_user_follow</td>
|
||
<td>APP用户关注信息表</td>
|
||
</tr>
|
||
<tr>
|
||
<td>ap_user_realname</td>
|
||
<td>APP实名认证信息表</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<p>ap_user表对应的实体类</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.model.user.pojos;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.IdType;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.TableField;</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 class="keyword">import</span> lombok.Data;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.Serializable;</span><br><span class="line"><span class="keyword">import</span> java.util.Date;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <p></span></span><br><span class="line"><span class="comment"> * APP用户信息表</span></span><br><span class="line"><span class="comment"> * </p></span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> itheima</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("ap_user")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ApUser</span> <span class="keyword">implements</span> <span class="title class_">Serializable</span> {</span><br><span class="line"></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"> * 主键</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@TableId(value = "id", type = IdType.AUTO)</span></span><br><span class="line"> <span class="keyword">private</span> Integer id;</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">@TableField("salt")</span></span><br><span class="line"> <span class="keyword">private</span> String salt;</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">@TableField("name")</span></span><br><span class="line"> <span class="keyword">private</span> String name;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 密码,md5加密</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@TableField("password")</span></span><br><span class="line"> <span class="keyword">private</span> String password;</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">@TableField("phone")</span></span><br><span class="line"> <span class="keyword">private</span> String phone;</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">@TableField("image")</span></span><br><span class="line"> <span class="keyword">private</span> String image;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 0 男</span></span><br><span class="line"><span class="comment"> 1 女</span></span><br><span class="line"><span class="comment"> 2 未知</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@TableField("sex")</span></span><br><span class="line"> <span class="keyword">private</span> Boolean sex;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 0 未</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"> <span class="meta">@TableField("is_certification")</span></span><br><span class="line"> <span class="keyword">private</span> Boolean certification;</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">@TableField("is_identity_authentication")</span></span><br><span class="line"> <span class="keyword">private</span> Boolean identityAuthentication;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 0正常</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"> <span class="meta">@TableField("status")</span></span><br><span class="line"> <span class="keyword">private</span> Boolean status;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 0 普通用户</span></span><br><span class="line"><span class="comment"> 1 自媒体人</span></span><br><span class="line"><span class="comment"> 2 大V</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@TableField("flag")</span></span><br><span class="line"> <span class="keyword">private</span> Short flag;</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">@TableField("created_time")</span></span><br><span class="line"> <span class="keyword">private</span> Date createdTime;</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="1-1-用户登录逻辑"><a href="#1-1-用户登录逻辑" class="headerlink" title="1.1 用户登录逻辑"></a>1.1 用户登录逻辑</h3><p><strong>注册加盐的过程</strong></p>
|
||
<p> 用户在登录的时候会生成一个随机的字符串(salt),这个随机的字符串会加到密码后面然后连同密码加密存储到数据库。</p>
|
||
<p><img src="/pictures/image-20230811165505210.png" alt="image-20230811165505210"></p>
|
||
<p><strong>登录加盐的过程</strong></p>
|
||
<p> 先根据账号查询是否存在该用户,如果存在的话,根据用户输入的密码和数据库中的salt进行md5加密,并和数据库中的密码比对,一致的话,比对通过,不一样的话不通过。</p>
|
||
<p><img src="/pictures/image-20230811165808912.png" alt="image-20230811165808912"></p>
|
||
<h3 id="1-2-用户模块搭建"><a href="#1-2-用户模块搭建" class="headerlink" title="1.2 用户模块搭建"></a>1.2 用户模块搭建</h3><p>heima-leadnews-service父工程依赖文件</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="meta"><?xml version=<span class="string">"1.0"</span> encoding=<span class="string">"UTF-8"</span>?></span></span><br><span class="line"><span class="tag"><<span class="name">project</span> <span class="attr">xmlns</span>=<span class="string">"http://maven.apache.org/POM/4.0.0"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">xmlns:xsi</span>=<span class="string">"http://www.w3.org/2001/XMLSchema-instance"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">xsi:schemaLocation</span>=<span class="string">"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">parent</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>heima-leadnews<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.heima<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>1.0-SNAPSHOT<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">parent</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">packaging</span>></span>pom<span class="tag"></<span class="name">packaging</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">modules</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">module</span>></span>heima-leadnews-user<span class="tag"></<span class="name">module</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">modules</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">modelVersion</span>></span>4.0.0<span class="tag"></<span class="name">modelVersion</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>heima-leadnews-service<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">properties</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">maven.compiler.source</span>></span>8<span class="tag"></<span class="name">maven.compiler.source</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">maven.compiler.target</span>></span>8<span class="tag"></<span class="name">maven.compiler.target</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">properties</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">dependencies</span>></span></span><br><span class="line"> <span class="comment"><!-- 数据模型子模块 --></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.heima<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>heima-leadnews-model<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- 公共子模块 --></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.heima<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>heima-leadnews-common<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- 远程调用子模块 --></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.heima<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>heima-leadnews-feign-api<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- Spring Boot Web starter --></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-web<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- Spring Boot Test测试 --></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-test<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">scope</span>></span>test<span class="tag"></<span class="name">scope</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- Nacos注册中心 --></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.alibaba.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-starter-alibaba-nacos-discovery<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- Nacos配置中心 --></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.alibaba.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-starter-alibaba-nacos-config<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- Feign远程调用客户端 --></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-starter-openfeign<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependencies</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">project</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<ol>
|
||
<li><p>创建子模块并创建出对应的目录结构</p>
|
||
<p>在heima-leadnews-service父工程下创建工程heima-leadnews-user</p>
|
||
<p><img src="/pictures/image-20230812172036450.png" alt="image-20230812172036450"></p>
|
||
</li>
|
||
<li><p>编写用户模块的配置文件</p>
|
||
<figure class="highlight yaml"><table><tr><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">51801</span></span><br><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">leadnews-user</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">192.168</span><span class="number">.200</span><span class="number">.130</span><span class="string">:8848</span></span><br><span class="line"> <span class="attr">config:</span></span><br><span class="line"> <span class="attr">server-addr:</span> <span class="number">192.168</span><span class="number">.200</span><span class="number">.130</span><span class="string">:8848</span></span><br><span class="line"> <span class="attr">file-extension:</span> <span class="string">yml</span></span><br></pre></td></tr></table></figure>
|
||
</li>
|
||
<li><p>在配置中心中添加数据库等相关的配置</p>
|
||
<p><img src="/pictures/image-20230812173024036.png" alt="image-20230812173024036"></p>
|
||
</li>
|
||
<li><p>在resources目录下添加日志的配置文件</p>
|
||
<p>logback.xml</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="meta"><?xml version=<span class="string">"1.0"</span> encoding=<span class="string">"UTF-8"</span>?></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">configuration</span>></span></span><br><span class="line"> <span class="comment"><!--定义日志文件的存储地址,使用绝对路径--></span></span><br><span class="line"> <span class="tag"><<span class="name">property</span> <span class="attr">name</span>=<span class="string">"LOG_HOME"</span> <span class="attr">value</span>=<span class="string">"e:/logs"</span>/></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- Console 输出设置 --></span></span><br><span class="line"> <span class="tag"><<span class="name">appender</span> <span class="attr">name</span>=<span class="string">"CONSOLE"</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.ConsoleAppender"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">encoder</span>></span></span><br><span class="line"> <span class="comment"><!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--></span></span><br><span class="line"> <span class="tag"><<span class="name">pattern</span>></span>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n<span class="tag"></<span class="name">pattern</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">charset</span>></span>utf8<span class="tag"></<span class="name">charset</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">encoder</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">appender</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- 按照每天生成日志文件 --></span></span><br><span class="line"> <span class="tag"><<span class="name">appender</span> <span class="attr">name</span>=<span class="string">"FILE"</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.RollingFileAppender"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">rollingPolicy</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"</span>></span></span><br><span class="line"> <span class="comment"><!--日志文件输出的文件名--></span></span><br><span class="line"> <span class="tag"><<span class="name">fileNamePattern</span>></span>${LOG_HOME}/leadnews.%d{yyyy-MM-dd}.log<span class="tag"></<span class="name">fileNamePattern</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">rollingPolicy</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">encoder</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">pattern</span>></span>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n<span class="tag"></<span class="name">pattern</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">encoder</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">appender</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- 异步输出 --></span></span><br><span class="line"> <span class="tag"><<span class="name">appender</span> <span class="attr">name</span>=<span class="string">"ASYNC"</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.classic.AsyncAppender"</span>></span></span><br><span class="line"> <span class="comment"><!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 --></span></span><br><span class="line"> <span class="tag"><<span class="name">discardingThreshold</span>></span>0<span class="tag"></<span class="name">discardingThreshold</span>></span></span><br><span class="line"> <span class="comment"><!-- 更改默认的队列的深度,该值会影响性能.默认值为256 --></span></span><br><span class="line"> <span class="tag"><<span class="name">queueSize</span>></span>512<span class="tag"></<span class="name">queueSize</span>></span></span><br><span class="line"> <span class="comment"><!-- 添加附加的appender,最多只能添加一个 --></span></span><br><span class="line"> <span class="tag"><<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"FILE"</span>/></span></span><br><span class="line"> <span class="tag"></<span class="name">appender</span>></span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">logger</span> <span class="attr">name</span>=<span class="string">"org.apache.ibatis.cache.decorators.LoggingCache"</span> <span class="attr">level</span>=<span class="string">"DEBUG"</span> <span class="attr">additivity</span>=<span class="string">"false"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"CONSOLE"</span>/></span></span><br><span class="line"> <span class="tag"></<span class="name">logger</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">logger</span> <span class="attr">name</span>=<span class="string">"org.springframework.boot"</span> <span class="attr">level</span>=<span class="string">"debug"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">root</span> <span class="attr">level</span>=<span class="string">"info"</span>></span></span><br><span class="line"> <span class="comment"><!--<appender-ref ref="ASYNC"/>--></span></span><br><span class="line"> <span class="tag"><<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"FILE"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"CONSOLE"</span>/></span></span><br><span class="line"> <span class="tag"></<span class="name">root</span>></span></span><br><span class="line"><span class="tag"></<span class="name">configuration</span>></span></span><br></pre></td></tr></table></figure></li>
|
||
</ol>
|
||
<p><strong>遇到的问题:</strong></p>
|
||
<ol>
|
||
<li><p>问题一:引入@EnableDiscoveryClient注解的时候爆红</p>
|
||
<p>解决方案:在heima-leadnews-service父工程下加入如下的注解</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!-- Feign远程调用客户端 --></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-starter-openfeign<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure></li>
|
||
</ol>
|
||
<h3 id="1-3-登录功能实现"><a href="#1-3-登录功能实现" class="headerlink" title="1.3 登录功能实现"></a>1.3 登录功能实现</h3><h4 id="1-3-1-接口定义"><a href="#1-3-1-接口定义" class="headerlink" title="1.3.1 接口定义"></a>1.3.1 接口定义</h4><table>
|
||
<thead>
|
||
<tr>
|
||
<th><strong>接口路径</strong></th>
|
||
<th>/api/v1/login/login_auth</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>请求方式</td>
|
||
<td>POST</td>
|
||
</tr>
|
||
<tr>
|
||
<td>参数</td>
|
||
<td>LoginDto</td>
|
||
</tr>
|
||
<tr>
|
||
<td>响应结果</td>
|
||
<td>ResponseResult</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<p>LoginDto </p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><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_">LoginDto</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="meta">@ApiModelProperty(value = "手机号",required = true)</span></span><br><span class="line"> <span class="keyword">private</span> String phone;</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">@ApiModelProperty(value = "密码",required = true)</span></span><br><span class="line"> <span class="keyword">private</span> String password;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>统一返回结果类</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.model.common.dtos;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.alibaba.fastjson.JSON;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.common.enums.AppHttpCodeEnum;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.Serializable;</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.HashMap;</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><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> <T></span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ResponseResult</span><T> <span class="keyword">implements</span> <span class="title class_">Serializable</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String host;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> Integer code;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String errorMessage;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> T data;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="title function_">ResponseResult</span><span class="params">()</span> {</span><br><span class="line"> <span class="built_in">this</span>.code = <span class="number">200</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="title function_">ResponseResult</span><span class="params">(Integer code, T data)</span> {</span><br><span class="line"> <span class="built_in">this</span>.code = code;</span><br><span class="line"> <span class="built_in">this</span>.data = data;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="title function_">ResponseResult</span><span class="params">(Integer code, String msg, T data)</span> {</span><br><span class="line"> <span class="built_in">this</span>.code = code;</span><br><span class="line"> <span class="built_in">this</span>.errorMessage = msg;</span><br><span class="line"> <span class="built_in">this</span>.data = data;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="title function_">ResponseResult</span><span class="params">(Integer code, String msg)</span> {</span><br><span class="line"> <span class="built_in">this</span>.code = code;</span><br><span class="line"> <span class="built_in">this</span>.errorMessage = msg;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> ResponseResult <span class="title function_">errorResult</span><span class="params">(<span class="type">int</span> code, String msg)</span> {</span><br><span class="line"> <span class="type">ResponseResult</span> <span class="variable">result</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ResponseResult</span>();</span><br><span class="line"> <span class="keyword">return</span> result.error(code, msg);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> ResponseResult <span class="title function_">okResult</span><span class="params">(<span class="type">int</span> code, String msg)</span> {</span><br><span class="line"> <span class="type">ResponseResult</span> <span class="variable">result</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ResponseResult</span>();</span><br><span class="line"> <span class="keyword">return</span> result.ok(code, <span class="literal">null</span>, msg);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> ResponseResult <span class="title function_">okResult</span><span class="params">(Object data)</span> {</span><br><span class="line"> <span class="type">ResponseResult</span> <span class="variable">result</span> <span class="operator">=</span> setAppHttpCodeEnum(AppHttpCodeEnum.SUCCESS, AppHttpCodeEnum.SUCCESS.getErrorMessage());</span><br><span class="line"> <span class="keyword">if</span>(data!=<span class="literal">null</span>) {</span><br><span class="line"> result.setData(data);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> result;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> ResponseResult <span class="title function_">errorResult</span><span class="params">(AppHttpCodeEnum enums)</span>{</span><br><span class="line"> <span class="keyword">return</span> setAppHttpCodeEnum(enums,enums.getErrorMessage());</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> ResponseResult <span class="title function_">errorResult</span><span class="params">(AppHttpCodeEnum enums, String errorMessage)</span>{</span><br><span class="line"> <span class="keyword">return</span> setAppHttpCodeEnum(enums,errorMessage);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> ResponseResult <span class="title function_">setAppHttpCodeEnum</span><span class="params">(AppHttpCodeEnum enums)</span>{</span><br><span class="line"> <span class="keyword">return</span> okResult(enums.getCode(),enums.getErrorMessage());</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">static</span> ResponseResult <span class="title function_">setAppHttpCodeEnum</span><span class="params">(AppHttpCodeEnum enums, String errorMessage)</span>{</span><br><span class="line"> <span class="keyword">return</span> okResult(enums.getCode(),errorMessage);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> ResponseResult<?> error(Integer code, String msg) {</span><br><span class="line"> <span class="built_in">this</span>.code = code;</span><br><span class="line"> <span class="built_in">this</span>.errorMessage = msg;</span><br><span class="line"> <span class="keyword">return</span> <span class="built_in">this</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> ResponseResult<?> ok(Integer code, T data) {</span><br><span class="line"> <span class="built_in">this</span>.code = code;</span><br><span class="line"> <span class="built_in">this</span>.data = data;</span><br><span class="line"> <span class="keyword">return</span> <span class="built_in">this</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> ResponseResult<?> ok(Integer code, T data, String msg) {</span><br><span class="line"> <span class="built_in">this</span>.code = code;</span><br><span class="line"> <span class="built_in">this</span>.data = data;</span><br><span class="line"> <span class="built_in">this</span>.errorMessage = msg;</span><br><span class="line"> <span class="keyword">return</span> <span class="built_in">this</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> ResponseResult<?> ok(T data) {</span><br><span class="line"> <span class="built_in">this</span>.data = data;</span><br><span class="line"> <span class="keyword">return</span> <span class="built_in">this</span>;</span><br><span class="line"> }</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> {</span><br><span class="line"> <span class="keyword">return</span> code;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">setCode</span><span class="params">(Integer code)</span> {</span><br><span class="line"> <span class="built_in">this</span>.code = code;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">getErrorMessage</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> errorMessage;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">setErrorMessage</span><span class="params">(String errorMessage)</span> {</span><br><span class="line"> <span class="built_in">this</span>.errorMessage = errorMessage;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> T <span class="title function_">getData</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> data;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">setData</span><span class="params">(T data)</span> {</span><br><span class="line"> <span class="built_in">this</span>.data = data;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">getHost</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> host;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">setHost</span><span class="params">(String host)</span> {</span><br><span class="line"> <span class="built_in">this</span>.host = host;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="comment">//前置</span></span><br><span class="line"> <span class="comment">/*AppHttpCodeEnum success = AppHttpCodeEnum.SUCCESS;</span></span><br><span class="line"><span class="comment"> System.out.println(success.getCode());</span></span><br><span class="line"><span class="comment"> System.out.println(success.getErrorMessage());*/</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">//查询一个对象</span></span><br><span class="line"> <span class="comment">/*Map map = new HashMap();</span></span><br><span class="line"><span class="comment"> map.put("name","zhangsan");</span></span><br><span class="line"><span class="comment"> map.put("age",18);</span></span><br><span class="line"><span class="comment"> ResponseResult result = ResponseResult.okResult(map);</span></span><br><span class="line"><span class="comment"> System.out.println(JSON.toJSONString(result));*/</span></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">/* ResponseResult result = ResponseResult.errorResult(AppHttpCodeEnum.SUCCESS);</span></span><br><span class="line"><span class="comment"> System.out.println(JSON.toJSONString(result));*/</span></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">/*ResponseResult result = ResponseResult.errorResult(AppHttpCodeEnum.NEED_LOGIN);</span></span><br><span class="line"><span class="comment"> System.out.println(JSON.toJSONString(result));*/</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">//查询分页信息</span></span><br><span class="line"> <span class="type">PageResponseResult</span> <span class="variable">responseResult</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">PageResponseResult</span>(<span class="number">1</span>,<span class="number">5</span>,<span class="number">50</span>);</span><br><span class="line"> <span class="type">List</span> <span class="variable">list</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ArrayList</span>();</span><br><span class="line"> list.add(<span class="string">"itcast"</span>);</span><br><span class="line"> list.add(<span class="string">"itheima"</span>);</span><br><span class="line"> responseResult.setData(list);</span><br><span class="line"> System.out.println(JSON.toJSONString(responseResult));</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</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><img src="/pictures/image-20230812180918302.png" alt="image-20230812180918302"></p>
|
||
<h4 id="1-3-3-登录关键代码实现"><a href="#1-3-3-登录关键代码实现" class="headerlink" title="1.3.3 登录关键代码实现"></a>1.3.3 登录关键代码实现</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.user.service.impl;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.core.toolkit.Wrappers;</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.heima.model.common.dtos.ResponseResult;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.common.enums.AppHttpCodeEnum;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.user.dtos.LoginDto;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.user.pojos.ApUser;</span><br><span class="line"><span class="keyword">import</span> com.heima.user.mapper.ApUserMapper;</span><br><span class="line"><span class="keyword">import</span> com.heima.user.service.ApUserService;</span><br><span class="line"><span class="keyword">import</span> com.heima.utils.common.AppJwtUtil;</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.apache.commons.lang3.StringUtils;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Service;</span><br><span class="line"><span class="keyword">import</span> org.springframework.transaction.annotation.Transactional;</span><br><span class="line"><span class="keyword">import</span> org.springframework.util.DigestUtils;</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><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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/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">@Service</span></span><br><span class="line"><span class="meta">@Transactional</span></span><br><span class="line"><span class="meta">@Slf4j</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ApUserServiceImpl</span> <span class="keyword">extends</span> <span class="title class_">ServiceImpl</span><ApUserMapper, ApUser> <span class="keyword">implements</span> <span class="title class_">ApUserService</span> {</span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> ResponseResult <span class="title function_">login</span><span class="params">(LoginDto loginDto)</span> {</span><br><span class="line"> <span class="comment">//1 正常的登录 用户名和密码</span></span><br><span class="line"> <span class="keyword">if</span>(StringUtils.isNotBlank(loginDto.getPhone()) && StringUtils.isNotBlank(loginDto.getPassword())) {</span><br><span class="line"> <span class="comment">//1.1 根据手机号查询用户的信息</span></span><br><span class="line"> <span class="type">ApUser</span> <span class="variable">dbUser</span> <span class="operator">=</span> getOne(<span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><ApUser>().eq(ApUser::getPhone, loginDto.getPhone()));</span><br><span class="line"> <span class="keyword">if</span>(dbUser == <span class="literal">null</span>){</span><br><span class="line"> <span class="keyword">return</span> ResponseResult.errorResult(AppHttpCodeEnum.DATA_NOT_EXIST,<span class="string">"用户信息不存在"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="type">String</span> <span class="variable">salt</span> <span class="operator">=</span> dbUser.getSalt();</span><br><span class="line"> <span class="type">String</span> <span class="variable">password</span> <span class="operator">=</span> loginDto.getPassword();</span><br><span class="line"> <span class="type">String</span> <span class="variable">pwd</span> <span class="operator">=</span> DigestUtils.md5DigestAsHex((password + salt).getBytes());</span><br><span class="line"> <span class="comment">//1.2 比对密码</span></span><br><span class="line"> <span class="keyword">if</span>(!pwd.equals(dbUser.getPassword())){</span><br><span class="line"> <span class="keyword">return</span> ResponseResult.errorResult(AppHttpCodeEnum.LOGIN_PASSWORD_ERROR);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//1.3 生成token</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">token</span> <span class="operator">=</span> AppJwtUtil.getToken(dbUser.getId().longValue());</span><br><span class="line"> Map<String,Object> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> map.put(<span class="string">"token"</span>,token);</span><br><span class="line"> dbUser.setSalt(<span class="string">""</span>);</span><br><span class="line"> dbUser.setPassword(<span class="string">""</span>);</span><br><span class="line"> map.put(<span class="string">"user"</span>,dbUser);</span><br><span class="line"> <span class="keyword">return</span> ResponseResult.okResult(map);</span><br><span class="line"> }<span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">//2.游客登录</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">token</span> <span class="operator">=</span> AppJwtUtil.getToken(<span class="number">0L</span>);</span><br><span class="line"> Map<String,Object> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> map.put(<span class="string">"token"</span>,token);</span><br><span class="line"> <span class="keyword">return</span> ResponseResult.okResult(map);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-3-4-使用接口工具测试"><a href="#1-3-4-使用接口工具测试" class="headerlink" title="1.3.4 使用接口工具测试"></a>1.3.4 使用接口工具测试</h4><p>接口测试工具使用教程:<a href="https://qingling.icu/posts/35630.html">https://qingling.icu/posts/35630.html</a></p>
|
||
<p><img src="/pictures/image-20230813165436808.png" alt="image-20230813165436808"></p>
|
||
<h2 id="2-app端网关搭建"><a href="#2-app端网关搭建" class="headerlink" title="2. app端网关搭建"></a>2. app端网关搭建</h2><p>网关的概述</p>
|
||
<p><img src="/pictures/image-20230814142355139.png" alt="image-20230814142355139"></p>
|
||
<p>项目中搭建的网关</p>
|
||
<p><img src="/pictures/image-20230814142700349.png" alt="image-20230814142700349"></p>
|
||
<h3 id="2-1-搭建过程"><a href="#2-1-搭建过程" class="headerlink" title="2.1 搭建过程"></a>2.1 搭建过程</h3><p><strong>1.在heima-leadnews-gateway导入以下依赖</strong></p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependencies</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-starter-gateway<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.alibaba.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-starter-alibaba-nacos-discovery<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.alibaba.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-starter-alibaba-nacos-config<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>io.jsonwebtoken<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>jjwt<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependencies</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>2.创建网关的模块</strong></p>
|
||
<p><img src="/pictures/image-20230814143113564.png" alt="image-20230814143113564"></p>
|
||
<p><strong>3.创建启动类和bootstrap.yml配置文件</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@EnableDiscoveryClient</span></span><br><span class="line"><span class="meta">@SpringBootApplication</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">AppGatewayApplication</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> SpringApplication.run(AppGatewayApplication.class,args);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight yaml"><table><tr><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">51601</span></span><br><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">leadnews-app-gateway</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">192.168</span><span class="number">.200</span><span class="number">.130</span><span class="string">:8848</span></span><br><span class="line"> <span class="attr">config:</span></span><br><span class="line"> <span class="attr">server-addr:</span> <span class="number">192.168</span><span class="number">.200</span><span class="number">.130</span><span class="string">:8848</span></span><br><span class="line"> <span class="attr">file-extension:</span> <span class="string">yml</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>4.在nacos中创建app端网关的配置</strong></p>
|
||
<p><img src="/pictures/image-20230814143939252.png" alt="image-20230814143939252"></p>
|
||
<figure class="highlight yaml"><table><tr><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">globalcors:</span></span><br><span class="line"> <span class="attr">add-to-simple-url-handler-mapping:</span> <span class="literal">true</span></span><br><span class="line"> <span class="attr">corsConfigurations:</span></span><br><span class="line"> <span class="string">'[/**]'</span><span class="string">:</span></span><br><span class="line"> <span class="attr">allowedHeaders:</span> <span class="string">"*"</span></span><br><span class="line"> <span class="attr">allowedOrigins:</span> <span class="string">"*"</span></span><br><span class="line"> <span class="attr">allowedMethods:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">GET</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">POST</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">DELETE</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">PUT</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">OPTION</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">user</span></span><br><span class="line"> <span class="attr">uri:</span> <span class="string">lb://leadnews-user</span></span><br><span class="line"> <span class="attr">predicates:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">Path=/user/**</span></span><br><span class="line"> <span class="attr">filters:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">StripPrefix=</span> <span class="number">1</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>5.使用Postman测试网关</strong></p>
|
||
<p><a href="http://localhost:51601/user/api/v1/login/login_auth">http://localhost:51601/user/api/v1/login/login_auth</a></p>
|
||
<p><img src="/pictures/image-20230814144314358.png" alt="image-20230814144314358"></p>
|
||
<h3 id="2-2-全局过滤器实现jwt校验"><a href="#2-2-全局过滤器实现jwt校验" class="headerlink" title="2.2 全局过滤器实现jwt校验"></a>2.2 全局过滤器实现jwt校验</h3><p>网关的过滤流程</p>
|
||
<p><img src="/pictures/image-20230814144806282.png" alt="image-20230814144806282"></p>
|
||
<p>思路分析:</p>
|
||
<ol>
|
||
<li>用户进入网关开始登陆,网关过滤器进行判断,如果是登录,则路由到后台管理微服务进行登录</li>
|
||
<li>用户登录成功,后台管理微服务签发JWT TOKEN信息返回给用户</li>
|
||
<li>用户再次进入网关开始访问,网关过滤器接收用户携带的TOKEN </li>
|
||
<li>网关过滤器解析TOKEN ,判断是否有权限,如果有,则放行,如果没有则返回未认证错误</li>
|
||
</ol>
|
||
<p><strong>JWT认证的过滤器</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/14</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">@Component</span></span><br><span class="line"><span class="meta">@Slf4j</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">AuthorizeFilter</span> <span class="keyword">implements</span> <span class="title class_">Ordered</span>, GlobalFilter {</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="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> Mono<Void> <span class="title function_">filter</span><span class="params">(ServerWebExchange exchange, GatewayFilterChain chain)</span> {</span><br><span class="line"> <span class="comment">//1.获取request和response对象</span></span><br><span class="line"> <span class="type">ServerHttpRequest</span> <span class="variable">request</span> <span class="operator">=</span> exchange.getRequest();</span><br><span class="line"> <span class="type">ServerHttpResponse</span> <span class="variable">response</span> <span class="operator">=</span> exchange.getResponse();</span><br><span class="line"></span><br><span class="line"> <span class="comment">//2.判断是否登录</span></span><br><span class="line"> <span class="comment">//通过请求的路径的url判断</span></span><br><span class="line"> <span class="keyword">if</span> (request.getURI().getPath().contains(<span class="string">"/login"</span>)) {</span><br><span class="line"> <span class="comment">//放行</span></span><br><span class="line"> <span class="keyword">return</span> chain.filter(exchange);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//3.获取token</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">token</span> <span class="operator">=</span> request.getHeaders().getFirst(<span class="string">"token"</span>);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//4.判断token是否存在</span></span><br><span class="line"> <span class="keyword">if</span> (StringUtils.isBlank(token)) {</span><br><span class="line"> <span class="comment">//设置401的状态码</span></span><br><span class="line"> response.setStatusCode(HttpStatus.UNAUTHORIZED);</span><br><span class="line"> <span class="keyword">return</span> response.setComplete();</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//5.判断token是否有效</span></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">//获取token中的数据</span></span><br><span class="line"> <span class="type">Claims</span> <span class="variable">claims</span> <span class="operator">=</span> AppJwtUtil.getClaimsBody(token);</span><br><span class="line"> <span class="comment">//判断token是否过期 -1:有效,0:有效,1:过期,2:过期</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">res</span> <span class="operator">=</span> AppJwtUtil.verifyToken(claims);</span><br><span class="line"> <span class="keyword">if</span> (res == <span class="number">1</span> || res == <span class="number">2</span>) {</span><br><span class="line"> <span class="comment">//设置401的状态码</span></span><br><span class="line"> response.setStatusCode(HttpStatus.UNAUTHORIZED);</span><br><span class="line"> <span class="keyword">return</span> response.setComplete();</span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> <span class="comment">//设置401的状态码</span></span><br><span class="line"> response.setStatusCode(HttpStatus.UNAUTHORIZED);</span><br><span class="line"> <span class="keyword">return</span> response.setComplete();</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//6.放行</span></span><br><span class="line"> <span class="keyword">return</span> chain.filter(exchange);</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="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="type">int</span> <span class="title function_">getOrder</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="3-app前端项目集成"><a href="#3-app前端项目集成" class="headerlink" title="3.app前端项目集成"></a>3.app前端项目集成</h2><p><img src="/pictures/image-20230814151319382.png" alt="image-20230814151319382"></p>
|
||
<p>通过nginx来进行配置,功能如下</p>
|
||
<ul>
|
||
<li>通过nginx的反向代理功能访问后台的网关资源</li>
|
||
<li>通过nginx的静态服务器功能访问前端静态页面</li>
|
||
</ul>
|
||
<h3 id="3-1-Nginx集成前端项目步骤"><a href="#3-1-Nginx集成前端项目步骤" class="headerlink" title="3.1 Nginx集成前端项目步骤"></a>3.1 Nginx集成前端项目步骤</h3><p><strong>①:解压资料文件夹中的压缩包nginx-1.18.0.zip</strong></p>
|
||
<p>cmd切换到nginx所有的目录输入nginx启动nginx</p>
|
||
<p><img src="/pictures/image-20230814152058708.png" alt="image-20230814152058708"></p>
|
||
<p><img src="/pictures/image-20230814152144765.png" alt="image-20230814152144765"></p>
|
||
<p><strong>②:解压资料文件夹中的前端项目app-web.zip</strong></p>
|
||
<p>解压到一个没有中文的文件夹中,后面nginx配置中会指向这个目录</p>
|
||
<p><strong>③:配置nginx.conf文件</strong></p>
|
||
<p>在nginx安装的conf目录下新建一个文件夹<code>leadnews.conf</code>,在当前文件夹中新建<code>heima-leadnews-app.conf</code>文件</p>
|
||
<p>heima-leadnews-app.conf配置如下:</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">upstream heima-app-gateway{</span><br><span class="line"> #APP端网关所在的端口</span><br><span class="line"> server localhost:51601;</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line">server {</span><br><span class="line"> listen 8801;</span><br><span class="line"> location / {</span><br><span class="line"> root C:/Gong/data/app-web/;</span><br><span class="line"> index index.html;</span><br><span class="line"> }</span><br><span class="line"> </span><br><span class="line"> location ~/app/(.*) {</span><br><span class="line"> proxy_pass http://heima-app-gateway/$1;</span><br><span class="line"> proxy_set_header HOST $host; # 不改变源请求头的值</span><br><span class="line"> proxy_pass_request_body on; #开启获取请求体</span><br><span class="line"> proxy_pass_request_headers on; #开启获取请求头</span><br><span class="line"> proxy_set_header X-Real-IP $remote_addr; # 记录真实发出请求的客户端IP</span><br><span class="line"> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #记录代理信息</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>nginx.conf 把里面注释的内容和静态资源配置相关删除,引入heima-leadnews-app.conf文件加载</p>
|
||
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line">#user nobody;</span><br><span class="line">worker_processes <span class="number">1</span>;</span><br><span class="line"></span><br><span class="line">events {</span><br><span class="line"> worker_connections <span class="number">1024</span>;</span><br><span class="line">}</span><br><span class="line">http {</span><br><span class="line"> include mime.<span class="property">types</span>;</span><br><span class="line"> default_type application/octet-stream;</span><br><span class="line"> sendfile on;</span><br><span class="line"> keepalive_timeout <span class="number">65</span>;</span><br><span class="line"> # 引入自定义配置文件</span><br><span class="line"> include leadnews.<span class="property">conf</span><span class="comment">/*.conf;</span></span><br><span class="line"><span class="comment">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>④ :启动nginx</strong></p>
|
||
<p> 在nginx安装包中使用命令提示符打开,输入命令nginx启动项目</p>
|
||
<p> 可查看进程,检查nginx是否启动</p>
|
||
<p> 重新加载配置文件:<code>nginx -s reload</code></p>
|
||
<p><strong>⑤:打开前端项目进行测试 – > <a href="http://localhost:8801/">http://localhost:8801</a></strong></p>
|
||
<p> 用谷歌浏览器打开,调试移动端模式进行访问</p>
|
||
<p><img src="/pictures/image-20230814153335349.png" alt="image-20230814153335349"></p>
|
||
<h2 id="4-app端文章列表功能"><a href="#4-app端文章列表功能" class="headerlink" title="4.app端文章列表功能"></a>4.app端文章列表功能</h2><p><strong>开发前app的首页面</strong></p>
|
||
<p><img src="/pictures/image-20230814154205134.png" alt="image-20230814154205134"></p>
|
||
<p><strong>文章的布局展示</strong></p>
|
||
<p><img src="/pictures/image-20230814154405531.png" alt="image-20230814154405531"></p>
|
||
<h3 id="4-1-数据库表的创建"><a href="#4-1-数据库表的创建" class="headerlink" title="4.1 数据库表的创建"></a>4.1 数据库表的创建</h3><p><strong>文章的相关的数据库</strong></p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th><strong>表名称</strong></th>
|
||
<th><strong>说明</strong></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>ap_article</td>
|
||
<td>文章信息表,存储已发布的文章</td>
|
||
</tr>
|
||
<tr>
|
||
<td>ap_article_config</td>
|
||
<td>APP已发布文章配置表</td>
|
||
</tr>
|
||
<tr>
|
||
<td>ap_article_content</td>
|
||
<td>APP已发布文章内容表</td>
|
||
</tr>
|
||
<tr>
|
||
<td>ap_author</td>
|
||
<td>APP文章作者信息表</td>
|
||
</tr>
|
||
<tr>
|
||
<td>ap_collection</td>
|
||
<td>APP收藏信息表</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<p><strong>导入资料中的sql文件创建相关的数据库表</strong></p>
|
||
<p><img src="/pictures/image-20230814160312382.png" alt="image-20230814160312382"></p>
|
||
<p><strong>关键的数据库表</strong></p>
|
||
<p>文章基本信息表</p>
|
||
<p><img src="/pictures/image-20230814160547893.png" alt="image-20230814160547893"></p>
|
||
<p> APP已发布文章配置表 </p>
|
||
<p><img src="/pictures/image-20230814160652330.png" alt="image-20230814160652330"></p>
|
||
<p>APP已发布文章内容表 </p>
|
||
<p><img src="/pictures/image-20230814160728715.png" alt="image-20230814160728715"></p>
|
||
<p>APP文章作者信息表 </p>
|
||
<p><img src="/pictures/image-20230814160805398.png" alt="image-20230814160805398"></p>
|
||
<p>APP收藏信息表 </p>
|
||
<p><img src="/pictures/image-20230814160823771.png" alt="image-20230814160823771"></p>
|
||
<p><strong>垂直分表</strong></p>
|
||
<p>将文章相关的表分成文章配置表和文章内容表和文章信息表</p>
|
||
<p><img src="/pictures/image-20230814161909312.png" alt="image-20230814161909312"></p>
|
||
<p>垂直分表:将一个表的字段分散到多个表中,每个表存储其中一部分字段</p>
|
||
<p><strong>优势:</strong></p>
|
||
<ol>
|
||
<li><p>减少IO争抢,减少锁表的几率,查看文章概述与文章详情互不影响</p>
|
||
</li>
|
||
<li><p>充分发挥高频数据的操作效率,对文章概述数据操作的高效率不会被操作文章详情数据的低效率所拖累</p>
|
||
</li>
|
||
</ol>
|
||
<p><strong>拆分规则:</strong></p>
|
||
<p>1.把不常用的字段单独放在一张表</p>
|
||
<p>2.把text,blob等大字段拆分出来单独放在一张表</p>
|
||
<p>3.经常组合查询的字段单独放在一张表中</p>
|
||
<h3 id="4-2-文章模块搭建"><a href="#4-2-文章模块搭建" class="headerlink" title="4.2 文章模块搭建"></a>4.2 文章模块搭建</h3><p><strong>导入资料中的模块</strong></p>
|
||
<p><img src="/pictures/image-20230815184540157.png" alt="image-20230815184540157"></p>
|
||
<p><strong>在nacos中添加配置</strong></p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><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">driver-class-name:</span> <span class="string">com.mysql.jdbc.Driver</span></span><br><span class="line"> <span class="attr">url:</span> <span class="string">jdbc:mysql://localhost:3306/leadnews_article?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC</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="number">123456</span></span><br><span class="line"><span class="comment"># 设置Mapper接口所对应的XML文件位置,如果你在Mapper接口中有自定义方法,需要进行该配置</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><br><span class="line"> <span class="comment"># 设置别名包扫描路径,通过该属性可以给包中的类注册别名</span></span><br><span class="line"> <span class="attr">type-aliases-package:</span> <span class="string">com.heima.model.article.pojos</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230815162119814.png" alt="image-20230815162119814"></p>
|
||
<p><strong>踩坑</strong>: 在导入项目的时候提示Caused by: java.io.FileNotFoundException: class path resource [com/heima/apis/article/IArticleClient.class] cannot be opened because it does not exist ,先删除这个项目,手动创建这个项目,然后复制资料里面文件到这个项目即可,直接复制整个项目可能会报这个错!</p>
|
||
<h3 id="4-3-首页文章的列表显示"><a href="#4-3-首页文章的列表显示" class="headerlink" title="4.3 首页文章的列表显示"></a>4.3 首页文章的列表显示</h3><p><strong>首页上拉和下拉的实现思路</strong></p>
|
||
<p><img src="/pictures/image-20230814163019582.png" alt="image-20230814163019582"></p>
|
||
<p><strong>Sql语句实现</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line">#按照发布时间倒序查询十条文章</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> ap_article aa <span class="keyword">order</span> <span class="keyword">by</span> aa.publish_time <span class="keyword">desc</span> limit <span class="number">10</span></span><br><span class="line">#频道筛选</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> ap_article aa <span class="keyword">where</span> aa.channel_id <span class="operator">=</span> <span class="number">1</span> <span class="keyword">order</span> <span class="keyword">by</span> aa.publish_time <span class="keyword">desc</span> limit <span class="number">10</span></span><br><span class="line">#加载首页</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> ap_article aa <span class="keyword">where</span> aa.channel_id <span class="operator">=</span> <span class="number">1</span> <span class="keyword">and</span> aa.publish_time <span class="operator"><</span> <span class="string">'2063-09-08 10:20:12'</span> <span class="keyword">order</span> <span class="keyword">by</span> aa.publish_time <span class="keyword">desc</span> limit <span class="number">10</span></span><br><span class="line">#加载更多</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> ap_article aa <span class="keyword">where</span> aa.channel_id <span class="operator">=</span> <span class="number">1</span> <span class="keyword">and</span> aa.publish_time <span class="operator"><</span> <span class="string">'2020-09-07 22:30:09'</span> <span class="keyword">order</span> <span class="keyword">by</span> aa.publish_time <span class="keyword">desc</span> limit <span class="number">10</span></span><br><span class="line">#加载最新</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> ap_article aa <span class="keyword">where</span> aa.channel_id <span class="operator">=</span> <span class="number">1</span> <span class="keyword">and</span> aa.publish_time <span class="operator">></span> <span class="string">'2020-09-07 22:30:09'</span> <span class="keyword">order</span> <span class="keyword">by</span> aa.publish_time <span class="keyword">desc</span> limit <span class="number">10</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230815160034436.png" alt="image-20230815160034436"></p>
|
||
<h4 id="4-2-1-接口定义"><a href="#4-2-1-接口定义" class="headerlink" title="4.2.1 接口定义"></a>4.2.1 接口定义</h4><table>
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th><strong>加载首页</strong></th>
|
||
<th><strong>加载更多</strong></th>
|
||
<th><strong>加载最新</strong></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>接口路径</td>
|
||
<td>/api/v1/article/load</td>
|
||
<td>/api/v1/article/loadmore</td>
|
||
<td>/api/v1/article/loadnew</td>
|
||
</tr>
|
||
<tr>
|
||
<td>请求方式</td>
|
||
<td>POST</td>
|
||
<td>POST</td>
|
||
<td>POST</td>
|
||
</tr>
|
||
<tr>
|
||
<td>参数</td>
|
||
<td>ArticleHomeDto</td>
|
||
<td>ArticleHomeDto</td>
|
||
<td>ArticleHomeDto</td>
|
||
</tr>
|
||
<tr>
|
||
<td>响应结果</td>
|
||
<td>ResponseResult</td>
|
||
<td>ResponseResult</td>
|
||
<td>ResponseResult</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<p>ArticleHomeDto</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.model.article.dtos;</span><br><span class="line"><span class="keyword">import</span> lombok.Data;</span><br><span class="line"><span class="keyword">import</span> java.util.Date;</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_">ArticleHomeDto</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">// 最大时间</span></span><br><span class="line"> Date maxBehotTime;</span><br><span class="line"> <span class="comment">// 最小时间</span></span><br><span class="line"> Date minBehotTime;</span><br><span class="line"> <span class="comment">// 分页size</span></span><br><span class="line"> Integer size;</span><br><span class="line"> <span class="comment">// 频道ID</span></span><br><span class="line"> String tag;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="4-2-2-实现思路"><a href="#4-2-2-实现思路" class="headerlink" title="4.2.2 实现思路"></a>4.2.2 实现思路</h4><p><strong>①:导入heima-leadnews-article微服务,资料在当天的文件夹中</strong></p>
|
||
<p> <strong>需要在nacos中添加对应的配置</strong></p>
|
||
<p><strong>②:定义接口</strong></p>
|
||
<p> <strong>接口路径、请求方式、入参、出参</strong></p>
|
||
<p><strong>③:编写mapper文件</strong></p>
|
||
<p> <strong>文章表与文章配置表多表查询</strong></p>
|
||
<p><strong>④:编写业务层代码</strong></p>
|
||
<p><strong>⑤:编写控制器代码</strong></p>
|
||
<p><strong>⑥:swagger测试或前后端联调测试</strong></p>
|
||
<h4 id="4-2-3-功能的关键代码实现"><a href="#4-2-3-功能的关键代码实现" class="headerlink" title="4.2.3 功能的关键代码实现"></a>4.2.3 功能的关键代码实现</h4><p>mapper层的代码</p>
|
||
<p><img src="/pictures/image-20230816142705510.png" alt="image-20230816142705510"></p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="meta"><?xml version=<span class="string">"1.0"</span> encoding=<span class="string">"UTF-8"</span>?></span></span><br><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">mapper</span> <span class="keyword">PUBLIC</span> <span class="string">"-//mybatis.org//DTD Mapper 3.0//EN"</span> <span class="string">"http://mybatis.org/dtd/mybatis-3-mapper.dtd"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">mapper</span> <span class="attr">namespace</span>=<span class="string">"com.heima.article.mapper.ApArticleMapper"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">resultMap</span> <span class="attr">id</span>=<span class="string">"resultMap"</span> <span class="attr">type</span>=<span class="string">"com.heima.model.article.pojos.ApArticle"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">id</span> <span class="attr">column</span>=<span class="string">"id"</span> <span class="attr">property</span>=<span class="string">"id"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"title"</span> <span class="attr">property</span>=<span class="string">"title"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"author_id"</span> <span class="attr">property</span>=<span class="string">"authorId"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"author_name"</span> <span class="attr">property</span>=<span class="string">"authorName"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"channel_id"</span> <span class="attr">property</span>=<span class="string">"channelId"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"channel_name"</span> <span class="attr">property</span>=<span class="string">"channelName"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"layout"</span> <span class="attr">property</span>=<span class="string">"layout"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"flag"</span> <span class="attr">property</span>=<span class="string">"flag"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"images"</span> <span class="attr">property</span>=<span class="string">"images"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"labels"</span> <span class="attr">property</span>=<span class="string">"labels"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"likes"</span> <span class="attr">property</span>=<span class="string">"likes"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"collection"</span> <span class="attr">property</span>=<span class="string">"collection"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"comment"</span> <span class="attr">property</span>=<span class="string">"comment"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"views"</span> <span class="attr">property</span>=<span class="string">"views"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"province_id"</span> <span class="attr">property</span>=<span class="string">"provinceId"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"city_id"</span> <span class="attr">property</span>=<span class="string">"cityId"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"county_id"</span> <span class="attr">property</span>=<span class="string">"countyId"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"created_time"</span> <span class="attr">property</span>=<span class="string">"createdTime"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"publish_time"</span> <span class="attr">property</span>=<span class="string">"publishTime"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"sync_status"</span> <span class="attr">property</span>=<span class="string">"syncStatus"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">result</span> <span class="attr">column</span>=<span class="string">"static_url"</span> <span class="attr">property</span>=<span class="string">"staticUrl"</span>/></span></span><br><span class="line"> <span class="tag"></<span class="name">resultMap</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">select</span> <span class="attr">id</span>=<span class="string">"loadArticleList"</span> <span class="attr">resultMap</span>=<span class="string">"resultMap"</span>></span></span><br><span class="line"> SELECT</span><br><span class="line"> aa.*</span><br><span class="line"> FROM</span><br><span class="line"> `ap_article` aa</span><br><span class="line"> LEFT JOIN ap_article_config aac ON aa.id = aac.article_id</span><br><span class="line"> <span class="tag"><<span class="name">where</span>></span></span><br><span class="line"> and aac.is_delete != 1</span><br><span class="line"> and aac.is_down != 1</span><br><span class="line"> <span class="comment"><!-- loadmore --></span></span><br><span class="line"> <span class="tag"><<span class="name">if</span> <span class="attr">test</span>=<span class="string">"type != null and type == 1"</span>></span></span><br><span class="line"> and aa.publish_time <![CDATA[<]]> #{dto.minBehotTime}</span><br><span class="line"> <span class="tag"></<span class="name">if</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">if</span> <span class="attr">test</span>=<span class="string">"type != null and type == 2"</span>></span></span><br><span class="line"> and aa.publish_time <![CDATA[>]]> #{dto.maxBehotTime}</span><br><span class="line"> <span class="tag"></<span class="name">if</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">if</span> <span class="attr">test</span>=<span class="string">"dto.tag != '__all__'"</span>></span></span><br><span class="line"> and aa.channel_id = #{dto.tag}</span><br><span class="line"> <span class="tag"></<span class="name">if</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">where</span>></span></span><br><span class="line"> order by aa.publish_time desc</span><br><span class="line"> limit #{dto.size}</span><br><span class="line"> <span class="tag"></<span class="name">select</span>></span></span><br><span class="line"><span class="tag"></<span class="name">mapper</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>service层的代码</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.article.service.Impl;</span><br><span class="line"></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.heima.article.mapper.ApArticleMapper;</span><br><span class="line"><span class="keyword">import</span> com.heima.article.service.ApArticleService;</span><br><span class="line"><span class="keyword">import</span> com.heima.common.constants.ArticleConstants;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.article.dtos.ArticleHomeDto;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.article.pojos.ApArticle;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.common.dtos.ResponseResult;</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.apache.commons.lang.StringUtils;</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 class="keyword">import</span> org.springframework.transaction.annotation.Transactional;</span><br><span class="line"></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.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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/15</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">@Service</span></span><br><span class="line"><span class="meta">@Transactional</span></span><br><span class="line"><span class="meta">@Slf4j</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ApArticleServiceImpl</span> <span class="keyword">extends</span> <span class="title class_">ServiceImpl</span><ApArticleMapper, ApArticle> <span class="keyword">implements</span> <span class="title class_">ApArticleService</span> {</span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="keyword">private</span> ApArticleMapper apArticleMapper;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">Integer</span> <span class="variable">MAX_PAGE_SIZE</span> <span class="operator">=</span> <span class="number">50</span>;</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> ResponseResult <span class="title function_">load</span><span class="params">(ArticleHomeDto dto, Short type)</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"> <span class="type">Integer</span> <span class="variable">size</span> <span class="operator">=</span> dto.getSize();</span><br><span class="line"> <span class="keyword">if</span> (size == <span class="literal">null</span> || size == <span class="number">0</span>) {</span><br><span class="line"> size = <span class="number">0</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//最大分页条数的限制</span></span><br><span class="line"> size = Math.min(size, <span class="number">50</span>);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//type参数的校验</span></span><br><span class="line"> <span class="keyword">if</span> (!type.equals(ArticleConstants.LOADTYPE_LOAD_MORE) && !type.equals(ArticleConstants.LOADTYPE_LOAD_NEW)) {</span><br><span class="line"> type = <span class="number">1</span>;</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">if</span> (StringUtils.isBlank(dto.getTag())) {</span><br><span class="line"> dto.setTag(ArticleConstants.DEFAULT_TAG);</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">if</span> (dto.getMinBehotTime() == <span class="literal">null</span>) dto.setMinBehotTime(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"> <span class="keyword">if</span> (dto.getMaxBehotTime() == <span class="literal">null</span>) dto.setMaxBehotTime(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"></span><br><span class="line"> <span class="comment">//2.查询</span></span><br><span class="line"> List<ApArticle> apArticles = apArticleMapper.loadArticleList(dto, type);</span><br><span class="line"> <span class="comment">//3.数据返回</span></span><br><span class="line"> <span class="keyword">return</span> ResponseResult.okResult(apArticles);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>controller层的代码</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.article.controller.v1;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.heima.article.service.ApArticleService;</span><br><span class="line"><span class="keyword">import</span> com.heima.common.constants.ArticleConstants;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.article.dtos.ArticleHomeDto;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.common.dtos.ResponseResult;</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.web.bind.annotation.*;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/15</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">@RestController</span></span><br><span class="line"><span class="meta">@RequestMapping("/api/v1/article")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ArticleHomeController</span> {</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> ApArticleService apArticleService;</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">@PostMapping("/load")</span></span><br><span class="line"> <span class="keyword">public</span> ResponseResult<Object> <span class="title function_">load</span><span class="params">(<span class="meta">@RequestBody</span> ArticleHomeDto articleHomeDto)</span>{</span><br><span class="line"> <span class="keyword">return</span> apArticleService.load(articleHomeDto, ArticleConstants.LOADTYPE_LOAD_MORE);</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="meta">@PostMapping("/loadmore")</span></span><br><span class="line"> <span class="keyword">public</span> ResponseResult<Object> <span class="title function_">loadmore</span><span class="params">(<span class="meta">@RequestBody</span> ArticleHomeDto articleHomeDto)</span>{</span><br><span class="line"> <span class="keyword">return</span> apArticleService.load(articleHomeDto, ArticleConstants.LOADTYPE_LOAD_MORE);</span><br><span class="line"> }</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="meta">@PostMapping("/loadnew")</span></span><br><span class="line"> <span class="keyword">public</span> ResponseResult<Object> <span class="title function_">loadnew</span><span class="params">(<span class="meta">@RequestBody</span> ArticleHomeDto articleHomeDto)</span>{</span><br><span class="line"> <span class="keyword">return</span> apArticleService.load(articleHomeDto, ArticleConstants.LOADTYPE_LOAD_NEW);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>网关中增加文章模块的路由</p>
|
||
<figure class="highlight yaml"><table><tr><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">globalcors:</span></span><br><span class="line"> <span class="attr">add-to-simple-url-handler-mapping:</span> <span class="literal">true</span></span><br><span class="line"> <span class="attr">corsConfigurations:</span></span><br><span class="line"> <span class="string">'[/**]'</span><span class="string">:</span></span><br><span class="line"> <span class="attr">allowedHeaders:</span> <span class="string">"*"</span></span><br><span class="line"> <span class="attr">allowedOrigins:</span> <span class="string">"*"</span></span><br><span class="line"> <span class="attr">allowedMethods:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">GET</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">POST</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">DELETE</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">PUT</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">OPTION</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">user</span></span><br><span class="line"> <span class="attr">uri:</span> <span class="string">lb://leadnews-user</span></span><br><span class="line"> <span class="attr">predicates:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">Path=/user/**</span></span><br><span class="line"> <span class="attr">filters:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">StripPrefix=</span> <span class="number">1</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">article</span></span><br><span class="line"> <span class="attr">uri:</span> <span class="string">lb://leadnews-article</span></span><br><span class="line"> <span class="attr">predicates:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">Path=/article/**</span></span><br><span class="line"> <span class="attr">filters:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">StripPrefix=</span> <span class="number">1</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="5-app端文章详情功能"><a href="#5-app端文章详情功能" class="headerlink" title="5. app端文章详情功能"></a>5. app端文章详情功能</h2><h3 id="5-1-需求分析"><a href="#5-1-需求分析" class="headerlink" title="5.1 需求分析"></a>5.1 需求分析</h3><p><img src="/pictures/image-20230816143201242.png" alt="image-20230816143201242"></p>
|
||
<h3 id="5-2-实现方案-静态模板展示"><a href="#5-2-实现方案-静态模板展示" class="headerlink" title="5.2 实现方案-静态模板展示"></a>5.2 实现方案-静态模板展示</h3><p><img src="/pictures/image-20230816143544351.png" alt="image-20230816143544351"></p>
|
||
<p><strong>静态模板展示关键技术-Freemarker</strong></p>
|
||
<p>Freemarker教程: <a href="https://qingling.icu/posts/29367.html">https://qingling.icu/posts/29367.html</a></p>
|
||
<h3 id="5-3-对象存储服务MinIO"><a href="#5-3-对象存储服务MinIO" class="headerlink" title="5.3 对象存储服务MinIO"></a>5.3 对象存储服务MinIO</h3><p>MinIO 教程: <a href="https://qingling.icu/posts/36397.html">https://qingling.icu/posts/36397.html</a></p>
|
||
<h3 id="5-4-实现思路以及代码实现"><a href="#5-4-实现思路以及代码实现" class="headerlink" title="5.4 实现思路以及代码实现"></a>5.4 实现思路以及代码实现</h3><p><img src="/pictures/image-20230818210507999.png" alt="image-20230818210507999"></p>
|
||
<p><img src="/pictures/image-20230818210638036.png" alt="image-20230818210638036"></p>
|
||
<p><strong>代码实现</strong></p>
|
||
<p>1.在文章模块的pom.xml文件中加入以下的依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependencies</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-freemarker<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.heima<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>heima-file-starter<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>1.0-SNAPSHOT<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependencies</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.在nacos中有关文章模块的配置中添加以下的内容</p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">minio:</span></span><br><span class="line"> <span class="attr">accessKey:</span> <span class="string">minio</span></span><br><span class="line"> <span class="attr">secretKey:</span> <span class="string">minio123</span></span><br><span class="line"> <span class="attr">bucket:</span> <span class="string">leadnews</span></span><br><span class="line"> <span class="attr">endpoint:</span> <span class="string">http://192.168.200.130:9000</span></span><br><span class="line"> <span class="attr">readPath:</span> <span class="string">http://192.168.200.130:9000</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230818211310728.png" alt="image-20230818211310728"></p>
|
||
<p>3.将资料中的article.ftl文件拷贝到文章模块的templates目录下,article.ftl文件内容如下</p>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"utf-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>黑马头条<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"> <span class="comment"><!-- 引入样式文件 --></span></span><br><span class="line"> <span class="tag"><<span class="name">link</span> <span class="attr">rel</span>=<span class="string">"stylesheet"</span> <span class="attr">href</span>=<span class="string">"https://fastly.jsdelivr.net/npm/vant@2.12.20/lib/index.css"</span>></span></span><br><span class="line"> <span class="comment"><!-- 页面样式 --></span></span><br><span class="line"> <span class="tag"><<span class="name">link</span> <span class="attr">rel</span>=<span class="string">"stylesheet"</span> <span class="attr">href</span>=<span class="string">"../../../plugins/css/index.css"</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"><span class="tag"><<span class="name">div</span> <span class="attr">id</span>=<span class="string">"app"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">class</span>=<span class="string">"article"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-row</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"24"</span> <span class="attr">class</span>=<span class="string">"article-title"</span> <span class="attr">v-html</span>=<span class="string">"title"</span>></span><span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-row</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">van-row</span> <span class="attr">type</span>=<span class="string">"flex"</span> <span class="attr">align</span>=<span class="string">"center"</span> <span class="attr">class</span>=<span class="string">"article-header"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"3"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-image</span> <span class="attr">round</span> <span class="attr">class</span>=<span class="string">"article-avatar"</span> <span class="attr">src</span>=<span class="string">"https://p3.pstatp.com/thumb/1480/7186611868"</span>></span><span class="tag"></<span class="name">van-image</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"16"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">v-html</span>=<span class="string">"authorName"</span>></span><span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span>></span>{{ publishTime | timestampToDateTime }}<span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"5"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-button</span> <span class="attr">round</span> <span class="attr">:icon</span>=<span class="string">"relation.isfollow ? '' : 'plus'"</span> <span class="attr">type</span>=<span class="string">"info"</span> <span class="attr">class</span>=<span class="string">"article-focus"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">:text</span>=<span class="string">"relation.isfollow ? '取消关注' : '关注'"</span> <span class="attr">:loading</span>=<span class="string">"followLoading"</span> @<span class="attr">click</span>=<span class="string">"handleClickArticleFollow"</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-button</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-row</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">van-row</span> <span class="attr">class</span>=<span class="string">"article-content"</span>></span></span><br><span class="line"> <#if content??></span><br><span class="line"> <#list content as item></span><br><span class="line"> <#if item.type='text'></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"24"</span> <span class="attr">class</span>=<span class="string">"article-text"</span>></span>${item.value}<span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <#else></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"24"</span> <span class="attr">class</span>=<span class="string">"article-image"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-image</span> <span class="attr">width</span>=<span class="string">"100%"</span> <span class="attr">src</span>=<span class="string">"${item.value}"</span>></span><span class="tag"></<span class="name">van-image</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> </#if></span><br><span class="line"> </#list></span><br><span class="line"> </#if></span><br><span class="line"> <span class="tag"></<span class="name">van-row</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">van-row</span> <span class="attr">type</span>=<span class="string">"flex"</span> <span class="attr">justify</span>=<span class="string">"center"</span> <span class="attr">class</span>=<span class="string">"article-action"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-button</span> <span class="attr">round</span> <span class="attr">:icon</span>=<span class="string">"relation.islike ? 'good-job' : 'good-job-o'"</span> <span class="attr">class</span>=<span class="string">"article-like"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">:loading</span>=<span class="string">"likeLoading"</span> <span class="attr">:text</span>=<span class="string">"relation.islike ? '取消赞' : '点赞'"</span> @<span class="attr">click</span>=<span class="string">"handleClickArticleLike"</span>></span><span class="tag"></<span class="name">van-button</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-button</span> <span class="attr">round</span> <span class="attr">:icon</span>=<span class="string">"relation.isunlike ? 'delete' : 'delete-o'"</span> <span class="attr">class</span>=<span class="string">"article-unlike"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">:loading</span>=<span class="string">"unlikeLoading"</span> @<span class="attr">click</span>=<span class="string">"handleClickArticleUnlike"</span>></span>不喜欢<span class="tag"></<span class="name">van-button</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-row</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- 文章评论列表 --></span></span><br><span class="line"> <span class="tag"><<span class="name">van-list</span> <span class="attr">v-model</span>=<span class="string">"commentsLoading"</span> <span class="attr">:finished</span>=<span class="string">"commentsFinished"</span> <span class="attr">finished-text</span>=<span class="string">"没有更多了"</span></span></span><br><span class="line"><span class="tag"> @<span class="attr">load</span>=<span class="string">"onLoadArticleComments"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-row</span> <span class="attr">id</span>=<span class="string">"#comment-view"</span> <span class="attr">type</span>=<span class="string">"flex"</span> <span class="attr">class</span>=<span class="string">"article-comment"</span> <span class="attr">v-for</span>=<span class="string">"(item, index) in comments"</span> <span class="attr">:key</span>=<span class="string">"index"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"3"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-image</span> <span class="attr">round</span> <span class="attr">src</span>=<span class="string">"https://p3.pstatp.com/thumb/1480/7186611868"</span> <span class="attr">class</span>=<span class="string">"article-avatar"</span>></span><span class="tag"></<span class="name">van-image</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"21"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-row</span> <span class="attr">type</span>=<span class="string">"flex"</span> <span class="attr">align</span>=<span class="string">"center"</span> <span class="attr">justify</span>=<span class="string">"space-between"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">class</span>=<span class="string">"comment-author"</span> <span class="attr">v-html</span>=<span class="string">"item.authorName"</span>></span><span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-button</span> <span class="attr">round</span> <span class="attr">:icon</span>=<span class="string">"item.operation === 0 ? 'good-job' : 'good-job-o'"</span> <span class="attr">size</span>=<span class="string">"normal"</span></span></span><br><span class="line"><span class="tag"> @<span class="attr">click</span>=<span class="string">"handleClickCommentLike(item)"</span>></span>{{ item.likes || '' }}</span><br><span class="line"> <span class="tag"></<span class="name">van-button</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-row</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">van-row</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">class</span>=<span class="string">"comment-content"</span> <span class="attr">v-html</span>=<span class="string">"item.content"</span>></span><span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-row</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-row</span> <span class="attr">type</span>=<span class="string">"flex"</span> <span class="attr">align</span>=<span class="string">"center"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"10"</span> <span class="attr">class</span>=<span class="string">"comment-time"</span>></span></span><br><span class="line"> {{ item.createdTime | timestampToDateTime }}</span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"3"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-button</span> <span class="attr">round</span> <span class="attr">size</span>=<span class="string">"normal"</span> <span class="attr">v-html</span>=<span class="string">"item.reply"</span> @<span class="attr">click</span>=<span class="string">"showCommentRepliesPopup(item.id)"</span>></span>回复 {{</span><br><span class="line"> item.reply || '' }}</span><br><span class="line"> <span class="tag"></<span class="name">van-button</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-row</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-row</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-list</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="comment"><!-- 文章底部栏 --></span></span><br><span class="line"> <span class="tag"><<span class="name">van-row</span> <span class="attr">type</span>=<span class="string">"flex"</span> <span class="attr">justify</span>=<span class="string">"space-around"</span> <span class="attr">align</span>=<span class="string">"center"</span> <span class="attr">class</span>=<span class="string">"article-bottom-bar"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"13"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-field</span> <span class="attr">v-model</span>=<span class="string">"commentValue"</span> <span class="attr">placeholder</span>=<span class="string">"写评论"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">template</span> #<span class="attr">button</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-button</span> <span class="attr">icon</span>=<span class="string">"back-top"</span> @<span class="attr">click</span>=<span class="string">"handleSaveComment"</span>></span><span class="tag"></<span class="name">van-button</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">template</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-field</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"3"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-button</span> <span class="attr">icon</span>=<span class="string">"comment-o"</span> @<span class="attr">click</span>=<span class="string">"handleScrollIntoCommentView"</span>></span><span class="tag"></<span class="name">van-button</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"3"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-button</span> <span class="attr">:icon</span>=<span class="string">"relation.iscollection ? 'star' : 'star-o'"</span> <span class="attr">:loading</span>=<span class="string">"collectionLoading"</span></span></span><br><span class="line"><span class="tag"> @<span class="attr">click</span>=<span class="string">"handleClickArticleCollection"</span>></span><span class="tag"></<span class="name">van-button</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"3"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-button</span> <span class="attr">icon</span>=<span class="string">"share-o"</span>></span><span class="tag"></<span class="name">van-button</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-row</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- 评论Popup 弹出层 --></span></span><br><span class="line"> <span class="tag"><<span class="name">van-popup</span> <span class="attr">v-model</span>=<span class="string">"showPopup"</span> <span class="attr">closeable</span> <span class="attr">position</span>=<span class="string">"bottom"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">:style</span>=<span class="string">"{ width: '750px', height: '60%', left: '50%', 'margin-left': '-375px' }"</span>></span></span><br><span class="line"> <span class="comment"><!-- 评论回复列表 --></span></span><br><span class="line"> <span class="tag"><<span class="name">van-list</span> <span class="attr">v-model</span>=<span class="string">"commentRepliesLoading"</span> <span class="attr">:finished</span>=<span class="string">"commentRepliesFinished"</span> <span class="attr">finished-text</span>=<span class="string">"没有更多了"</span></span></span><br><span class="line"><span class="tag"> @<span class="attr">load</span>=<span class="string">"onLoadCommentReplies"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-row</span> <span class="attr">id</span>=<span class="string">"#comment-reply-view"</span> <span class="attr">type</span>=<span class="string">"flex"</span> <span class="attr">class</span>=<span class="string">"article-comment-reply"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">v-for</span>=<span class="string">"(item, index) in commentReplies"</span> <span class="attr">:key</span>=<span class="string">"index"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"3"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-image</span> <span class="attr">round</span> <span class="attr">src</span>=<span class="string">"https://p3.pstatp.com/thumb/1480/7186611868"</span> <span class="attr">class</span>=<span class="string">"article-avatar"</span>></span><span class="tag"></<span class="name">van-image</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"21"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-row</span> <span class="attr">type</span>=<span class="string">"flex"</span> <span class="attr">align</span>=<span class="string">"center"</span> <span class="attr">justify</span>=<span class="string">"space-between"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">class</span>=<span class="string">"comment-author"</span> <span class="attr">v-html</span>=<span class="string">"item.authorName"</span>></span><span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-button</span> <span class="attr">round</span> <span class="attr">:icon</span>=<span class="string">"item.operation === 0 ? 'good-job' : 'good-job-o'"</span> <span class="attr">size</span>=<span class="string">"normal"</span></span></span><br><span class="line"><span class="tag"> @<span class="attr">click</span>=<span class="string">"handleClickCommentReplyLike(item)"</span>></span>{{ item.likes || '' }}</span><br><span class="line"> <span class="tag"></<span class="name">van-button</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-row</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">van-row</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">class</span>=<span class="string">"comment-content"</span> <span class="attr">v-html</span>=<span class="string">"item.content"</span>></span><span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-row</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-row</span> <span class="attr">type</span>=<span class="string">"flex"</span> <span class="attr">align</span>=<span class="string">"center"</span>></span></span><br><span class="line"> <span class="comment"><!-- <span class="doctag">TODO:</span> js计算时间差 --></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"10"</span> <span class="attr">class</span>=<span class="string">"comment-time"</span>></span></span><br><span class="line"> {{ item.createdTime | timestampToDateTime }}</span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-row</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-row</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-list</span>></span></span><br><span class="line"> <span class="comment"><!-- 评论回复底部栏 --></span></span><br><span class="line"> <span class="tag"><<span class="name">van-row</span> <span class="attr">type</span>=<span class="string">"flex"</span> <span class="attr">justify</span>=<span class="string">"space-around"</span> <span class="attr">align</span>=<span class="string">"center"</span> <span class="attr">class</span>=<span class="string">"comment-reply-bottom-bar"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"13"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-field</span> <span class="attr">v-model</span>=<span class="string">"commentReplyValue"</span> <span class="attr">placeholder</span>=<span class="string">"写评论"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">template</span> #<span class="attr">button</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-button</span> <span class="attr">icon</span>=<span class="string">"back-top"</span> @<span class="attr">click</span>=<span class="string">"handleSaveCommentReply"</span>></span><span class="tag"></<span class="name">van-button</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">template</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-field</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"3"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-button</span> <span class="attr">icon</span>=<span class="string">"comment-o"</span>></span><span class="tag"></<span class="name">van-button</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"3"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-button</span> <span class="attr">icon</span>=<span class="string">"star-o"</span>></span><span class="tag"></<span class="name">van-button</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-col</span> <span class="attr">span</span>=<span class="string">"3"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">van-button</span> <span class="attr">icon</span>=<span class="string">"share-o"</span>></span><span class="tag"></<span class="name">van-button</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-col</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-row</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">van-popup</span>></span></span><br><span class="line"><span class="tag"></<span class="name">div</span>></span></span><br><span class="line"></span><br><span class="line"><span class="comment"><!-- 引入 Vue 和 Vant 的 JS 文件 --></span></span><br><span class="line"><span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">" https://fastly.jsdelivr.net/npm/vue/dist/vue.min.js"</span>></span></span><br><span class="line"><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"https://fastly.jsdelivr.net/npm/vant@2.12.20/lib/vant.min.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="comment"><!-- 引入 Axios 的 JS 文件 --></span></span><br><span class="line"><#--<span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"https://unpkg.com/axios/dist/axios.min.js"</span>></span><span class="tag"></<span class="name">script</span>></span>--></span><br><span class="line"><span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"../../../plugins/js/axios.min.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="comment"><!-- 页面逻辑 --></span></span><br><span class="line"><span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"../../../plugins/js/index.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>4.手动上传资料中index.js和index.css两个文件到MinIO中</p>
|
||
<p>上传index.js</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Test</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">testMinIO</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">//读取一个文件</span></span><br><span class="line"> <span class="type">FileInputStream</span> <span class="variable">inputStream</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">FileInputStream</span>(<span class="string">"C:\\Gong\\java\\黑马头条\\day02-app端文章查看,静态化freemarker,分布式文件系统minIO\\资料\\模板文件\\plugins\\js\\index.js"</span>);</span><br><span class="line"> <span class="comment">//1.获取MinIO的连接信息,创建一个minio的客户端</span></span><br><span class="line"> <span class="type">MinioClient</span> <span class="variable">minioClient</span> <span class="operator">=</span> MinioClient.builder()</span><br><span class="line"> .credentials(<span class="string">"minio"</span>, <span class="string">"minio123"</span>)<span class="comment">//minio的账号密码</span></span><br><span class="line"> .endpoint(<span class="string">"http://192.168.200.130:9000"</span>)<span class="comment">//minio的地址</span></span><br><span class="line"> .build();</span><br><span class="line"> <span class="comment">//2.上传</span></span><br><span class="line"> <span class="type">PutObjectArgs</span> <span class="variable">putObjectArgs</span> <span class="operator">=</span> PutObjectArgs.builder()</span><br><span class="line"> .object(<span class="string">"plugins/js/index.js"</span>)<span class="comment">//文件的名称</span></span><br><span class="line"> .contentType(<span class="string">"text/js"</span>)<span class="comment">//文件的类型</span></span><br><span class="line"> .bucket(<span class="string">"leadnews"</span>)<span class="comment">//桶的名称,与之前的minio管理界面创建的bucket名称一致即可</span></span><br><span class="line"> .stream(inputStream,inputStream.available(),-<span class="number">1</span>)</span><br><span class="line"> .build();</span><br><span class="line"> minioClient.putObject(putObjectArgs);</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>上传index.css</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Test</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">testMinIO</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">//读取一个文件</span></span><br><span class="line"> <span class="type">FileInputStream</span> <span class="variable">inputStream</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">FileInputStream</span>(<span class="string">"C:\\Gong\\java\\黑马头条\\day02-app端文章查看,静态化freemarker,分布式文件系统minIO\\资料\\模板文件\\plugins\\css\\index.css"</span>);</span><br><span class="line"> <span class="comment">//1.获取MinIO的连接信息,创建一个minio的客户端</span></span><br><span class="line"> <span class="type">MinioClient</span> <span class="variable">minioClient</span> <span class="operator">=</span> MinioClient.builder()</span><br><span class="line"> .credentials(<span class="string">"minio"</span>, <span class="string">"minio123"</span>)<span class="comment">//minio的账号密码</span></span><br><span class="line"> .endpoint(<span class="string">"http://192.168.200.130:9000"</span>)<span class="comment">//minio的地址</span></span><br><span class="line"> .build();</span><br><span class="line"> <span class="comment">//2.上传</span></span><br><span class="line"> <span class="type">PutObjectArgs</span> <span class="variable">putObjectArgs</span> <span class="operator">=</span> PutObjectArgs.builder()</span><br><span class="line"> .object(<span class="string">"plugins/css/index.css"</span>)<span class="comment">//文件的名称</span></span><br><span class="line"> .contentType(<span class="string">"text/css"</span>)<span class="comment">//文件的类型</span></span><br><span class="line"> .bucket(<span class="string">"leadnews"</span>)<span class="comment">//桶的名称,与之前的minio管理界面创建的bucket名称一致即可</span></span><br><span class="line"> .stream(inputStream,inputStream.available(),-<span class="number">1</span>)</span><br><span class="line"> .build();</span><br><span class="line"> minioClient.putObject(putObjectArgs);</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>5.测试根据文章的内容生成html文件上传到minio中</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.article.test;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.alibaba.fastjson.JSONArray;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;</span><br><span class="line"><span class="keyword">import</span> com.heima.article.ArticleApplication;</span><br><span class="line"><span class="keyword">import</span> com.heima.article.mapper.ApArticleContentMapper;</span><br><span class="line"><span class="keyword">import</span> com.heima.article.service.ApArticleService;</span><br><span class="line"><span class="keyword">import</span> com.heima.file.service.FileStorageService;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.article.pojos.ApArticle;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.article.pojos.ApArticleContent;</span><br><span class="line"><span class="keyword">import</span> freemarker.template.Configuration;</span><br><span class="line"><span class="keyword">import</span> freemarker.template.Template;</span><br><span class="line"><span class="keyword">import</span> freemarker.template.TemplateException;</span><br><span class="line"><span class="keyword">import</span> org.apache.commons.lang.StringUtils;</span><br><span class="line"><span class="keyword">import</span> org.junit.Test;</span><br><span class="line"><span class="keyword">import</span> org.junit.runner.RunWith;</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.boot.test.context.SpringBootTest;</span><br><span class="line"><span class="keyword">import</span> org.springframework.test.context.junit4.SpringRunner;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.ByteArrayInputStream;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.io.InputStream;</span><br><span class="line"><span class="keyword">import</span> java.io.StringWriter;</span><br><span class="line"><span class="keyword">import</span> java.util.HashMap;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/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">@SpringBootTest(classes = ArticleApplication.class)</span></span><br><span class="line"><span class="meta">@RunWith(SpringRunner.class)</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ArticleFreeMarkerTest</span> {</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> ApArticleContentMapper apArticleContentMapper;</span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="keyword">private</span> Configuration configuration;</span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="keyword">private</span> FileStorageService fileStorageService;</span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="keyword">private</span> ApArticleService apArticleService;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">createStaticUrlTest</span><span class="params">()</span> <span class="keyword">throws</span> IOException, TemplateException {</span><br><span class="line"> <span class="comment">//已知文章的id</span></span><br><span class="line"> <span class="comment">//1.获取文章的内容</span></span><br><span class="line"> <span class="type">ApArticleContent</span> <span class="variable">apArticleContent</span> <span class="operator">=</span> apArticleContentMapper.selectOne(<span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><ApArticleContent>().eq(ApArticleContent::getArticleId, <span class="string">"1383827995813531650L"</span>));</span><br><span class="line"> <span class="keyword">if</span> (apArticleContent != <span class="literal">null</span> && StringUtils.isNotBlank(apArticleContent.getContent())) {</span><br><span class="line"> <span class="comment">//2.文章内容通过freemarker生成html文件 详细教程见:https://qingling.icu/posts/29367.html</span></span><br><span class="line"> <span class="type">Template</span> <span class="variable">template</span> <span class="operator">=</span> configuration.getTemplate(<span class="string">"article.ftl"</span>);</span><br><span class="line"> <span class="comment">//构建数据模型</span></span><br><span class="line"> HashMap<String, Object> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> map.put(<span class="string">"content"</span>, JSONArray.parseArray(apArticleContent.getContent()));</span><br><span class="line"> <span class="comment">//输出流</span></span><br><span class="line"> <span class="type">StringWriter</span> <span class="variable">out</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">StringWriter</span>();</span><br><span class="line"> <span class="comment">//合成html文件</span></span><br><span class="line"> template.process(map, out);</span><br><span class="line"> <span class="comment">//3.把html文件上传到minio中</span></span><br><span class="line"> <span class="comment">//构建一个输入流</span></span><br><span class="line"> <span class="type">InputStream</span> <span class="variable">in</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ByteArrayInputStream</span>(out.toString().getBytes());</span><br><span class="line"> <span class="comment">//上传到minio并返回访问的路径</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">path</span> <span class="operator">=</span> fileStorageService.uploadHtmlFile(<span class="string">""</span>, apArticleContent.getArticleId() + <span class="string">".html"</span>, in);</span><br><span class="line"> System.out.println(<span class="string">"文件在minio中的路径:"</span>+path);</span><br><span class="line"> <span class="comment">//4.修改ap_article表,保存static_url字段</span></span><br><span class="line"> <span class="type">ApArticle</span> <span class="variable">apArticle</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ApArticle</span>();</span><br><span class="line"> apArticle.setId(apArticleContent.getArticleId());</span><br><span class="line"> apArticle.setStaticUrl(path);</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isSuccess</span> <span class="operator">=</span> apArticleService.updateById(apArticle);</span><br><span class="line"> System.out.println(isSuccess ? <span class="string">"文件上传成功"</span> : <span class="string">"文件上传失败"</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>6.实现效果</p>
|
||
<p><img src="/pictures/image-20230819153507360.png" alt="image-20230819153507360"></p>
|
||
<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></p>
|
||
<p><img src="/pictures/image-20230819155333131.png" alt="image-20230819155333131"></p>
|
||
<p><strong>搭建步骤</strong></p>
|
||
<p><img src="/pictures/image-20230819155229550.png" alt="image-20230819155229550"></p>
|
||
<p>1.创建自媒体模块的数据库</p>
|
||
<p><img src="/pictures/image-20230819155853252.png" alt="image-20230819155853252"></p>
|
||
<p>2.导入相应的工程文件</p>
|
||
<p><img src="/pictures/image-20230819161650118.png" alt="image-20230819161650118"></p>
|
||
<p>3.配置自媒体模块和网关模块在nacos中的配置</p>
|
||
<p>自媒体模块的配置</p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><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">driver-class-name:</span> <span class="string">com.mysql.jdbc.Driver</span></span><br><span class="line"> <span class="attr">url:</span> <span class="string">jdbc:mysql://localhost:3306/leadnews_wemedia?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC</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"># 设置Mapper接口所对应的XML文件位置,如果你在Mapper接口中有自定义方法,需要进行该配置</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><br><span class="line"> <span class="comment"># 设置别名包扫描路径,通过该属性可以给包中的类注册别名</span></span><br><span class="line"> <span class="attr">type-aliases-package:</span> <span class="string">com.heima.model.media.pojos</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230819161148830.png" alt="image-20230819161148830"></p>
|
||
<p>网关模块的配置</p>
|
||
<figure class="highlight yaml"><table><tr><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">globalcors:</span></span><br><span class="line"> <span class="attr">cors-configurations:</span></span><br><span class="line"> <span class="string">'[/**]'</span><span class="string">:</span> <span class="comment"># 匹配所有请求</span></span><br><span class="line"> <span class="attr">allowedOrigins:</span> <span class="string">"*"</span> <span class="comment">#跨域处理 允许所有的域</span></span><br><span class="line"> <span class="attr">allowedMethods:</span> <span class="comment"># 支持的方法</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">GET</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">POST</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">PUT</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">DELETE</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">wemedia</span></span><br><span class="line"> <span class="attr">uri:</span> <span class="string">lb://leadnews-wemedia</span></span><br><span class="line"> <span class="attr">predicates:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">Path=/wemedia/**</span></span><br><span class="line"> <span class="attr">filters:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">StripPrefix=</span> <span class="number">1</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230819161529210.png" alt="image-20230819161529210"></p>
|
||
<h2 id="2-前端环境搭建"><a href="#2-前端环境搭建" class="headerlink" title="2.前端环境搭建"></a>2.前端环境搭建</h2><p><strong>搭建思路</strong></p>
|
||
<p><img src="/pictures/image-20230819162116240.png" alt="image-20230819162116240"></p>
|
||
<p><strong>搭建步骤</strong></p>
|
||
<p><img src="/pictures/image-20230819162230133.png" alt="image-20230819162230133"></p>
|
||
<p><strong>heima-leadnews-wemedia配置文件</strong></p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">upstream heima-wemedia-gateway{</span><br><span class="line"> #APP端网关所在的端口</span><br><span class="line"> server localhost:51602;</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line">server {</span><br><span class="line"> listen 8802;</span><br><span class="line"> location / {</span><br><span class="line"> root C:/Gong/data/wemedia-web/;</span><br><span class="line"> index index.html;</span><br><span class="line"> }</span><br><span class="line"> </span><br><span class="line"> location ~/wemedia/MEDIA/(.*) {</span><br><span class="line"> proxy_pass http://heima-wemedia-gateway/$1;</span><br><span class="line"> proxy_set_header HOST $host; # 不改变源请求头的值</span><br><span class="line"> proxy_pass_request_body on; #开启获取请求体</span><br><span class="line"> proxy_pass_request_headers on; #开启获取请求头</span><br><span class="line"> proxy_set_header X-Real-IP $remote_addr; # 记录真实发出请求的客户端IP</span><br><span class="line"> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #记录代理信息</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>重启nginx访问</strong></p>
|
||
<p><img src="/pictures/image-20230902145814017.png" alt="image-20230902145814017"></p>
|
||
<h2 id="3-自媒体素材管理功能"><a href="#3-自媒体素材管理功能" class="headerlink" title="3.自媒体素材管理功能"></a>3.自媒体素材管理功能</h2><h3 id="3-1-素材管理-图片上传"><a href="#3-1-素材管理-图片上传" class="headerlink" title="3.1 素材管理-图片上传"></a>3.1 素材管理-图片上传</h3><p><strong>图片素材相关的实体类</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.model.wemedia.pojos;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.IdType;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.TableField;</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 class="keyword">import</span> lombok.Data;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.Serializable;</span><br><span class="line"><span class="keyword">import</span> java.util.Date;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <p></span></span><br><span class="line"><span class="comment"> * 自媒体图文素材信息表</span></span><br><span class="line"><span class="comment"> * </p></span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> itheima</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("wm_material")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WmMaterial</span> <span class="keyword">implements</span> <span class="title class_">Serializable</span> {</span><br><span class="line"></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"> * 主键</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@TableId(value = "id", type = IdType.AUTO)</span></span><br><span class="line"> <span class="keyword">private</span> Integer id;</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">@TableField("user_id")</span></span><br><span class="line"> <span class="keyword">private</span> Integer userId;</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">@TableField("url")</span></span><br><span class="line"> <span class="keyword">private</span> String url;</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"> 0 图片</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"> <span class="meta">@TableField("type")</span></span><br><span class="line"> <span class="keyword">private</span> Short type;</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">@TableField("is_collection")</span></span><br><span class="line"> <span class="keyword">private</span> Short isCollection;</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">@TableField("created_time")</span></span><br><span class="line"> <span class="keyword">private</span> Date createdTime;</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-1-1-解决图片素材实体类中获取图片userId的问题"><a href="#3-1-1-解决图片素材实体类中获取图片userId的问题" class="headerlink" title="3.1.1 解决图片素材实体类中获取图片userId的问题"></a>3.1.1 解决图片素材实体类中获取图片userId的问题</h4><p><strong>实现思路</strong></p>
|
||
<p><img src="/pictures/image-20230902154806019.png" alt="image-20230902154806019"></p>
|
||
<p>1.token解析为用户存入header</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.wemedia.gateway.filter;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.gateway.util.AppJwtUtil;</span><br><span class="line"><span class="keyword">import</span> io.jsonwebtoken.Claims;</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.apache.commons.lang.StringUtils;</span><br><span class="line"><span class="keyword">import</span> org.springframework.cloud.gateway.filter.GatewayFilterChain;</span><br><span class="line"><span class="keyword">import</span> org.springframework.cloud.gateway.filter.GlobalFilter;</span><br><span class="line"><span class="keyword">import</span> org.springframework.core.Ordered;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.HttpStatus;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.server.reactive.ServerHttpRequest;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.server.reactive.ServerHttpResponse;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Component;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.server.ServerWebExchange;</span><br><span class="line"><span class="keyword">import</span> reactor.core.publisher.Mono;</span><br><span class="line"></span><br><span class="line"><span class="meta">@Component</span></span><br><span class="line"><span class="meta">@Slf4j</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">AuthorizeFilter</span> <span class="keyword">implements</span> <span class="title class_">Ordered</span>, GlobalFilter {</span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> Mono<Void> <span class="title function_">filter</span><span class="params">(ServerWebExchange exchange, GatewayFilterChain chain)</span> {</span><br><span class="line"> <span class="comment">//1.获取request和response对象</span></span><br><span class="line"> <span class="type">ServerHttpRequest</span> <span class="variable">request</span> <span class="operator">=</span> exchange.getRequest();</span><br><span class="line"> <span class="type">ServerHttpResponse</span> <span class="variable">response</span> <span class="operator">=</span> exchange.getResponse();</span><br><span class="line"></span><br><span class="line"> <span class="comment">//2.判断是否是登录</span></span><br><span class="line"> <span class="keyword">if</span>(request.getURI().getPath().contains(<span class="string">"/login"</span>)){</span><br><span class="line"> <span class="comment">//放行</span></span><br><span class="line"> <span class="keyword">return</span> chain.filter(exchange);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//3.获取token</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">token</span> <span class="operator">=</span> request.getHeaders().getFirst(<span class="string">"token"</span>);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//4.判断token是否存在</span></span><br><span class="line"> <span class="keyword">if</span>(StringUtils.isBlank(token)){</span><br><span class="line"> response.setStatusCode(HttpStatus.UNAUTHORIZED);</span><br><span class="line"> <span class="keyword">return</span> response.setComplete();</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//5.判断token是否有效</span></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">Claims</span> <span class="variable">claimsBody</span> <span class="operator">=</span> AppJwtUtil.getClaimsBody(token);</span><br><span class="line"> <span class="comment">//是否是过期</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">result</span> <span class="operator">=</span> AppJwtUtil.verifyToken(claimsBody);</span><br><span class="line"> <span class="keyword">if</span>(result == <span class="number">1</span> || result == <span class="number">2</span>){</span><br><span class="line"> response.setStatusCode(HttpStatus.UNAUTHORIZED);</span><br><span class="line"> <span class="keyword">return</span> response.setComplete();</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//获取用户信息</span></span><br><span class="line"> <span class="type">Object</span> <span class="variable">userId</span> <span class="operator">=</span> claimsBody.get(<span class="string">"id"</span>);</span><br><span class="line"> <span class="comment">//存入header中</span></span><br><span class="line"> <span class="type">ServerHttpRequest</span> <span class="variable">serverHttpRequest</span> <span class="operator">=</span> request.mutate().headers(httpHeaders -> {</span><br><span class="line"> httpHeaders.add(<span class="string">"userId"</span>, userId + <span class="string">""</span>);</span><br><span class="line"> }).build();</span><br><span class="line"> <span class="comment">//重置请求</span></span><br><span class="line"> exchange.mutate().request(serverHttpRequest);</span><br><span class="line"></span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//6.放行</span></span><br><span class="line"> <span class="keyword">return</span> chain.filter(exchange);</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 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> <span class="type">int</span> <span class="title function_">getOrder</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.创建拦截器</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.wemedia.interceptor;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.heima.model.wemedia.pojos.WmUser;</span><br><span class="line"><span class="keyword">import</span> com.heima.utils.thread.WmThreadLocalUtil;</span><br><span class="line"><span class="keyword">import</span> io.swagger.models.auth.In;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.servlet.HandlerInterceptor;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.servlet.ModelAndView;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletRequest;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletResponse;</span><br><span class="line"><span class="keyword">import</span> java.util.Enumeration;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/9/2</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">class</span> <span class="title class_">WmTokenInterceptor</span> <span class="keyword">implements</span> <span class="title class_">HandlerInterceptor</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 获取header中的信息 存入当前的线程中</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="type">boolean</span> <span class="title function_">preHandle</span><span class="params">(HttpServletRequest request, HttpServletResponse response, Object handler)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> <span class="comment">//获取header中的userId信息</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">userId</span> <span class="operator">=</span> request.getHeader(<span class="string">"userId"</span>);</span><br><span class="line"> <span class="comment">//判断userId是否为空</span></span><br><span class="line"> <span class="keyword">if</span>(userId != <span class="literal">null</span>){</span><br><span class="line"> <span class="comment">//将userId存入当前的线程中,我们可以在任何位置获取</span></span><br><span class="line"> <span class="type">WmUser</span> <span class="variable">wmUser</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">WmUser</span>();</span><br><span class="line"> wmUser.setId(Integer.valueOf(userId));</span><br><span class="line"> WmThreadLocalUtil.setUser(wmUser);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line"> }</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="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">postHandle</span><span class="params">(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> WmThreadLocalUtil.clear();</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>ThreadLocal工具类,实现在线程中存储、获取、清理用户信息</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.utils.thread;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.heima.model.wemedia.pojos.WmUser;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WmThreadLocalUtil</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">final</span> <span class="keyword">static</span> ThreadLocal<WmUser> WM_USER_THREAD_LOCAL = <span class="keyword">new</span> <span class="title class_">ThreadLocal</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 class="doctag">@param</span> wmUser</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">setUser</span><span class="params">(WmUser wmUser)</span>{</span><br><span class="line"> WM_USER_THREAD_LOCAL.set(wmUser);</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">public</span> <span class="keyword">static</span> WmUser <span class="title function_">getUser</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> WM_USER_THREAD_LOCAL.get();</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">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">clear</span><span class="params">()</span>{</span><br><span class="line"> WM_USER_THREAD_LOCAL.remove();</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3.让拦截器生效</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.wemedia.config;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.interceptor.WmTokenInterceptor;</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.InterceptorRegistry;</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="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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/9/2</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_">WebMvcConfig</span> <span class="keyword">implements</span> <span class="title class_">WebMvcConfigurer</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_">addInterceptors</span><span class="params">(InterceptorRegistry registry)</span> {</span><br><span class="line"> registry.addInterceptor(<span class="keyword">new</span> <span class="title class_">WmTokenInterceptor</span>()).addPathPatterns(<span class="string">"/**"</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-1-2-图片上传接口的定义"><a href="#3-1-2-图片上传接口的定义" class="headerlink" title="3.1.2 图片上传接口的定义"></a>3.1.2 图片上传接口的定义</h4><table>
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th><strong>说明</strong></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>接口路径</td>
|
||
<td>/api/v1/material/upload_picture</td>
|
||
</tr>
|
||
<tr>
|
||
<td>请求方式</td>
|
||
<td>POST</td>
|
||
</tr>
|
||
<tr>
|
||
<td>参数</td>
|
||
<td>MultipartFile</td>
|
||
</tr>
|
||
<tr>
|
||
<td>响应结果</td>
|
||
<td>ResponseResult</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<h4 id="3-1-3-代码实现"><a href="#3-1-3-代码实现" class="headerlink" title="3.1.3 代码实现"></a>3.1.3 代码实现</h4><p>1.在pom.xml中引入自定义minio的starter依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.heima<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>heima-file-starter<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>1.0-SNAPSHOT<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.在项目中添加minio的配置(在nacos中配置)</p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">minio:</span></span><br><span class="line"> <span class="attr">accessKey:</span> <span class="string">minio</span></span><br><span class="line"> <span class="attr">secretKey:</span> <span class="string">minio123</span></span><br><span class="line"> <span class="attr">bucket:</span> <span class="string">leadnews</span></span><br><span class="line"> <span class="attr">endpoint:</span> <span class="string">http://192.168.200.130:9000</span></span><br><span class="line"> <span class="attr">readPath:</span> <span class="string">http://192.168.200.130:9000</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3.上传图片的关键代码</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.wemedia.service.impl;</span><br><span class="line"></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.heima.file.service.FileStorageService;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.common.dtos.ResponseResult;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.common.enums.AppHttpCodeEnum;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.wemedia.pojos.WmMaterial;</span><br><span class="line"><span class="keyword">import</span> com.heima.utils.thread.WmThreadLocalUtil;</span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.mapper.WmMaterialMapper;</span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.service.WmMaterialService;</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.beans.factory.annotation.Autowired;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Service;</span><br><span class="line"><span class="keyword">import</span> org.springframework.transaction.annotation.Transactional;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.multipart.MultipartFile;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</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.UUID;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="meta">@Slf4j</span></span><br><span class="line"><span class="meta">@Service</span></span><br><span class="line"><span class="meta">@Transactional</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WmMaterialServiceImpl</span> <span class="keyword">extends</span> <span class="title class_">ServiceImpl</span><WmMaterialMapper, WmMaterial> <span class="keyword">implements</span> <span class="title class_">WmMaterialService</span> {</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> FileStorageService fileStorageService; <span class="comment">//使用minio</span></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> ResponseResult <span class="title function_">uploadPicture</span><span class="params">(MultipartFile multipartFile)</span> {</span><br><span class="line"> <span class="comment">//1.检查参数</span></span><br><span class="line"> <span class="keyword">if</span>(multipartFile == <span class="literal">null</span> || multipartFile.getSize() == <span class="number">0</span>){</span><br><span class="line"> <span class="keyword">return</span> ResponseResult.errorResult(AppHttpCodeEnum.PARAM_INVALID);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//2.上传图片到minio中</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">fileName</span> <span class="operator">=</span> UUID.randomUUID().toString().replace(<span class="string">"-"</span>, <span class="string">""</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">originalFilename</span> <span class="operator">=</span> multipartFile.getOriginalFilename();</span><br><span class="line"> <span class="type">String</span> <span class="variable">postfix</span> <span class="operator">=</span> originalFilename.substring(originalFilename.lastIndexOf(<span class="string">"."</span>));</span><br><span class="line"> <span class="type">String</span> <span class="variable">fileId</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> fileId = fileStorageService.uploadImgFile(<span class="string">""</span>, fileName + postfix, multipartFile.getInputStream());</span><br><span class="line"> log.info(<span class="string">"上传图片到Minio中,fileId:{}"</span>,fileId);</span><br><span class="line"> } <span class="keyword">catch</span> (IOException e) {</span><br><span class="line"> log.info(<span class="string">"WmMaterialServiceImpl-上传图片失败"</span>);</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//3.将图片的信息保存在数据库中</span></span><br><span class="line"> <span class="type">WmMaterial</span> <span class="variable">wmMaterial</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">WmMaterial</span>();</span><br><span class="line"> wmMaterial.setUserId(WmThreadLocalUtil.getUser().getId());</span><br><span class="line"> wmMaterial.setUrl(fileId);</span><br><span class="line"> wmMaterial.setType((<span class="type">short</span>)<span class="number">0</span>);</span><br><span class="line"> wmMaterial.setIsCollection((<span class="type">short</span>)<span class="number">0</span>);</span><br><span class="line"> wmMaterial.setCreatedTime(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"> save(wmMaterial);</span><br><span class="line"> <span class="comment">//4.返回参数</span></span><br><span class="line"> <span class="keyword">return</span> ResponseResult.okResult(wmMaterial);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>4.测试上传功能</p>
|
||
<p><img src="/pictures/image-20230902220022201.png" alt="image-20230902220022201"></p>
|
||
<h3 id="3-2-素材管理-图片列表"><a href="#3-2-素材管理-图片列表" class="headerlink" title="3.2 素材管理-图片列表"></a>3.2 素材管理-图片列表</h3><p><strong>接口定义</strong></p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th><strong>接口路径</strong></th>
|
||
<th><strong>/api</strong>/<strong>/v1/material/list</strong></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>请求方式</td>
|
||
<td>POST</td>
|
||
</tr>
|
||
<tr>
|
||
<td>参数</td>
|
||
<td>WmMaterialDto</td>
|
||
</tr>
|
||
<tr>
|
||
<td>响应结果</td>
|
||
<td>ResponseResult</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<p><strong>请求参数的DTO</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><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_">WmMaterialDto</span> <span class="keyword">extends</span> <span class="title class_">PageRequestDto</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 1 收藏</span></span><br><span class="line"><span class="comment"> * 0 未收藏</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> Short isCollection;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>关键代码</strong></p>
|
||
<figure class="highlight java"><table><tr><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> ResponseResult <span class="title function_">findList</span><span class="params">(WmMaterialDto wmMaterialDto)</span> {</span><br><span class="line"> <span class="comment">//1.检查参数</span></span><br><span class="line"> wmMaterialDto.checkParam();</span><br><span class="line"> <span class="comment">//2.分页查询</span></span><br><span class="line"> <span class="type">IPage</span> <span class="variable">page</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Page</span>(wmMaterialDto.getPage(),wmMaterialDto.getSize());</span><br><span class="line"> LambdaQueryWrapper<WmMaterial> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><>();</span><br><span class="line"> <span class="comment">//是否收藏</span></span><br><span class="line"> <span class="keyword">if</span>(wmMaterialDto.getIsCollection() != <span class="literal">null</span> && wmMaterialDto.getIsCollection() == <span class="number">1</span>){</span><br><span class="line"> queryWrapper.eq(WmMaterial::getIsCollection,wmMaterialDto.getIsCollection());</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//按照用户查询</span></span><br><span class="line"> queryWrapper.eq(WmMaterial::getUserId,WmThreadLocalUtil.getUser().getId());</span><br><span class="line"> <span class="comment">//按照时间查询</span></span><br><span class="line"> queryWrapper.orderByDesc(WmMaterial::getCreatedTime);</span><br><span class="line"> page = page(page,queryWrapper);</span><br><span class="line"> <span class="comment">//3.结果返回</span></span><br><span class="line"> <span class="type">ResponseResult</span> <span class="variable">responseResult</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">PageResponseResult</span>(wmMaterialDto.getPage(), wmMaterialDto.getSize(), (<span class="type">int</span>) page.getTotal());</span><br><span class="line"> responseResult.setData(page.getRecords());</span><br><span class="line"> <span class="keyword">return</span> responseResult;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>MP的配置</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Bean</span></span><br><span class="line"><span class="keyword">public</span> MybatisPlusInterceptor <span class="title function_">mybatisPlusInterceptor</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">MybatisPlusInterceptor</span> <span class="variable">interceptor</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">MybatisPlusInterceptor</span>();</span><br><span class="line"> interceptor.addInnerInterceptor(<span class="keyword">new</span> <span class="title class_">PaginationInnerInterceptor</span>(DbType.MYSQL));</span><br><span class="line"> <span class="keyword">return</span> interceptor;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>实现效果</strong></p>
|
||
<p><img src="/pictures/image-20230903125528872.png" alt="image-20230903125528872"></p>
|
||
<h2 id="4-自媒体文章管理功能"><a href="#4-自媒体文章管理功能" class="headerlink" title="4.自媒体文章管理功能"></a>4.自媒体文章管理功能</h2><h3 id="4-1-频道列表查询"><a href="#4-1-频道列表查询" class="headerlink" title="4.1 频道列表查询"></a>4.1 频道列表查询</h3><p><strong>频道对应的实体类</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.model.wemedia.pojos;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.IdType;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.TableField;</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 class="keyword">import</span> lombok.Data;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.Serializable;</span><br><span class="line"><span class="keyword">import</span> java.util.Date;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <p></span></span><br><span class="line"><span class="comment"> * 频道信息表</span></span><br><span class="line"><span class="comment"> * </p></span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> itheima</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("wm_channel")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WmChannel</span> <span class="keyword">implements</span> <span class="title class_">Serializable</span> {</span><br><span class="line"></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="meta">@TableId(value = "id", type = IdType.AUTO)</span></span><br><span class="line"> <span class="keyword">private</span> Integer id;</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">@TableField("name")</span></span><br><span class="line"> <span class="keyword">private</span> String name;</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">@TableField("description")</span></span><br><span class="line"> <span class="keyword">private</span> String description;</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"> * 1:默认 true</span></span><br><span class="line"><span class="comment"> * 0:非默认 false</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@TableField("is_default")</span></span><br><span class="line"> <span class="keyword">private</span> Boolean isDefault;</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"> * 1:启用 true</span></span><br><span class="line"><span class="comment"> * 0:禁用 false</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@TableField("status")</span></span><br><span class="line"> <span class="keyword">private</span> Boolean status;</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">@TableField("ord")</span></span><br><span class="line"> <span class="keyword">private</span> Integer ord;</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">@TableField("created_time")</span></span><br><span class="line"> <span class="keyword">private</span> Date createdTime;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>接口定义</strong></p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th><strong>说明</strong></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>接口路径</td>
|
||
<td>/api/v1/channel/channels</td>
|
||
</tr>
|
||
<tr>
|
||
<td>请求方式</td>
|
||
<td>GET</td>
|
||
</tr>
|
||
<tr>
|
||
<td>参数</td>
|
||
<td>无</td>
|
||
</tr>
|
||
<tr>
|
||
<td>响应结果</td>
|
||
<td>ResponseResult</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<p><strong>关键代码</strong></p>
|
||
<figure class="highlight java"><table><tr><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("/channels")</span></span><br><span class="line"><span class="keyword">public</span> ResponseResult <span class="title function_">findAllChannels</span><span class="params">()</span>{</span><br><span class="line"> List<WmChannel> channels = wmChannelService.list();</span><br><span class="line"> <span class="keyword">return</span> ResponseResult.okResult(channels);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>实现效果</strong></p>
|
||
<p><img src="/pictures/image-20230903151216766.png" alt="image-20230903151216766"></p>
|
||
<h3 id="4-2-文章列表加载"><a href="#4-2-文章列表加载" class="headerlink" title="4.2 文章列表加载"></a>4.2 文章列表加载</h3><p><strong>文章表对应的实体类</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.model.wemedia.pojos;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.IdType;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.TableField;</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 class="keyword">import</span> lombok.Data;</span><br><span class="line"><span class="keyword">import</span> org.apache.ibatis.type.Alias;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.Serializable;</span><br><span class="line"><span class="keyword">import</span> java.util.Date;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <p></span></span><br><span class="line"><span class="comment"> * 自媒体图文内容信息表</span></span><br><span class="line"><span class="comment"> * </p></span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> itheima</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("wm_news")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WmNews</span> <span class="keyword">implements</span> <span class="title class_">Serializable</span> {</span><br><span class="line"></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"> * 主键</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@TableId(value = "id", type = IdType.AUTO)</span></span><br><span class="line"> <span class="keyword">private</span> Integer id;</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">@TableField("user_id")</span></span><br><span class="line"> <span class="keyword">private</span> Integer userId;</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">@TableField("title")</span></span><br><span class="line"> <span class="keyword">private</span> String title;</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">@TableField("content")</span></span><br><span class="line"> <span class="keyword">private</span> String content;</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"> 0 无图文章</span></span><br><span class="line"><span class="comment"> 1 单图文章</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"> <span class="meta">@TableField("type")</span></span><br><span class="line"> <span class="keyword">private</span> Short type;</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">@TableField("channel_id")</span></span><br><span class="line"> <span class="keyword">private</span> Integer channelId;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@TableField("labels")</span></span><br><span class="line"> <span class="keyword">private</span> String labels;</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">@TableField("created_time")</span></span><br><span class="line"> <span class="keyword">private</span> Date createdTime;</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">@TableField("submited_time")</span></span><br><span class="line"> <span class="keyword">private</span> Date submitedTime;</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"> 0 草稿</span></span><br><span class="line"><span class="comment"> 1 提交(待审核)</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"> 4 人工审核通过</span></span><br><span class="line"><span class="comment"> 8 审核通过(待发布)</span></span><br><span class="line"><span class="comment"> 9 已发布</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@TableField("status")</span></span><br><span class="line"> <span class="keyword">private</span> Short status;</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">@TableField("publish_time")</span></span><br><span class="line"> <span class="keyword">private</span> Date publishTime;</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">@TableField("reason")</span></span><br><span class="line"> <span class="keyword">private</span> String reason;</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">@TableField("article_id")</span></span><br><span class="line"> <span class="keyword">private</span> Long articleId;</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">@TableField("images")</span></span><br><span class="line"> <span class="keyword">private</span> String images;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@TableField("enable")</span></span><br><span class="line"> <span class="keyword">private</span> Short enable;</span><br><span class="line"> </span><br><span class="line"> <span class="comment">//状态枚举类</span></span><br><span class="line"> <span class="meta">@Alias("WmNewsStatus")</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">enum</span> <span class="title class_">Status</span>{</span><br><span class="line"> NORMAL((<span class="type">short</span>)<span class="number">0</span>),SUBMIT((<span class="type">short</span>)<span class="number">1</span>),FAIL((<span class="type">short</span>)<span class="number">2</span>),ADMIN_AUTH((<span class="type">short</span>)<span class="number">3</span>),ADMIN_SUCCESS((<span class="type">short</span>)<span class="number">4</span>),SUCCESS((<span class="type">short</span>)<span class="number">8</span>),PUBLISHED((<span class="type">short</span>)<span class="number">9</span>);</span><br><span class="line"> <span class="type">short</span> code;</span><br><span class="line"> Status(<span class="type">short</span> code){</span><br><span class="line"> <span class="built_in">this</span>.code = code;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">public</span> <span class="type">short</span> <span class="title function_">getCode</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="built_in">this</span>.code;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>接口定义</strong></p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th><strong>接口路径</strong></th>
|
||
<th><strong>/api</strong>/<strong>/v1/news/list</strong></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>请求方式</td>
|
||
<td>POST</td>
|
||
</tr>
|
||
<tr>
|
||
<td>参数</td>
|
||
<td>WmNewsPageReqDto</td>
|
||
</tr>
|
||
<tr>
|
||
<td>响应结果</td>
|
||
<td>ResponseResult</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<p><strong>关键代码</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Override</span></span><br><span class="line"><span class="keyword">public</span> ResponseResult <span class="title function_">findNewsList</span><span class="params">(WmNewsPageReqDto wmNewsPageReqDto)</span> {</span><br><span class="line"> <span class="comment">//1.检查参数</span></span><br><span class="line"> wmNewsPageReqDto.checkParam();</span><br><span class="line"> <span class="comment">//2.根据条件查询</span></span><br><span class="line"> <span class="type">IPage</span> <span class="variable">page</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Page</span>(wmNewsPageReqDto.getPage(), wmNewsPageReqDto.getSize());</span><br><span class="line"> LambdaQueryWrapper<WmNews> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><>();</span><br><span class="line"> <span class="comment">//状态</span></span><br><span class="line"> <span class="keyword">if</span>(wmNewsPageReqDto.getStatus() != <span class="literal">null</span>){</span><br><span class="line"> queryWrapper.eq(WmNews::getStatus,wmNewsPageReqDto.getStatus());</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//开始时间 结束时间</span></span><br><span class="line"> <span class="keyword">if</span>(wmNewsPageReqDto.getBeginPubDate() != <span class="literal">null</span> && wmNewsPageReqDto.getEndPubDate()!=<span class="literal">null</span>){</span><br><span class="line"> queryWrapper.between(WmNews::getPublishTime,wmNewsPageReqDto.getBeginPubDate(),wmNewsPageReqDto.getEndPubDate());</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//所属频道id</span></span><br><span class="line"> <span class="keyword">if</span>(wmNewsPageReqDto.getChannelId() != <span class="literal">null</span>){</span><br><span class="line"> queryWrapper.eq(WmNews::getChannelId,wmNewsPageReqDto.getChannelId());</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//关键字</span></span><br><span class="line"> <span class="keyword">if</span>(wmNewsPageReqDto.getKeyword() != <span class="literal">null</span>){</span><br><span class="line"> queryWrapper.like(WmNews::getTitle,wmNewsPageReqDto.getKeyword());</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//查询当前登录人的文章</span></span><br><span class="line"> queryWrapper.eq(WmNews::getUserId, WmThreadLocalUtil.getUser().getId());</span><br><span class="line"> <span class="comment">//按照发布时间倒序查询</span></span><br><span class="line"> queryWrapper.orderByDesc(WmNews::getPublishTime);</span><br><span class="line"> page = page(page,queryWrapper);</span><br><span class="line"> <span class="comment">//3.结果返回</span></span><br><span class="line"> <span class="type">ResponseResult</span> <span class="variable">responseResult</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">PageResponseResult</span>(wmNewsPageReqDto.getPage(), wmNewsPageReqDto.getSize(), (<span class="type">int</span>) page.getTotal());</span><br><span class="line"> responseResult.setData(page.getRecords());</span><br><span class="line"> <span class="keyword">return</span> responseResult;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>实现效果</strong></p>
|
||
<p><img src="/pictures/image-20230903185956428.png" alt="image-20230903185956428"></p>
|
||
<h3 id="4-3-发布文章功能-核心功能"><a href="#4-3-发布文章功能-核心功能" class="headerlink" title="4.3 发布文章功能(核心功能)"></a>4.3 发布文章功能(核心功能)</h3><p><strong>文章和素材对应关系表</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.model.wemedia.pojos;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.IdType;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.TableField;</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 class="keyword">import</span> lombok.Data;</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="comment">/**</span></span><br><span class="line"><span class="comment"> * <p></span></span><br><span class="line"><span class="comment"> * 自媒体图文引用素材信息表</span></span><br><span class="line"><span class="comment"> * </p></span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> itheima</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("wm_news_material")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WmNewsMaterial</span> <span class="keyword">implements</span> <span class="title class_">Serializable</span> {</span><br><span class="line"></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"> * 主键</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@TableId(value = "id", type = IdType.AUTO)</span></span><br><span class="line"> <span class="keyword">private</span> Integer id;</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">@TableField("material_id")</span></span><br><span class="line"> <span class="keyword">private</span> Integer materialId;</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">@TableField("news_id")</span></span><br><span class="line"> <span class="keyword">private</span> Integer newsId;</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"> 0 内容引用</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"> <span class="meta">@TableField("type")</span></span><br><span class="line"> <span class="keyword">private</span> Short type;</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">@TableField("ord")</span></span><br><span class="line"> <span class="keyword">private</span> Short ord;</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>实现流程</strong></p>
|
||
<p><img src="/pictures/image-20230904151910210.png" alt="image-20230904151910210"></p>
|
||
<p><strong>接口定义</strong></p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th><strong>说明</strong></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>接口路径</td>
|
||
<td>/api/v1/news/submit</td>
|
||
</tr>
|
||
<tr>
|
||
<td>请求方式</td>
|
||
<td>POST</td>
|
||
</tr>
|
||
<tr>
|
||
<td>参数</td>
|
||
<td>WmNewsDto</td>
|
||
</tr>
|
||
<tr>
|
||
<td>响应结果</td>
|
||
<td>ResponseResult</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<p><strong>WmNewsDto</strong> </p>
|
||
<p>接收前端参数的dto</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.model.wemedia.dtos;</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.Date;</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="meta">@Data</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WmNewsDto</span> {</span><br><span class="line"> </span><br><span class="line"> <span class="keyword">private</span> Integer id;</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 title;</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> Integer channelId;</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 labels;</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> Date publishTime;</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 content;</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 文章封面类型 0 无图 1 单图 3 多图 -1 自动</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> Short type;</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> Date submitedTime; </span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 状态 提交为1 草稿为0</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> Short status;</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<String> images;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>前端传递的json格式数据举例</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"title"</span><span class="punctuation">:</span><span class="string">"黑马头条项目背景"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span><span class="string">"1"</span><span class="punctuation">,</span><span class="comment">//这个 0 是无图 1 是单图 3 是多图 -1 是自动</span></span><br><span class="line"> <span class="attr">"labels"</span><span class="punctuation">:</span><span class="string">"黑马头条"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"publishTime"</span><span class="punctuation">:</span><span class="string">"2020-03-14T11:35:49.000Z"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"channelId"</span><span class="punctuation">:</span><span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"images"</span><span class="punctuation">:</span><span class="punctuation">[</span></span><br><span class="line"> <span class="string">"http://192.168.200.130/group1/M00/00/00/wKjIgl5swbGATaSAAAEPfZfx6Iw790.png"</span></span><br><span class="line"> <span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"status"</span><span class="punctuation">:</span><span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"content"</span><span class="punctuation">:</span><span class="string">"[</span></span><br><span class="line"><span class="string"> {</span></span><br><span class="line"><span class="string"> "</span>type<span class="string">":"</span>text<span class="string">",</span></span><br><span class="line"><span class="string"> "</span>value<span class="string">":"</span>随着智能手机的普及,人们更加习惯于通过手机来看新闻。由于生活节奏的加快,很多人只能利用碎片时间来获取信息,因此,对于移动资讯客户端的需求也越来越高。黑马头条项目正是在这样背景下开发出来。黑马头条项目采用当下火热的微服务+大数据技术架构实现。本项目主要着手于获取最新最热新闻资讯,通过大数据分析用户喜好精确推送咨询新闻<span class="string">"</span></span><br><span class="line"><span class="string"> },</span></span><br><span class="line"><span class="string"> {</span></span><br><span class="line"><span class="string"> "</span>type<span class="string">":"</span>image<span class="string">",</span></span><br><span class="line"><span class="string"> "</span>value<span class="string">":"</span>http<span class="punctuation">:</span><span class="comment">//192.168.200.130/group1/M00/00/00/wKjIgl5swbGATaSAAAEPfZfx6Iw790.png"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">]</span><span class="string">"</span></span><br><span class="line"><span class="string">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>保存文章和素材对应关系mapper接口</strong></p>
|
||
<p>mapper接口</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Mapper</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">interface</span> <span class="title class_">WmNewsMaterialMapper</span> <span class="keyword">extends</span> <span class="title class_">BaseMapper</span><WmNewsMaterial> {</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 class="doctag">@param</span> materialIds 素材的id</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> newsId 文章的id</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> type 类型</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">saveRelations</span><span class="params">(<span class="meta">@Param("materialIds")</span> List<Integer> materialIds,<span class="meta">@Param("newsId")</span> Integer newsId, <span class="meta">@Param("type")</span>Short type)</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>mapper.xml文件</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="meta"><?xml version=<span class="string">"1.0"</span> encoding=<span class="string">"UTF-8"</span>?></span></span><br><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">mapper</span> <span class="keyword">PUBLIC</span> <span class="string">"-//mybatis.org//DTD Mapper 3.0//EN"</span> <span class="string">"http://mybatis.org/dtd/mybatis-3-mapper.dtd"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">mapper</span> <span class="attr">namespace</span>=<span class="string">"com.heima.wemedia.mapper.WmNewsMaterialMapper"</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">insert</span> <span class="attr">id</span>=<span class="string">"saveRelations"</span>></span></span><br><span class="line"> insert into wm_news_material (material_id,news_id,type,ord)</span><br><span class="line"> values</span><br><span class="line"> <span class="tag"><<span class="name">foreach</span> <span class="attr">collection</span>=<span class="string">"materialIds"</span> <span class="attr">index</span>=<span class="string">"ord"</span> <span class="attr">item</span>=<span class="string">"mid"</span> <span class="attr">separator</span>=<span class="string">","</span>></span></span><br><span class="line"> (#{mid},#{newsId},#{type},#{ord})</span><br><span class="line"> <span class="tag"></<span class="name">foreach</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">insert</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">mapper</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>使用到的常量类</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.common.constants;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WemediaConstants</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">Short</span> <span class="variable">COLLECT_MATERIAL</span> <span class="operator">=</span> <span class="number">1</span>;<span class="comment">//收藏</span></span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">Short</span> <span class="variable">CANCEL_COLLECT_MATERIAL</span> <span class="operator">=</span> <span class="number">0</span>;<span class="comment">//取消收藏</span></span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">String</span> <span class="variable">WM_NEWS_TYPE_IMAGE</span> <span class="operator">=</span> <span class="string">"image"</span>;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">Short</span> <span class="variable">WM_NEWS_NONE_IMAGE</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">Short</span> <span class="variable">WM_NEWS_SINGLE_IMAGE</span> <span class="operator">=</span> <span class="number">1</span>;</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">Short</span> <span class="variable">WM_NEWS_MANY_IMAGE</span> <span class="operator">=</span> <span class="number">3</span>;</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">Short</span> <span class="variable">WM_NEWS_TYPE_AUTO</span> <span class="operator">=</span> -<span class="number">1</span>;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">Short</span> <span class="variable">WM_CONTENT_REFERENCE</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">Short</span> <span class="variable">WM_COVER_REFERENCE</span> <span class="operator">=</span> <span class="number">1</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>发布文章功能的关键代码</strong></p>
|
||
<p>存在许多的bug</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.wemedia.service.impl;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.alibaba.fastjson.JSON;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;</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.plugins.pagination.Page;</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.heima.common.constants.WemediaConstants;</span><br><span class="line"><span class="keyword">import</span> com.heima.common.exception.CustomException;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.common.dtos.PageResponseResult;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.common.dtos.ResponseResult;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.common.enums.AppHttpCodeEnum;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.wemedia.dtos.WmNewsDto;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.wemedia.dtos.WmNewsPageReqDto;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.wemedia.pojos.WmMaterial;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.wemedia.pojos.WmNews;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.wemedia.pojos.WmNewsMaterial;</span><br><span class="line"><span class="keyword">import</span> com.heima.utils.thread.WmThreadLocalUtil;</span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.mapper.WmMaterialMapper;</span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.mapper.WmNewsMapper;</span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.mapper.WmNewsMaterialMapper;</span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.service.WmNewsService;</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.apache.commons.lang.StringUtils;</span><br><span class="line"><span class="keyword">import</span> org.apache.jute.compiler.JString;</span><br><span class="line"><span class="keyword">import</span> org.springframework.beans.BeanUtils;</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 class="keyword">import</span> org.springframework.transaction.annotation.Transactional;</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.Date;</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="meta">@Service</span></span><br><span class="line"><span class="meta">@Slf4j</span></span><br><span class="line"><span class="meta">@Transactional</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WmNewsServiceImpl</span> <span class="keyword">extends</span> <span class="title class_">ServiceImpl</span><WmNewsMapper, WmNews> <span class="keyword">implements</span> <span class="title class_">WmNewsService</span> {</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> WmNewsMaterialMapper wmNewsMaterialMapper;</span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="keyword">private</span> WmMaterialMapper wmMaterialMapper;</span><br><span class="line"></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> ResponseResult <span class="title function_">findNewsList</span><span class="params">(WmNewsPageReqDto wmNewsPageReqDto)</span> {</span><br><span class="line"> <span class="comment">//1.检查参数</span></span><br><span class="line"> wmNewsPageReqDto.checkParam();</span><br><span class="line"> <span class="comment">//2.根据条件查询</span></span><br><span class="line"> <span class="type">IPage</span> <span class="variable">page</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Page</span>(wmNewsPageReqDto.getPage(), wmNewsPageReqDto.getSize());</span><br><span class="line"> LambdaQueryWrapper<WmNews> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><>();</span><br><span class="line"> <span class="comment">//状态</span></span><br><span class="line"> <span class="keyword">if</span> (wmNewsPageReqDto.getStatus() != <span class="literal">null</span>) {</span><br><span class="line"> queryWrapper.eq(WmNews::getStatus, wmNewsPageReqDto.getStatus());</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//开始时间 结束时间</span></span><br><span class="line"> <span class="keyword">if</span> (wmNewsPageReqDto.getBeginPubDate() != <span class="literal">null</span> && wmNewsPageReqDto.getEndPubDate() != <span class="literal">null</span>) {</span><br><span class="line"> queryWrapper.between(WmNews::getPublishTime, wmNewsPageReqDto.getBeginPubDate(), wmNewsPageReqDto.getEndPubDate());</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//所属频道id</span></span><br><span class="line"> <span class="keyword">if</span> (wmNewsPageReqDto.getChannelId() != <span class="literal">null</span>) {</span><br><span class="line"> queryWrapper.eq(WmNews::getChannelId, wmNewsPageReqDto.getChannelId());</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//关键字</span></span><br><span class="line"> <span class="keyword">if</span> (wmNewsPageReqDto.getKeyword() != <span class="literal">null</span>) {</span><br><span class="line"> queryWrapper.like(WmNews::getTitle, wmNewsPageReqDto.getKeyword());</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//查询当前登录人的文章</span></span><br><span class="line"> queryWrapper.eq(WmNews::getUserId, WmThreadLocalUtil.getUser().getId());</span><br><span class="line"> <span class="comment">//按照发布时间倒序查询</span></span><br><span class="line"> queryWrapper.orderByDesc(WmNews::getPublishTime);</span><br><span class="line"> page = page(page, queryWrapper);</span><br><span class="line"> <span class="comment">//3.结果返回</span></span><br><span class="line"> <span class="type">ResponseResult</span> <span class="variable">responseResult</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">PageResponseResult</span>(wmNewsPageReqDto.getPage(), wmNewsPageReqDto.getSize(), (<span class="type">int</span>) page.getTotal());</span><br><span class="line"> responseResult.setData(page.getRecords());</span><br><span class="line"> <span class="keyword">return</span> responseResult;</span><br><span class="line"> }</span><br><span class="line"></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> ResponseResult <span class="title function_">submitNews</span><span class="params">(WmNewsDto wmNewsDto)</span> {</span><br><span class="line"> <span class="comment">//参数校验</span></span><br><span class="line"> <span class="keyword">if</span> (wmNewsDto == <span class="literal">null</span> || wmNewsDto.getContent() == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">return</span> ResponseResult.errorResult(AppHttpCodeEnum.PARAM_INVALID);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//保存或者修改文章</span></span><br><span class="line"> <span class="type">WmNews</span> <span class="variable">wmNews</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">WmNews</span>();</span><br><span class="line"> BeanUtils.copyProperties(wmNewsDto, wmNews);</span><br><span class="line"> <span class="comment">//封面图片从list集合转化成字符串(以,作为分割符号)</span></span><br><span class="line"> <span class="keyword">if</span> (wmNewsDto.getImages() != <span class="literal">null</span> && wmNewsDto.getImages().size() > <span class="number">0</span>) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">imageStr</span> <span class="operator">=</span> StringUtils.join(wmNewsDto.getImages(), <span class="string">","</span>);</span><br><span class="line"> wmNews.setImages(imageStr);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//设置封面的类型(数据库中封面的类型是无符号的,无法使用-1表示,所以我们先置空)</span></span><br><span class="line"> <span class="keyword">if</span> (wmNewsDto.getType().equals(WemediaConstants.WM_NEWS_TYPE_AUTO)) {</span><br><span class="line"> wmNews.setType(<span class="literal">null</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//保存或者修改文章的方法</span></span><br><span class="line"> saveOrUpdateWmNews(wmNews);</span><br><span class="line"> <span class="comment">//判断是否为草稿,如果是草稿就退出该方法,草稿是不保存文章与素材的关系的</span></span><br><span class="line"> <span class="keyword">if</span> (wmNewsDto.getStatus().equals(WmNews.Status.NORMAL.getCode())) {</span><br><span class="line"> <span class="keyword">return</span> ResponseResult.okResult(AppHttpCodeEnum.SUCCESS);</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"> List<String> materials = getUrlInfo(wmNewsDto.getContent());</span><br><span class="line"> <span class="comment">//保存文章和素材的关系</span></span><br><span class="line"> saveRelativeInfoContent(materials,wmNews.getId());</span><br><span class="line"> <span class="comment">//文章封面图片与素材的关系,布局是自动的,需要自动匹配图片</span></span><br><span class="line"> saveRelativeInfoForCover(wmNewsDto,wmNews,materials);</span><br><span class="line"> <span class="keyword">return</span> ResponseResult.okResult(AppHttpCodeEnum.SUCCESS);</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"> * 1.如果内容图片大于等于1 小于3 单图 type 1</span></span><br><span class="line"><span class="comment"> * 2.如果内容图片大于3 多图 type 3</span></span><br><span class="line"><span class="comment"> * 3.如果内容没有图片 无图 type 0</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">void</span> <span class="title function_">saveRelativeInfoForCover</span><span class="params">(WmNewsDto wmNewsDto, WmNews wmNews, List<String> materials)</span> {</span><br><span class="line"> List<String> images = wmNewsDto.getImages();</span><br><span class="line"> <span class="comment">//处理匹配规则</span></span><br><span class="line"> <span class="keyword">if</span>(wmNewsDto.getType().equals(WemediaConstants.WM_NEWS_TYPE_AUTO)){</span><br><span class="line"> <span class="keyword">if</span>(materials.size() >= <span class="number">3</span>){<span class="comment">//多图</span></span><br><span class="line"> wmNews.setType(WemediaConstants.WM_NEWS_MANY_IMAGE);</span><br><span class="line"> <span class="comment">//截取这篇文章中的三种图片给文章的封面</span></span><br><span class="line"> images = materials.stream().limit(<span class="number">3</span>).collect(Collectors.toList());</span><br><span class="line"> }<span class="keyword">else</span> <span class="keyword">if</span> (materials.size() > <span class="number">1</span> && materials.size() < <span class="number">3</span>){<span class="comment">//单图</span></span><br><span class="line"> wmNews.setType(WemediaConstants.WM_NEWS_SINGLE_IMAGE);</span><br><span class="line"> images = materials.stream().limit(<span class="number">1</span>).collect(Collectors.toList());</span><br><span class="line"> }<span class="keyword">else</span> {<span class="comment">//无图</span></span><br><span class="line"> wmNews.setType(WemediaConstants.WM_NEWS_NONE_IMAGE);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//修改文章</span></span><br><span class="line"> <span class="keyword">if</span> (images != <span class="literal">null</span> && images.size() > <span class="number">0</span>){</span><br><span class="line"> wmNews.setImages(StringUtils.join(images,<span class="string">","</span>));</span><br><span class="line"> }</span><br><span class="line"> updateById(wmNews);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//保存封面与素材的关系</span></span><br><span class="line"> <span class="keyword">if</span> (images != <span class="literal">null</span> && images.size() > <span class="number">0</span>){</span><br><span class="line"> saveRelativeInfo(images,wmNews.getId(),WemediaConstants.WM_COVER_REFERENCE);</span><br><span class="line"> }</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 class="doctag">@param</span> materials 同一篇文章的所有素材图片url</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> newsId 文章的id</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">void</span> <span class="title function_">saveRelativeInfoContent</span><span class="params">(List<String> materials, Integer newsId)</span> {</span><br><span class="line"> saveRelativeInfo(materials,newsId,WemediaConstants.WM_CONTENT_REFERENCE);</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 class="doctag">@param</span> materials 同一篇文章中所有的素材图片</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> newsId 文章的id</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">void</span> <span class="title function_">saveRelativeInfo</span><span class="params">(List<String> materials, Integer newsId, Short type)</span> {</span><br><span class="line"> <span class="keyword">if</span> (materials != <span class="literal">null</span> && !materials.isEmpty()){</span><br><span class="line"> <span class="comment">//根据图片的url查询素材的id</span></span><br><span class="line"> LambdaQueryWrapper<WmMaterial> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><>();</span><br><span class="line"> queryWrapper.in(WmMaterial::getUrl,materials);</span><br><span class="line"> List<WmMaterial> wmMaterials = wmMaterialMapper.selectList(queryWrapper);</span><br><span class="line"> <span class="comment">//判断素材是否被删除</span></span><br><span class="line"> <span class="keyword">if</span> (wmMaterials == <span class="literal">null</span> || wmMaterials.size() == <span class="number">0</span>){</span><br><span class="line"> <span class="comment">//手动的抛出异常,上面的操作可以回滚</span></span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">CustomException</span>(AppHttpCodeEnum.MATERIASL_REFERENCE);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (materials.size() != wmMaterials.size()){</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">CustomException</span>(AppHttpCodeEnum.MATERIASL_REFERENCE);</span><br><span class="line"> }</span><br><span class="line"> List<Integer> idList = wmMaterials.stream().map(WmMaterial::getId).collect(Collectors.toList());</span><br><span class="line"> wmNewsMaterialMapper.saveRelations(idList,newsId,type);</span><br><span class="line"> }</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 class="doctag">@param</span> content 文章的内容信息</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 图片url组成的集合</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> List<String> <span class="title function_">getUrlInfo</span><span class="params">(String content)</span> {</span><br><span class="line"> ArrayList<String> materials = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> List<Map> maps = JSON.parseArray(content, Map.class);</span><br><span class="line"> <span class="keyword">for</span> (Map map : maps) {</span><br><span class="line"> <span class="keyword">if</span> (map.get(<span class="string">"type"</span>).equals(<span class="string">"image"</span>)){</span><br><span class="line"> <span class="type">String</span> <span class="variable">imgUrl</span> <span class="operator">=</span> (String) map.get(<span class="string">"value"</span>);</span><br><span class="line"> materials.add(imgUrl);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> materials;</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 class="doctag">@param</span> wmNews 文章实体类</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">void</span> <span class="title function_">saveOrUpdateWmNews</span><span class="params">(WmNews wmNews)</span> {</span><br><span class="line"> <span class="comment">//补全属性</span></span><br><span class="line"> wmNews.setUserId(WmThreadLocalUtil.getUser().getId());</span><br><span class="line"> wmNews.setCreatedTime(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"> wmNews.setSubmitedTime(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"> wmNews.setEnable((<span class="type">short</span>) <span class="number">1</span>); <span class="comment">//设置默认上架</span></span><br><span class="line"> <span class="comment">//判断是保存还是修改操作,执行不同的处理逻辑</span></span><br><span class="line"> <span class="keyword">if</span> (wmNews.getId() == <span class="literal">null</span>) {</span><br><span class="line"> <span class="comment">//保存操作</span></span><br><span class="line"> save(wmNews);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">//修改操作</span></span><br><span class="line"> <span class="comment">//删除文章与素材的关联关系</span></span><br><span class="line"> LambdaQueryWrapper<WmNewsMaterial> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><>();</span><br><span class="line"> queryWrapper.eq(WmNewsMaterial::getNewsId, wmNews.getId());</span><br><span class="line"> wmNewsMaterialMapper.delete(queryWrapper);</span><br><span class="line"> updateById(wmNews);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20231029220319010.png" alt="image-20231029220319010"></p>
|
||
<h3 id="4-4-文章的审核功能-未实现"><a href="#4-4-文章的审核功能-未实现" class="headerlink" title="4.4 文章的审核功能(未实现)"></a>4.4 文章的审核功能(未实现)</h3><h4 id="4-4-1-文章审核功能介绍"><a href="#4-4-1-文章审核功能介绍" class="headerlink" title="4.4.1 文章审核功能介绍"></a>4.4.1 文章审核功能介绍</h4><p>调用第三方的接口(阿里云内容安全审核接口)实现审核功能</p>
|
||
<p><strong>功能介绍</strong></p>
|
||
<p><img src="/pictures/image-20231029220622019.png" alt="image-20231029220622019"></p>
|
||
<p><img src="/pictures/image-20231029220707636.png" alt="image-20231029220707636"></p>
|
||
<p><strong>审核流程</strong></p>
|
||
<p><img src="/pictures/image-20231029221745020.png" alt="image-20231029221745020"></p>
|
||
<p>1 自媒体端发布文章后,开始审核文章</p>
|
||
<p>2 审核的主要是审核文章的内容(文本内容和图片)</p>
|
||
<p>3 借助第三方提供的接口审核文本</p>
|
||
<p>4 借助第三方提供的接口审核图片,由于图片存储到minIO中,需要先下载才能审核</p>
|
||
<p>5 如果审核失败,则需要修改自媒体文章的状态,status:2 审核失败 status:3 转到人工审核</p>
|
||
<p>6 如果审核成功,则需要在文章微服务中创建app端需要的文章</p>
|
||
<h4 id="4-4-2-调用第三方的审核接口"><a href="#4-4-2-调用第三方的审核接口" class="headerlink" title="4.4.2 调用第三方的审核接口"></a>4.4.2 调用第三方的审核接口</h4><p><strong>第三方审核接口</strong></p>
|
||
<p>1.内容安全接口介绍:</p>
|
||
<p>内容安全是识别服务,支持对图片、视频、文本、语音等对象进行多样化场景检测,有效降低内容违规风险。目前很多平台都支持内容检测,如阿里云、腾讯云、百度AI、网易云等国内大型互联网公司都对外提供了API。</p>
|
||
<p>2.文件检测和图片检测api文档</p>
|
||
<p>文本垃圾内容Java SDK: <a href="https://help.aliyun.com/document_detail/53427.html?spm=a2c4g.11186623.6.717.466d7544QbU8Lr">https://help.aliyun.com/document_detail/53427.html?spm=a2c4g.11186623.6.717.466d7544QbU8Lr</a></p>
|
||
<p>图片垃圾内容Java SDK: <a href="https://help.aliyun.com/document_detail/53424.html?spm=a2c4g.11186623.6.715.c8f69b12ey35j4">https://help.aliyun.com/document_detail/53424.html?spm=a2c4g.11186623.6.715.c8f69b12ey35j4</a></p>
|
||
<p><strong>项目中集成阿里云内容安全接口</strong></p>
|
||
<p>1.依赖导入</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.aliyun<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>aliyun-java-sdk-core<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.aliyun<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>aliyun-java-sdk-green<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.相关的工具类</p>
|
||
<p>GreenImageScan(图片审核的工具类)</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.common.aliyun;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.alibaba.fastjson.JSON;</span><br><span class="line"><span class="keyword">import</span> com.alibaba.fastjson.JSONArray;</span><br><span class="line"><span class="keyword">import</span> com.alibaba.fastjson.JSONObject;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.DefaultAcsClient;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.IAcsClient;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.green.model.v20180509.ImageSyncScanRequest;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.http.FormatType;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.http.HttpResponse;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.http.MethodType;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.http.ProtocolType;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.profile.DefaultProfile;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.profile.IClientProfile;</span><br><span class="line"><span class="keyword">import</span> com.heima.common.aliyun.util.ClientUploader;</span><br><span class="line"><span class="keyword">import</span> lombok.Getter;</span><br><span class="line"><span class="keyword">import</span> lombok.Setter;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.context.properties.ConfigurationProperties;</span><br><span class="line"><span class="keyword">import</span> org.springframework.context.annotation.PropertySource;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Component;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.*;</span><br><span class="line"></span><br><span class="line"><span class="meta">@Getter</span></span><br><span class="line"><span class="meta">@Setter</span></span><br><span class="line"><span class="meta">@Component</span></span><br><span class="line"><span class="meta">@ConfigurationProperties(prefix = "aliyun")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">GreenImageScan</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String accessKeyId;</span><br><span class="line"> <span class="keyword">private</span> String secret;</span><br><span class="line"> <span class="keyword">private</span> String scenes;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> Map <span class="title function_">imageScan</span><span class="params">(List<<span class="type">byte</span>[]> imageList)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> <span class="type">IClientProfile</span> <span class="variable">profile</span> <span class="operator">=</span> DefaultProfile</span><br><span class="line"> .getProfile(<span class="string">"cn-shanghai"</span>, accessKeyId, secret);</span><br><span class="line"> DefaultProfile</span><br><span class="line"> .addEndpoint(<span class="string">"cn-shanghai"</span>, <span class="string">"cn-shanghai"</span>, <span class="string">"Green"</span>, <span class="string">"green.cn-shanghai.aliyuncs.com"</span>);</span><br><span class="line"> <span class="type">IAcsClient</span> <span class="variable">client</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">DefaultAcsClient</span>(profile);</span><br><span class="line"> <span class="type">ImageSyncScanRequest</span> <span class="variable">imageSyncScanRequest</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ImageSyncScanRequest</span>();</span><br><span class="line"> <span class="comment">// 指定api返回格式</span></span><br><span class="line"> imageSyncScanRequest.setAcceptFormat(FormatType.JSON);</span><br><span class="line"> <span class="comment">// 指定请求方法</span></span><br><span class="line"> imageSyncScanRequest.setMethod(MethodType.POST);</span><br><span class="line"> imageSyncScanRequest.setEncoding(<span class="string">"utf-8"</span>);</span><br><span class="line"> <span class="comment">//支持http和https</span></span><br><span class="line"> imageSyncScanRequest.setProtocol(ProtocolType.HTTP);</span><br><span class="line"> <span class="type">JSONObject</span> <span class="variable">httpBody</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">JSONObject</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"> * 例如:检测2张图片,场景传递porn、terrorism,计费会按照2张图片鉴黄,2张图片暴恐检测计算</span></span><br><span class="line"><span class="comment"> * porn: porn表示色情场景检测</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"></span><br><span class="line"> httpBody.put(<span class="string">"scenes"</span>, Arrays.asList(scenes.split(<span class="string">","</span>)));</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 如果您要检测的文件存于本地服务器上,可以通过下述代码片生成url</span></span><br><span class="line"><span class="comment"> * 再将返回的url作为图片地址传递到服务端进行检测</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"> * 设置待检测图片, 一张图片一个task</span></span><br><span class="line"><span class="comment"> * 多张图片同时检测时,处理的时间由最后一个处理完的图片决定</span></span><br><span class="line"><span class="comment"> * 通常情况下批量检测的平均rt比单张检测的要长, 一次批量提交的图片数越多,rt被拉长的概率越高</span></span><br><span class="line"><span class="comment"> * 这里以单张图片检测作为示例, 如果是批量图片检测,请自行构建多个task</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="type">ClientUploader</span> <span class="variable">clientUploader</span> <span class="operator">=</span> ClientUploader.getImageClientUploader(profile, <span class="literal">false</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">url</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> List<JSONObject> urlList = <span class="keyword">new</span> <span class="title class_">ArrayList</span><JSONObject>();</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">byte</span>[] bytes : imageList) {</span><br><span class="line"> url = clientUploader.uploadBytes(bytes);</span><br><span class="line"> <span class="type">JSONObject</span> <span class="variable">task</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">JSONObject</span>();</span><br><span class="line"> task.put(<span class="string">"dataId"</span>, UUID.randomUUID().toString());</span><br><span class="line"> <span class="comment">//设置图片链接为上传后的url</span></span><br><span class="line"> task.put(<span class="string">"url"</span>, url);</span><br><span class="line"> task.put(<span class="string">"time"</span>, <span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"> urlList.add(task);</span><br><span class="line"> }</span><br><span class="line"> httpBody.put(<span class="string">"tasks"</span>, urlList);</span><br><span class="line"> imageSyncScanRequest.setHttpContent(org.apache.commons.codec.binary.StringUtils.getBytesUtf8(httpBody.toJSONString()),</span><br><span class="line"> <span class="string">"UTF-8"</span>, FormatType.JSON);</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 请设置超时时间, 服务端全链路处理超时时间为10秒,请做相应设置</span></span><br><span class="line"><span class="comment"> * 如果您设置的ReadTimeout小于服务端处理的时间,程序中会获得一个read timeout异常</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> imageSyncScanRequest.setConnectTimeout(<span class="number">3000</span>);</span><br><span class="line"> imageSyncScanRequest.setReadTimeout(<span class="number">10000</span>);</span><br><span class="line"> <span class="type">HttpResponse</span> <span class="variable">httpResponse</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> httpResponse = client.doAction(imageSyncScanRequest);</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> Map<String, String> resultMap = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"></span><br><span class="line"> <span class="comment">//服务端接收到请求,并完成处理返回的结果</span></span><br><span class="line"> <span class="keyword">if</span> (httpResponse != <span class="literal">null</span> && httpResponse.isSuccess()) {</span><br><span class="line"> <span class="type">JSONObject</span> <span class="variable">scrResponse</span> <span class="operator">=</span> JSON.parseObject(org.apache.commons.codec.binary.StringUtils.newStringUtf8(httpResponse.getHttpContent()));</span><br><span class="line"> System.out.println(JSON.toJSONString(scrResponse, <span class="literal">true</span>));</span><br><span class="line"> <span class="type">int</span> <span class="variable">requestCode</span> <span class="operator">=</span> scrResponse.getIntValue(<span class="string">"code"</span>);</span><br><span class="line"> <span class="comment">//每一张图片的检测结果</span></span><br><span class="line"> <span class="type">JSONArray</span> <span class="variable">taskResults</span> <span class="operator">=</span> scrResponse.getJSONArray(<span class="string">"data"</span>);</span><br><span class="line"> <span class="keyword">if</span> (<span class="number">200</span> == requestCode) {</span><br><span class="line"> <span class="keyword">for</span> (Object taskResult : taskResults) {</span><br><span class="line"> <span class="comment">//单张图片的处理结果</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">taskCode</span> <span class="operator">=</span> ((JSONObject) taskResult).getIntValue(<span class="string">"code"</span>);</span><br><span class="line"> <span class="comment">//图片要检测的场景的处理结果, 如果是多个场景,则会有每个场景的结果</span></span><br><span class="line"> <span class="type">JSONArray</span> <span class="variable">sceneResults</span> <span class="operator">=</span> ((JSONObject) taskResult).getJSONArray(<span class="string">"results"</span>);</span><br><span class="line"> <span class="keyword">if</span> (<span class="number">200</span> == taskCode) {</span><br><span class="line"> <span class="keyword">for</span> (Object sceneResult : sceneResults) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">scene</span> <span class="operator">=</span> ((JSONObject) sceneResult).getString(<span class="string">"scene"</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">label</span> <span class="operator">=</span> ((JSONObject) sceneResult).getString(<span class="string">"label"</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">suggestion</span> <span class="operator">=</span> ((JSONObject) sceneResult).getString(<span class="string">"suggestion"</span>);</span><br><span class="line"> <span class="comment">//根据scene和suggetion做相关处理</span></span><br><span class="line"> <span class="comment">//do something</span></span><br><span class="line"> System.out.println(<span class="string">"scene = ["</span> + scene + <span class="string">"]"</span>);</span><br><span class="line"> System.out.println(<span class="string">"suggestion = ["</span> + suggestion + <span class="string">"]"</span>);</span><br><span class="line"> System.out.println(<span class="string">"suggestion = ["</span> + label + <span class="string">"]"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!suggestion.equals(<span class="string">"pass"</span>)) {</span><br><span class="line"> resultMap.put(<span class="string">"suggestion"</span>, suggestion);</span><br><span class="line"> resultMap.put(<span class="string">"label"</span>, label);</span><br><span class="line"> <span class="keyword">return</span> resultMap;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">//单张图片处理失败, 原因视具体的情况详细分析</span></span><br><span class="line"> System.out.println(<span class="string">"task process fail. task response:"</span> + JSON.toJSONString(taskResult));</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> resultMap.put(<span class="string">"suggestion"</span>,<span class="string">"pass"</span>);</span><br><span class="line"> <span class="keyword">return</span> resultMap;</span><br><span class="line"> } <span class="keyword">else</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"> System.out.println(<span class="string">"the whole image scan request failed. response:"</span> + JSON.toJSONString(scrResponse));</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>GreenTextScan(文字审核的工具类)</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.common.aliyun;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.alibaba.fastjson.JSON;</span><br><span class="line"><span class="keyword">import</span> com.alibaba.fastjson.JSONArray;</span><br><span class="line"><span class="keyword">import</span> com.alibaba.fastjson.JSONObject;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.DefaultAcsClient;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.IAcsClient;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.exceptions.ClientException;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.exceptions.ServerException;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.green.model.v20180509.TextScanRequest;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.http.FormatType;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.http.HttpResponse;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.profile.DefaultProfile;</span><br><span class="line"><span class="keyword">import</span> com.aliyuncs.profile.IClientProfile;</span><br><span class="line"><span class="keyword">import</span> lombok.Getter;</span><br><span class="line"><span class="keyword">import</span> lombok.Setter;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.context.properties.ConfigurationProperties;</span><br><span class="line"><span class="keyword">import</span> org.springframework.context.annotation.PropertySource;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Component;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.*;</span><br><span class="line"></span><br><span class="line"><span class="meta">@Getter</span></span><br><span class="line"><span class="meta">@Setter</span></span><br><span class="line"><span class="meta">@Component</span></span><br><span class="line"><span class="meta">@ConfigurationProperties(prefix = "aliyun")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">GreenTextScan</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String accessKeyId;</span><br><span class="line"> <span class="keyword">private</span> String secret;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> Map <span class="title function_">greeTextScan</span><span class="params">(String content)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> System.out.println(accessKeyId);</span><br><span class="line"> <span class="type">IClientProfile</span> <span class="variable">profile</span> <span class="operator">=</span> DefaultProfile</span><br><span class="line"> .getProfile(<span class="string">"cn-shanghai"</span>, accessKeyId, secret);</span><br><span class="line"> DefaultProfile.addEndpoint(<span class="string">"cn-shanghai"</span>, <span class="string">"cn-shanghai"</span>, <span class="string">"Green"</span>, <span class="string">"green.cn-shanghai.aliyuncs.com"</span>);</span><br><span class="line"> <span class="type">IAcsClient</span> <span class="variable">client</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">DefaultAcsClient</span>(profile);</span><br><span class="line"> <span class="type">TextScanRequest</span> <span class="variable">textScanRequest</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">TextScanRequest</span>();</span><br><span class="line"> textScanRequest.setAcceptFormat(FormatType.JSON); <span class="comment">// 指定api返回格式</span></span><br><span class="line"> textScanRequest.setHttpContentType(FormatType.JSON);</span><br><span class="line"> textScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); <span class="comment">// 指定请求方法</span></span><br><span class="line"> textScanRequest.setEncoding(<span class="string">"UTF-8"</span>);</span><br><span class="line"> textScanRequest.setRegionId(<span class="string">"cn-shanghai"</span>);</span><br><span class="line"> List<Map<String, Object>> tasks = <span class="keyword">new</span> <span class="title class_">ArrayList</span><Map<String, Object>>();</span><br><span class="line"> Map<String, Object> task1 = <span class="keyword">new</span> <span class="title class_">LinkedHashMap</span><String, Object>();</span><br><span class="line"> task1.put(<span class="string">"dataId"</span>, UUID.randomUUID().toString());</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 待检测的文本,长度不超过10000个字符</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> task1.put(<span class="string">"content"</span>, content);</span><br><span class="line"> tasks.add(task1);</span><br><span class="line"> <span class="type">JSONObject</span> <span class="variable">data</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">JSONObject</span>();</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 检测场景,文本垃圾检测传递:antispam</span></span><br><span class="line"><span class="comment"> **/</span></span><br><span class="line"> data.put(<span class="string">"scenes"</span>, Arrays.asList(<span class="string">"antispam"</span>));</span><br><span class="line"> data.put(<span class="string">"tasks"</span>, tasks);</span><br><span class="line"> System.out.println(JSON.toJSONString(data, <span class="literal">true</span>));</span><br><span class="line"> textScanRequest.setHttpContent(data.toJSONString().getBytes(<span class="string">"UTF-8"</span>), <span class="string">"UTF-8"</span>, FormatType.JSON);</span><br><span class="line"> <span class="comment">// 请务必设置超时时间</span></span><br><span class="line"> textScanRequest.setConnectTimeout(<span class="number">3000</span>);</span><br><span class="line"> textScanRequest.setReadTimeout(<span class="number">6000</span>);</span><br><span class="line"></span><br><span class="line"> Map<String, String> resultMap = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">HttpResponse</span> <span class="variable">httpResponse</span> <span class="operator">=</span> client.doAction(textScanRequest);</span><br><span class="line"> <span class="keyword">if</span> (httpResponse.isSuccess()) {</span><br><span class="line"> <span class="type">JSONObject</span> <span class="variable">scrResponse</span> <span class="operator">=</span> JSON.parseObject(<span class="keyword">new</span> <span class="title class_">String</span>(httpResponse.getHttpContent(), <span class="string">"UTF-8"</span>));</span><br><span class="line"> System.out.println(JSON.toJSONString(scrResponse, <span class="literal">true</span>));</span><br><span class="line"> <span class="keyword">if</span> (<span class="number">200</span> == scrResponse.getInteger(<span class="string">"code"</span>)) {</span><br><span class="line"> <span class="type">JSONArray</span> <span class="variable">taskResults</span> <span class="operator">=</span> scrResponse.getJSONArray(<span class="string">"data"</span>);</span><br><span class="line"> <span class="keyword">for</span> (Object taskResult : taskResults) {</span><br><span class="line"> <span class="keyword">if</span> (<span class="number">200</span> == ((JSONObject) taskResult).getInteger(<span class="string">"code"</span>)) {</span><br><span class="line"> <span class="type">JSONArray</span> <span class="variable">sceneResults</span> <span class="operator">=</span> ((JSONObject) taskResult).getJSONArray(<span class="string">"results"</span>);</span><br><span class="line"> <span class="keyword">for</span> (Object sceneResult : sceneResults) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">scene</span> <span class="operator">=</span> ((JSONObject) sceneResult).getString(<span class="string">"scene"</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">label</span> <span class="operator">=</span> ((JSONObject) sceneResult).getString(<span class="string">"label"</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">suggestion</span> <span class="operator">=</span> ((JSONObject) sceneResult).getString(<span class="string">"suggestion"</span>);</span><br><span class="line"> System.out.println(<span class="string">"suggestion = ["</span> + label + <span class="string">"]"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!suggestion.equals(<span class="string">"pass"</span>)) {</span><br><span class="line"> resultMap.put(<span class="string">"suggestion"</span>, suggestion);</span><br><span class="line"> resultMap.put(<span class="string">"label"</span>, label);</span><br><span class="line"> <span class="keyword">return</span> resultMap;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> resultMap.put(<span class="string">"suggestion"</span>, <span class="string">"pass"</span>);</span><br><span class="line"> <span class="keyword">return</span> resultMap;</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">catch</span> (ServerException e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> } <span class="keyword">catch</span> (ClientException e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3.在heima-leadnews-wemedia中的nacos配置中心添加以下配置</p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">aliyun:</span></span><br><span class="line"> <span class="attr">accessKeyId:</span> <span class="string">xxxxxxxxxxxxxxxxxxx</span></span><br><span class="line"> <span class="attr">secret:</span> <span class="string">xxxxxxxxxxxxxxxxxxxxxxxx</span></span><br><span class="line"><span class="comment">#aliyun.scenes=porn,terrorism,ad,qrcode,live,logo</span></span><br><span class="line"> <span class="attr">scenes:</span> <span class="string">terrorism</span> <span class="comment">#检测的场景</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>4.编写测试类测试</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> com.heima.common.aliyun.GreenImageScan;</span><br><span class="line"><span class="keyword">import</span> com.heima.common.aliyun.GreenTextScan;</span><br><span class="line"><span class="keyword">import</span> com.heima.file.service.FileStorageService;</span><br><span class="line"><span class="keyword">import</span> org.junit.Test;</span><br><span class="line"><span class="keyword">import</span> org.junit.runner.RunWith;</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.boot.test.context.SpringBootTest;</span><br><span class="line"><span class="keyword">import</span> org.springframework.test.context.junit4.SpringRunner;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Arrays;</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="meta">@SpringBootTest(classes = WemediaApplication.class)</span></span><br><span class="line"><span class="meta">@RunWith(SpringRunner.class)</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">AliyunTest</span> {</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> GreenTextScan greenTextScan;</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> GreenImageScan greenImageScan;</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> FileStorageService fileStorageService;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">testScanText</span><span class="params">()</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> <span class="type">Map</span> <span class="variable">map</span> <span class="operator">=</span> greenTextScan.greeTextScan(<span class="string">"我是一个好人,冰毒"</span>);</span><br><span class="line"> System.out.println(map);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">testScanImage</span><span class="params">()</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> <span class="type">byte</span>[] bytes = fileStorageService.downLoadFile(<span class="string">"http://192.168.200.130:9000/leadnews/2021/04/26/ef3cbe458db249f7bd6fb4339e593e55.jpg"</span>);</span><br><span class="line"> <span class="type">Map</span> <span class="variable">map</span> <span class="operator">=</span> greenImageScan.imageScan(Arrays.asList(bytes));</span><br><span class="line"> System.out.println(map);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="4-4-3-分布式ID的实现"><a href="#4-4-3-分布式ID的实现" class="headerlink" title="4.4.3 分布式ID的实现"></a>4.4.3 分布式ID的实现</h4><p>为什么使用分布式ID</p>
|
||
<p><img src="/pictures/image-20231116230439706.png" alt="image-20231116230439706"></p>
|
||
<p>分布式ID的技术选型</p>
|
||
<p><img src="/pictures/image-20231116230714014.png" alt="image-20231116230714014"></p>
|
||
<p>雪花算法的介绍</p>
|
||
<p><img src="/pictures/image-20231116230953909.png" alt="image-20231116230953909"></p>
|
||
<p>mybatis-plus已经集成了雪花算法,完成以下两步即可在项目中集成雪花算法</p>
|
||
<p>第一:在实体类中的id上加入如下配置,指定类型为id_worker</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@TableId(value = "id",type = IdType.ID_WORKER)</span></span><br><span class="line"><span class="keyword">private</span> Long id;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>第二:在application.yml文件中配置数据中心id和机器id</p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><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><br><span class="line"> <span class="comment"># 设置别名包扫描路径,通过该属性可以给包中的类注册别名</span></span><br><span class="line"> <span class="attr">type-aliases-package:</span> <span class="string">com.heima.model.article.pojos</span></span><br><span class="line"> <span class="attr">global-config:</span></span><br><span class="line"> <span class="attr">datacenter-id:</span> <span class="number">1</span></span><br><span class="line"> <span class="attr">workerId:</span> <span class="number">1</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>datacenter-id:数据中心id(取值范围:0-31) workerId:机器id(取值范围:0-31)</p>
|
||
<h4 id="4-4-4-审核功能的具体实现"><a href="#4-4-4-审核功能的具体实现" class="headerlink" title="4.4.4 审核功能的具体实现"></a>4.4.4 审核功能的具体实现</h4><p>由于没有阿里云相关的ak和sk,所以本部分默认每篇文章的文字和图片都审核通过(中间会注释掉调用第三方审核接口的代码)</p>
|
||
<p><img src="/pictures/image-20231202174634986.png" alt="image-20231202174634986"></p>
|
||
<p>service层代码实现</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.wemedia.service.impl;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.alibaba.fastjson.JSON;</span><br><span class="line"><span class="keyword">import</span> com.heima.apis.article.IArticleClient;</span><br><span class="line"><span class="keyword">import</span> com.heima.common.aliyun.GreenImageScan;</span><br><span class="line"><span class="keyword">import</span> com.heima.common.aliyun.GreenTextScan;</span><br><span class="line"><span class="keyword">import</span> com.heima.file.service.FileStorageService;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.article.dtos.ArticleDto;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.common.dtos.ResponseResult;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.wemedia.pojos.WmChannel;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.wemedia.pojos.WmNews;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.wemedia.pojos.WmUser;</span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.mapper.WmChannelMapper;</span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.mapper.WmNewsMapper;</span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.mapper.WmUserMapper;</span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.service.WmNewsAutoScanService;</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.apache.commons.lang.StringUtils;</span><br><span class="line"><span class="keyword">import</span> org.springframework.beans.BeanUtils;</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.stereotype.Service;</span><br><span class="line"><span class="keyword">import</span> org.springframework.transaction.annotation.Transactional;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.*;</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="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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/11/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">@Service</span></span><br><span class="line"><span class="meta">@Slf4j</span></span><br><span class="line"><span class="meta">@Transactional</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WmNewsAutoScanServiceImpl</span> <span class="keyword">implements</span> <span class="title class_">WmNewsAutoScanService</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">//涉及文本内容的审核,需要调用第三方的服务,这里我们直接设置成测试环境,跳过调用第三方服务校验的过程</span></span><br><span class="line"> <span class="meta">@Value("${check.env}")</span></span><br><span class="line"> <span class="keyword">private</span> String environment;</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> WmNewsMapper wmNewsMapper;</span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="keyword">private</span> GreenTextScan greenTextScan;</span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="keyword">private</span> GreenImageScan greenImageScan;</span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="keyword">private</span> FileStorageService fileStorageService;</span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="keyword">private</span> IArticleClient iArticleClient;</span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="keyword">private</span> WmChannelMapper wmChannelMapper;</span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="keyword">private</span> WmUserMapper wmUserMapper;</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> <span class="keyword">void</span> <span class="title function_">autoScanWmNews</span><span class="params">(Integer id)</span> {</span><br><span class="line"> <span class="comment">//1.查询自媒体文章的信息</span></span><br><span class="line"> <span class="type">WmNews</span> <span class="variable">wmNews</span> <span class="operator">=</span> wmNewsMapper.selectById(id);</span><br><span class="line"> <span class="comment">//文章不存在的话,直接抛出异常</span></span><br><span class="line"> <span class="keyword">if</span> (wmNews == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"文章不存在,无法审核!"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//判断文章是不是待审核的状态</span></span><br><span class="line"> <span class="keyword">if</span> (wmNews.getStatus().equals(WmNews.Status.SUBMIT.getCode())) {</span><br><span class="line"> <span class="comment">//2.抽取文章内容中的文字和图片信息</span></span><br><span class="line"> Map<String, Object> textAndImages = getTextAndImages(wmNews);</span><br><span class="line"> <span class="comment">//3.调用阿里云的接口实现文章的审核功能</span></span><br><span class="line"> <span class="comment">//审核文本内容</span></span><br><span class="line"> <span class="type">Boolean</span> <span class="variable">isPassText</span> <span class="operator">=</span> checkText((String) textAndImages.get(<span class="string">"content"</span>), wmNews);</span><br><span class="line"> <span class="keyword">if</span> (!isPassText) <span class="keyword">return</span>;</span><br><span class="line"> <span class="comment">//审核图片内容</span></span><br><span class="line"> <span class="type">Boolean</span> <span class="variable">isPassImage</span> <span class="operator">=</span> checkImages((List<String>) textAndImages.get(<span class="string">"images"</span>), wmNews);</span><br><span class="line"> <span class="keyword">if</span> (!isPassImage) <span class="keyword">return</span>;</span><br><span class="line"> <span class="comment">//4.审核成功,保存app端的相关文章数据</span></span><br><span class="line"> <span class="type">ResponseResult</span> <span class="variable">responseResult</span> <span class="operator">=</span> saveAppArticle(wmNews);</span><br><span class="line"> <span class="keyword">if</span> (!responseResult.getCode().equals(<span class="number">200</span>)) {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"文章审核-保存app端文章失败"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//回填article_id</span></span><br><span class="line"> wmNews.setArticleId((Long) responseResult.getData());</span><br><span class="line"> updateWmNews(wmNews, (<span class="type">short</span>) <span class="number">9</span>, <span class="string">"审核成功"</span>);</span><br><span class="line"> }</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"> * 保存app端的相关文章数据</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> wmNews 文章相关的信息</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> ResponseResult <span class="title function_">saveAppArticle</span><span class="params">(WmNews wmNews)</span> {</span><br><span class="line"> <span class="type">ArticleDto</span> <span class="variable">dto</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ArticleDto</span>();</span><br><span class="line"> BeanUtils.copyProperties(wmNews, dto);</span><br><span class="line"> <span class="comment">//文章布局</span></span><br><span class="line"> dto.setLayout(wmNews.getType());</span><br><span class="line"> <span class="comment">//频道</span></span><br><span class="line"> <span class="type">WmChannel</span> <span class="variable">wmChannel</span> <span class="operator">=</span> wmChannelMapper.selectById(wmNews.getChannelId());</span><br><span class="line"> <span class="keyword">if</span> (wmChannel != <span class="literal">null</span>) {</span><br><span class="line"> dto.setChannelName(wmChannel.getName());</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//作者</span></span><br><span class="line"> dto.setAuthorId(wmNews.getUserId().longValue());</span><br><span class="line"> <span class="type">WmUser</span> <span class="variable">wmUser</span> <span class="operator">=</span> wmUserMapper.selectById(wmNews.getUserId());</span><br><span class="line"> <span class="keyword">if</span> (wmUser != <span class="literal">null</span>) {</span><br><span class="line"> dto.setAuthorName(wmUser.getName());</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//设置文章的id</span></span><br><span class="line"> <span class="keyword">if</span> (wmNews.getArticleId() != <span class="literal">null</span>) {</span><br><span class="line"> dto.setId(wmNews.getArticleId());</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//设置创建时间</span></span><br><span class="line"> dto.setCreatedTime(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"> <span class="keyword">return</span> iArticleClient.saveArticle(dto);</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 class="doctag">@param</span> images 文章的图片信息</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> wmNews 文章实体</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> Boolean <span class="title function_">checkImages</span><span class="params">(List<String> images, WmNews wmNews)</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"> <span class="keyword">if</span> (images == <span class="literal">null</span> || images.size() == <span class="number">0</span> || <span class="string">"test"</span>.equals(environment)) {</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</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"> images = images.stream().distinct().collect(Collectors.toList());</span><br><span class="line"> <span class="comment">//创建集合,用于存储下载的图片</span></span><br><span class="line"> ArrayList<<span class="type">byte</span>[]> byteList = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> <span class="keyword">for</span> (String image : images) {</span><br><span class="line"> <span class="type">byte</span>[] bytes = fileStorageService.downLoadFile(image);</span><br><span class="line"> byteList.add(bytes);</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="keyword">try</span> {</span><br><span class="line"> <span class="comment">//调用阿里云的接口对文字进行审核</span></span><br><span class="line"> <span class="type">Map</span> <span class="variable">map</span> <span class="operator">=</span> greenImageScan.imageScan(byteList);</span><br><span class="line"> <span class="comment">//根据审核反馈的结果做出不同的处理</span></span><br><span class="line"> <span class="keyword">if</span> (map != <span class="literal">null</span>) {</span><br><span class="line"> <span class="comment">//审核失败</span></span><br><span class="line"> <span class="keyword">if</span> (map.get(<span class="string">"suggestion"</span>).equals(<span class="string">"block"</span>)) {</span><br><span class="line"> updateWmNews(wmNews, (<span class="type">short</span>) <span class="number">2</span>, <span class="string">"图片存在违规内容!"</span>);</span><br><span class="line"> flag = <span class="literal">false</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//不确定,需要人工审核</span></span><br><span class="line"> <span class="keyword">if</span> (map.get(<span class="string">"suggestion"</span>).equals(<span class="string">"review"</span>)) {</span><br><span class="line"> updateWmNews(wmNews, (<span class="type">short</span>) <span class="number">3</span>, <span class="string">"图片存在违规内容!"</span>);</span><br><span class="line"> flag = <span class="literal">false</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> flag = <span class="literal">false</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>(<span class="string">"图片审核时出现异常!"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> flag;</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 class="doctag">@param</span> content 文章的文字信息</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> wmNews 文章实体</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> Boolean <span class="title function_">checkText</span><span class="params">(String content, WmNews wmNews)</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"> <span class="keyword">if</span> ((content + wmNews.getTitle()).length() == <span class="number">0</span> || <span class="string">"test"</span>.equals(environment)) {</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//调用方法正式审核</span></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">//调用阿里云的接口对文字进行审核</span></span><br><span class="line"> <span class="type">Map</span> <span class="variable">map</span> <span class="operator">=</span> greenTextScan.greeTextScan(content);</span><br><span class="line"> <span class="comment">//根据审核反馈的结果做出不同的处理</span></span><br><span class="line"> <span class="keyword">if</span> (map != <span class="literal">null</span>) {</span><br><span class="line"> <span class="comment">//审核失败</span></span><br><span class="line"> <span class="keyword">if</span> (map.get(<span class="string">"suggestion"</span>).equals(<span class="string">"block"</span>)) {</span><br><span class="line"> updateWmNews(wmNews, (<span class="type">short</span>) <span class="number">2</span>, <span class="string">"文章中的文字信息出现违规内容!"</span>);</span><br><span class="line"> flag = <span class="literal">false</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//不确定,需要人工审核</span></span><br><span class="line"> <span class="keyword">if</span> (map.get(<span class="string">"suggestion"</span>).equals(<span class="string">"review"</span>)) {</span><br><span class="line"> updateWmNews(wmNews, (<span class="type">short</span>) <span class="number">3</span>, <span class="string">"文章中的文字信息在审核时有不确定的内容!"</span>);</span><br><span class="line"> flag = <span class="literal">false</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> flag = <span class="literal">false</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>(<span class="string">"文字审核时出现异常!"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> flag;</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 class="doctag">@param</span> wmNews 文章实体</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> status 文章的审核状态</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> reason 审核不通过的原因</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">updateWmNews</span><span class="params">(WmNews wmNews, <span class="type">short</span> status, String reason)</span> {</span><br><span class="line"> wmNews.setStatus(status);</span><br><span class="line"> wmNews.setReason(reason);</span><br><span class="line"> wmNewsMapper.updateById(wmNews);</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 class="doctag">@param</span> wmNews 文章</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> Map<String, Object> <span class="title function_">getTextAndImages</span><span class="params">(WmNews wmNews)</span> {</span><br><span class="line"> <span class="comment">//存储文字信息</span></span><br><span class="line"> <span class="type">StringBuilder</span> <span class="variable">stringBuilder</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">StringBuilder</span>();</span><br><span class="line"> <span class="comment">//文章中图片信息组成的集合</span></span><br><span class="line"> ArrayList<String> images = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> <span class="comment">//从文章中提取文字和图片信息</span></span><br><span class="line"> <span class="keyword">if</span> (StringUtils.isNotBlank(wmNews.getContent())) {</span><br><span class="line"> List<Map> maps = JSON.parseArray(wmNews.getContent(), Map.class);</span><br><span class="line"> <span class="keyword">for</span> (Map map : maps) {</span><br><span class="line"> <span class="keyword">if</span> (map.get(<span class="string">"type"</span>).equals(<span class="string">"text"</span>)) {</span><br><span class="line"> stringBuilder.append(map.get(<span class="string">"value"</span>));</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (map.get(<span class="string">"type"</span>).equals(<span class="string">"image"</span>)) {</span><br><span class="line"> images.add((String) map.get(<span class="string">"values"</span>));</span><br><span class="line"> }</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">if</span> (StringUtils.isNotBlank(wmNews.getImages())) {</span><br><span class="line"> String[] split = wmNews.getImages().split(<span class="string">","</span>);</span><br><span class="line"> images.addAll(Arrays.asList(split));</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//创建返回的结果</span></span><br><span class="line"> HashMap<String, Object> resultMap = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> resultMap.put(<span class="string">"content"</span>, stringBuilder.toString());</span><br><span class="line"> resultMap.put(<span class="string">"images"</span>, images);</span><br><span class="line"> <span class="keyword">return</span> resultMap;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>单元测试</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.wemedia.service;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.WemediaApplication;</span><br><span class="line"><span class="keyword">import</span> org.junit.Test;</span><br><span class="line"><span class="keyword">import</span> org.junit.runner.RunWith;</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.boot.test.context.SpringBootTest;</span><br><span class="line"><span class="keyword">import</span> org.springframework.test.context.junit4.SpringRunner;</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/12/2</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">@SpringBootTest(classes = WemediaApplication.class)</span></span><br><span class="line"><span class="meta">@RunWith(SpringRunner.class)</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WmNewsAutoScanServiceTest</span> {</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> WmNewsAutoScanService wmNewsAutoScanService;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">autoScanWmNews</span><span class="params">()</span> {</span><br><span class="line"> wmNewsAutoScanService.autoScanWmNews(<span class="number">3</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20231202232643073.png" alt="image-20231202232643073"></p>
|
||
<p>实现步骤:</p>
|
||
<p>①:在heima-leadnews-feign-api编写降级逻辑</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.apis.article.fallback;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.heima.apis.article.IArticleClient;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.article.dtos.ArticleDto;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.common.dtos.ResponseResult;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.common.enums.AppHttpCodeEnum;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Component;</span><br><span class="line"></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"> * <span class="doctag">@author</span> itheima</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Component</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">IArticleClientFallback</span> <span class="keyword">implements</span> <span class="title class_">IArticleClient</span> {</span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> ResponseResult <span class="title function_">saveArticle</span><span class="params">(ArticleDto dto)</span> {</span><br><span class="line"> <span class="keyword">return</span> ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR,<span class="string">"获取数据失败"</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>在自媒体微服务中添加类,扫描降级代码类的包</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.wemedia.config;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.context.annotation.ComponentScan;</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="meta">@Configuration</span></span><br><span class="line"><span class="meta">@ComponentScan("com.heima.apis.article.fallback")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">InitConfig</span> {</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>②:远程接口中指向降级代码</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.apis.article;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.heima.apis.article.fallback.IArticleClientFallback;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.article.dtos.ArticleDto;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.common.dtos.ResponseResult;</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.PostMapping;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RequestBody;</span><br><span class="line"></span><br><span class="line"><span class="meta">@FeignClient(value = "leadnews-article",fallback = IArticleClientFallback.class)</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">interface</span> <span class="title class_">IArticleClient</span> {</span><br><span class="line"></span><br><span class="line"> <span class="meta">@PostMapping("/api/v1/article/save")</span></span><br><span class="line"> <span class="keyword">public</span> ResponseResult <span class="title function_">saveArticle</span><span class="params">(<span class="meta">@RequestBody</span> ArticleDto dto)</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>③:客户端开启降级heima-leadnews-wemedia</p>
|
||
<p>在wemedia的nacos配置中心里添加如下内容,开启服务降级,也可以指定服务响应的超时的时间</p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">feign:</span></span><br><span class="line"> <span class="comment"># 开启feign对hystrix熔断降级的支持</span></span><br><span class="line"> <span class="attr">hystrix:</span></span><br><span class="line"> <span class="attr">enabled:</span> <span class="literal">true</span></span><br><span class="line"> <span class="comment"># 修改调用超时时间</span></span><br><span class="line"> <span class="attr">client:</span></span><br><span class="line"> <span class="attr">config:</span></span><br><span class="line"> <span class="attr">default:</span></span><br><span class="line"> <span class="attr">connectTimeout:</span> <span class="number">2000</span></span><br><span class="line"> <span class="attr">readTimeout:</span> <span class="number">2000</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>④:测试</p>
|
||
<p>在ApArticleServiceImpl类中saveArticle方法添加代码</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">try</span> {</span><br><span class="line"> Thread.sleep(<span class="number">3000</span>);</span><br><span class="line">} <span class="keyword">catch</span> (InterruptedException e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>在自媒体端进行审核测试,会出现服务降级的现象</p>
|
||
<h3 id="4-5-app端文章保存功能"><a href="#4-5-app端文章保存功能" class="headerlink" title="4.5 app端文章保存功能"></a>4.5 app端文章保存功能</h3><p><strong>实现思路</strong></p>
|
||
<p>在文章审核成功以后需要在app的article库中新增文章数据</p>
|
||
<p>1.保存文章信息 ap_article</p>
|
||
<p>2.保存文章配置信息 ap_article_config</p>
|
||
<p>3.保存文章内容 ap_article_content</p>
|
||
<p><img src="/pictures/image-20231117221219911.png" alt="image-20231117221219911"></p>
|
||
<p><strong>保存文章的接口</strong></p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th><strong>说明</strong></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>接口路径</td>
|
||
<td>/api/v1/article/save</td>
|
||
</tr>
|
||
<tr>
|
||
<td>请求方式</td>
|
||
<td>POST</td>
|
||
</tr>
|
||
<tr>
|
||
<td>参数</td>
|
||
<td>ArticleDto</td>
|
||
</tr>
|
||
<tr>
|
||
<td>响应结果</td>
|
||
<td>ResponseResult</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<p>ArticleDto</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.model.article.dtos;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.heima.model.article.pojos.ApArticle;</span><br><span class="line"><span class="keyword">import</span> lombok.Data;</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">class</span> <span class="title class_">ArticleDto</span> <span class="keyword">extends</span> <span class="title class_">ApArticle</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="keyword">private</span> String content;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>成功:</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"code"</span><span class="punctuation">:</span> <span class="number">200</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"errorMessage"</span> <span class="punctuation">:</span> <span class="string">"操作成功"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"data"</span><span class="punctuation">:</span><span class="string">"1302864436297442242"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>失败:</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"code"</span><span class="punctuation">:</span><span class="number">501</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"errorMessage"</span><span class="punctuation">:</span><span class="string">"参数失效"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"code"</span><span class="punctuation">:</span><span class="number">501</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"errorMessage"</span><span class="punctuation">:</span><span class="string">"文章没有找到"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>实现步骤</strong></p>
|
||
<p><img src="/pictures/image-20231117221333422.png" alt="image-20231117221333422"></p>
|
||
<p>功能实现:</p>
|
||
<p>①:在heima-leadnews- feign-api中新增接口</p>
|
||
<p>第一:线导入feign的依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-starter-openfeign<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>第二:定义文章端的接口</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line">package com.heima.apis.article;</span><br><span class="line"></span><br><span class="line">import com.heima.model.article.dtos.ArticleDto;</span><br><span class="line">import com.heima.model.common.dtos.ResponseResult;</span><br><span class="line">import org.springframework.cloud.openfeign.FeignClient;</span><br><span class="line">import org.springframework.web.bind.annotation.PostMapping;</span><br><span class="line">import org.springframework.web.bind.annotation.RequestBody;</span><br><span class="line"></span><br><span class="line">import java.io.IOException;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">@FeignClient(value = <span class="string">"leadnews-article"</span>)</span><br><span class="line">public interface IArticleClient <span class="punctuation">{</span></span><br><span class="line"></span><br><span class="line"> @PostMapping(<span class="string">"/api/v1/article/save"</span>)</span><br><span class="line"> public ResponseResult saveArticle(@RequestBody ArticleDto dto) ;</span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>②:在heima-leadnews-article中实现该方法</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.article.feign;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.heima.apis.article.IArticleClient;</span><br><span class="line"><span class="keyword">import</span> com.heima.article.service.ApArticleService;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.article.dtos.ArticleDto;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.common.dtos.ResponseResult;</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.web.bind.annotation.*;</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="meta">@RestController</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ArticleClient</span> <span class="keyword">implements</span> <span class="title class_">IArticleClient</span> {</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> ApArticleService apArticleService;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="meta">@PostMapping("/api/v1/article/save")</span></span><br><span class="line"> <span class="keyword">public</span> ResponseResult <span class="title function_">saveArticle</span><span class="params">(<span class="meta">@RequestBody</span> ArticleDto dto)</span> {</span><br><span class="line"> <span class="keyword">return</span> apArticleService.saveArticle(dto);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>③:拷贝mapper</p>
|
||
<p>在资料文件夹中拷贝ApArticleConfigMapper类到mapper文件夹中</p>
|
||
<p>同时,修改ApArticleConfig类,添加如下构造函数</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.model.article.pojos;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.IdType;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.TableField;</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 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.io.Serializable;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <p></span></span><br><span class="line"><span class="comment"> * APP已发布文章配置表</span></span><br><span class="line"><span class="comment"> * </p></span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> itheima</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"></span><br><span class="line"><span class="meta">@Data</span></span><br><span class="line"><span class="meta">@NoArgsConstructor</span></span><br><span class="line"><span class="meta">@TableName("ap_article_config")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ApArticleConfig</span> <span class="keyword">implements</span> <span class="title class_">Serializable</span> {</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="title function_">ApArticleConfig</span><span class="params">(Long articleId)</span>{</span><br><span class="line"> <span class="built_in">this</span>.articleId = articleId;</span><br><span class="line"> <span class="built_in">this</span>.isComment = <span class="literal">true</span>;</span><br><span class="line"> <span class="built_in">this</span>.isForward = <span class="literal">true</span>;</span><br><span class="line"> <span class="built_in">this</span>.isDelete = <span class="literal">false</span>;</span><br><span class="line"> <span class="built_in">this</span>.isDown = <span class="literal">false</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@TableId(value = "id",type = IdType.ID_WORKER)</span></span><br><span class="line"> <span class="keyword">private</span> Long id;</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">@TableField("article_id")</span></span><br><span class="line"> <span class="keyword">private</span> Long articleId;</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"> * true: 可以评论 1</span></span><br><span class="line"><span class="comment"> * false: 不可评论 0</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@TableField("is_comment")</span></span><br><span class="line"> <span class="keyword">private</span> Boolean isComment;</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"> * true: 可以转发 1</span></span><br><span class="line"><span class="comment"> * false: 不可转发 0</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@TableField("is_forward")</span></span><br><span class="line"> <span class="keyword">private</span> Boolean isForward;</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"> * true: 下架 1</span></span><br><span class="line"><span class="comment"> * false: 没有下架 0</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@TableField("is_down")</span></span><br><span class="line"> <span class="keyword">private</span> Boolean isDown;</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"> * true: 删除 1</span></span><br><span class="line"><span class="comment"> * false: 没有删除 0</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@TableField("is_delete")</span></span><br><span class="line"> <span class="keyword">private</span> Boolean isDelete;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>④:在ApArticleService中新增方法</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 保存app端相关文章</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> dto</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">ResponseResult <span class="title function_">saveArticle</span><span class="params">(ArticleDto dto)</span> ;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>实现类:</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Autowired</span></span><br><span class="line"><span class="keyword">private</span> ApArticleConfigMapper apArticleConfigMapper;</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> ApArticleContentMapper apArticleContentMapper;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 保存app端相关文章</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> dto</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> ResponseResult <span class="title function_">saveArticle</span><span class="params">(ArticleDto dto)</span> {</span><br><span class="line"> <span class="comment">//1.检查参数</span></span><br><span class="line"> <span class="keyword">if</span>(dto == <span class="literal">null</span>){</span><br><span class="line"> <span class="keyword">return</span> ResponseResult.errorResult(AppHttpCodeEnum.PARAM_INVALID);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="type">ApArticle</span> <span class="variable">apArticle</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ApArticle</span>();</span><br><span class="line"> BeanUtils.copyProperties(dto,apArticle);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//2.判断是否存在id</span></span><br><span class="line"> <span class="keyword">if</span>(dto.getId() == <span class="literal">null</span>){</span><br><span class="line"> <span class="comment">//2.1 不存在id 保存 文章 文章配置 文章内容</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">//保存文章</span></span><br><span class="line"> save(apArticle);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//保存配置</span></span><br><span class="line"> <span class="type">ApArticleConfig</span> <span class="variable">apArticleConfig</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ApArticleConfig</span>(apArticle.getId());</span><br><span class="line"> apArticleConfigMapper.insert(apArticleConfig);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//保存 文章内容</span></span><br><span class="line"> <span class="type">ApArticleContent</span> <span class="variable">apArticleContent</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ApArticleContent</span>();</span><br><span class="line"> apArticleContent.setArticleId(apArticle.getId());</span><br><span class="line"> apArticleContent.setContent(dto.getContent());</span><br><span class="line"> apArticleContentMapper.insert(apArticleContent);</span><br><span class="line"></span><br><span class="line"> }<span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">//2.2 存在id 修改 文章 文章内容</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">//修改 文章</span></span><br><span class="line"> updateById(apArticle);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//修改文章内容</span></span><br><span class="line"> <span class="type">ApArticleContent</span> <span class="variable">apArticleContent</span> <span class="operator">=</span> apArticleContentMapper.selectOne(Wrappers.<ApArticleContent>lambdaQuery().eq(ApArticleContent::getArticleId, dto.getId()));</span><br><span class="line"> apArticleContent.setContent(dto.getContent());</span><br><span class="line"> apArticleContentMapper.updateById(apArticleContent);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="comment">//3.结果返回 文章的id</span></span><br><span class="line"> <span class="keyword">return</span> ResponseResult.okResult(apArticle.getId());</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>⑤:测试</p>
|
||
<p>编写junit单元测试,或使用postman进行测试</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"title"</span><span class="punctuation">:</span><span class="string">"黑马头条项目背景"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"authoId"</span><span class="punctuation">:</span><span class="number">1102</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"layout"</span><span class="punctuation">:</span><span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"labels"</span><span class="punctuation">:</span><span class="string">"黑马头条"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"publishTime"</span><span class="punctuation">:</span><span class="string">"2028-03-14T11:35:49.000Z"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"images"</span><span class="punctuation">:</span> <span class="string">"http://192.168.200.130:9000/leadnews/2021/04/26/5ddbdb5c68094ce393b08a47860da275.jpg"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"content"</span><span class="punctuation">:</span><span class="string">"黑马头条项目背景,黑马头条项目背景,黑马头条项目背景,黑马头条项目背景,黑马头条项目背景"</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20231119212628556.png" alt="image-20231119212628556"></p>
|
||
<h3 id="4-6-发布文章提交审核集成"><a href="#4-6-发布文章提交审核集成" class="headerlink" title="4.6 发布文章提交审核集成"></a>4.6 发布文章提交审核集成</h3><h4 id="4-6-1-同步调用与异步调用"><a href="#4-6-1-同步调用与异步调用" class="headerlink" title="4.6.1 同步调用与异步调用"></a>4.6.1 同步调用与异步调用</h4><p><img src="/pictures/image-20231202234439362.png" alt="image-20231202234439362"></p>
|
||
<h4 id="4-6-2-Springboot集成异步线程调用"><a href="#4-6-2-Springboot集成异步线程调用" class="headerlink" title="4.6.2 Springboot集成异步线程调用"></a>4.6.2 Springboot集成异步线程调用</h4><p>①:在自动审核的方法上加上@Async注解(标明要异步调用)</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Override</span></span><br><span class="line"><span class="meta">@Async</span> <span class="comment">//标明当前方法是一个异步方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">autoScanWmNews</span><span class="params">(Integer id)</span> {</span><br><span class="line"> <span class="comment">//代码略</span></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>②:在文章发布成功后调用审核的方法</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Autowired</span></span><br><span class="line"><span class="keyword">private</span> WmNewsAutoScanService wmNewsAutoScanService;</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> dto</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> ResponseResult <span class="title function_">submitNews</span><span class="params">(WmNewsDto dto)</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">//代码略</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">//审核文章</span></span><br><span class="line"> wmNewsAutoScanService.autoScanWmNews(wmNews.getId());</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> ResponseResult.okResult(AppHttpCodeEnum.SUCCESS);</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>③:在自媒体引导类中使用@EnableAsync注解开启异步调用</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@SpringBootApplication</span></span><br><span class="line"><span class="meta">@EnableDiscoveryClient</span></span><br><span class="line"><span class="meta">@MapperScan("com.heima.wemedia.mapper")</span></span><br><span class="line"><span class="meta">@EnableFeignClients(basePackages = "com.heima.apis")</span></span><br><span class="line"><span class="meta">@EnableAsync</span> <span class="comment">//开启异步调用</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WemediaApplication</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> SpringApplication.run(WemediaApplication.class,args);</span><br><span class="line"> }</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> MybatisPlusInterceptor <span class="title function_">mybatisPlusInterceptor</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">MybatisPlusInterceptor</span> <span class="variable">interceptor</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">MybatisPlusInterceptor</span>();</span><br><span class="line"> interceptor.addInnerInterceptor(<span class="keyword">new</span> <span class="title class_">PaginationInnerInterceptor</span>(DbType.MYSQL));</span><br><span class="line"> <span class="keyword">return</span> interceptor;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-7-文章审核功能-综合测试"><a href="#4-7-文章审核功能-综合测试" class="headerlink" title="4.7 文章审核功能-综合测试"></a>4.7 文章审核功能-综合测试</h3><h4 id="4-7-1-服务启动列表"><a href="#4-7-1-服务启动列表" class="headerlink" title="4.7.1 服务启动列表"></a>4.7.1 服务启动列表</h4><p>1,nacos服务端</p>
|
||
<p>2,article微服务</p>
|
||
<p>3,wemedia微服务</p>
|
||
<p>4,启动wemedia网关微服务</p>
|
||
<p>5,启动前端系统wemedia</p>
|
||
<h4 id="4-7-2-测试情况列表"><a href="#4-7-2-测试情况列表" class="headerlink" title="4.7.2 测试情况列表"></a>4.7.2 测试情况列表</h4><p>1,自媒体前端发布一篇正常的文章</p>
|
||
<p> 审核成功后,app端的article相关数据是否可以正常保存,自媒体文章状态和app端文章id是否回显</p>
|
||
<p>2,自媒体前端发布一篇包含敏感词的文章</p>
|
||
<p> 正常是审核失败, wm_news表中的状态是否改变,成功和失败原因正常保存</p>
|
||
<p>3,自媒体前端发布一篇包含敏感图片的文章</p>
|
||
<p> 正常是审核失败, wm_news表中的状态是否改变,成功和失败原因正常保存</p>
|
||
<p><img src="/pictures/image-20231202235800149.png" alt="image-20231202235800149"></p>
|
||
<h3 id="4-8-自管理敏感词过滤"><a href="#4-8-自管理敏感词过滤" class="headerlink" title="4.8 自管理敏感词过滤"></a>4.8 自管理敏感词过滤</h3><h4 id="4-8-1-需求"><a href="#4-8-1-需求" class="headerlink" title="4.8.1 需求"></a>4.8.1 需求</h4><p><img src="/pictures/image-20231203000259877.png" alt="image-20231203000259877"></p>
|
||
<h4 id="4-8-2-可选方案"><a href="#4-8-2-可选方案" class="headerlink" title="4.8.2 可选方案"></a>4.8.2 可选方案</h4><table>
|
||
<thead>
|
||
<tr>
|
||
<th><strong>方案</strong></th>
|
||
<th><strong>说明</strong></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>数据库模糊查询</td>
|
||
<td>效率太低</td>
|
||
</tr>
|
||
<tr>
|
||
<td>String.indexOf(“”)查找</td>
|
||
<td>数据库量大的话也是比较慢</td>
|
||
</tr>
|
||
<tr>
|
||
<td>全文检索</td>
|
||
<td>分词再匹配</td>
|
||
</tr>
|
||
<tr>
|
||
<td>DFA算法</td>
|
||
<td>确定有穷自动机(一种数据结构)</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<h4 id="4-8-3-DFA算法"><a href="#4-8-3-DFA算法" class="headerlink" title="4.8.3 DFA算法"></a>4.8.3 DFA算法</h4><p><img src="/pictures/image-20231203130434677.png" alt="image-20231203130434677"></p>
|
||
<p><img src="/pictures/image-20231203130929391.png" alt="image-20231203130929391"></p>
|
||
<h4 id="4-8-4-工具类"><a href="#4-8-4-工具类" class="headerlink" title="4.8.4 工具类"></a>4.8.4 工具类</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.utils.common;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.*;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">SensitiveWordUtil</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> Map<String, Object> dictionaryMap = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</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 class="doctag">@param</span> words</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">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">initMap</span><span class="params">(Collection<String> words)</span> {</span><br><span class="line"> <span class="keyword">if</span> (words == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"敏感词列表不能为空"</span>);</span><br><span class="line"> <span class="keyword">return</span> ;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">// map初始长度words.size(),整个字典库的入口字数(小于words.size(),因为不同的词可能会有相同的首字)</span></span><br><span class="line"> Map<String, Object> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>(words.size());</span><br><span class="line"> <span class="comment">// 遍历过程中当前层次的数据</span></span><br><span class="line"> Map<String, Object> curMap = <span class="literal">null</span>;</span><br><span class="line"> Iterator<String> iterator = words.iterator();</span><br><span class="line"></span><br><span class="line"> <span class="keyword">while</span> (iterator.hasNext()) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">word</span> <span class="operator">=</span> iterator.next();</span><br><span class="line"> curMap = map;</span><br><span class="line"> <span class="type">int</span> <span class="variable">len</span> <span class="operator">=</span> word.length();</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span><span class="number">0</span>; i < len; i++) {</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.valueOf(word.charAt(i));</span><br><span class="line"> <span class="comment">// 当前字在当前层是否存在, 不存在则新建, 当前层数据指向下一个节点, 继续判断是否存在数据</span></span><br><span class="line"> Map<String, Object> wordMap = (Map<String, Object>) curMap.get(key);</span><br><span class="line"> <span class="keyword">if</span> (wordMap == <span class="literal">null</span>) {</span><br><span class="line"> <span class="comment">// 每个节点存在两个数据: 下一个节点和isEnd(是否结束标志)</span></span><br><span class="line"> wordMap = <span class="keyword">new</span> <span class="title class_">HashMap</span><>(<span class="number">2</span>);</span><br><span class="line"> wordMap.put(<span class="string">"isEnd"</span>, <span class="string">"0"</span>);</span><br><span class="line"> curMap.put(key, wordMap);</span><br><span class="line"> }</span><br><span class="line"> curMap = wordMap;</span><br><span class="line"> <span class="comment">// 如果当前字是词的最后一个字,则将isEnd标志置1</span></span><br><span class="line"> <span class="keyword">if</span> (i == len -<span class="number">1</span>) {</span><br><span class="line"> curMap.put(<span class="string">"isEnd"</span>, <span class="string">"1"</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> dictionaryMap = map;</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 class="doctag">@param</span> text</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> beginIndex</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> <span class="keyword">static</span> <span class="type">int</span> <span class="title function_">checkWord</span><span class="params">(String text, <span class="type">int</span> beginIndex)</span> {</span><br><span class="line"> <span class="keyword">if</span> (dictionaryMap == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"字典不能为空"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isEnd</span> <span class="operator">=</span> <span class="literal">false</span>;</span><br><span class="line"> <span class="type">int</span> <span class="variable">wordLength</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> Map<String, Object> curMap = dictionaryMap;</span><br><span class="line"> <span class="type">int</span> <span class="variable">len</span> <span class="operator">=</span> text.length();</span><br><span class="line"> <span class="comment">// 从文本的第beginIndex开始匹配</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> beginIndex; i < len; i++) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">key</span> <span class="operator">=</span> String.valueOf(text.charAt(i));</span><br><span class="line"> <span class="comment">// 获取当前key的下一个节点</span></span><br><span class="line"> curMap = (Map<String, Object>) curMap.get(key);</span><br><span class="line"> <span class="keyword">if</span> (curMap == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> wordLength ++;</span><br><span class="line"> <span class="keyword">if</span> (<span class="string">"1"</span>.equals(curMap.get(<span class="string">"isEnd"</span>))) {</span><br><span class="line"> isEnd = <span class="literal">true</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (!isEnd) {</span><br><span class="line"> wordLength = <span class="number">0</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> wordLength;</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 class="doctag">@param</span> text</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">public</span> <span class="keyword">static</span> Map<String, Integer> <span class="title function_">matchWords</span><span class="params">(String text)</span> {</span><br><span class="line"> Map<String, Integer> wordMap = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> <span class="type">int</span> <span class="variable">len</span> <span class="operator">=</span> text.length();</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < len; i++) {</span><br><span class="line"> <span class="type">int</span> <span class="variable">wordLength</span> <span class="operator">=</span> checkWord(text, i);</span><br><span class="line"> <span class="keyword">if</span> (wordLength > <span class="number">0</span>) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">word</span> <span class="operator">=</span> text.substring(i, i + wordLength);</span><br><span class="line"> <span class="comment">// 添加关键词匹配次数</span></span><br><span class="line"> <span class="keyword">if</span> (wordMap.containsKey(word)) {</span><br><span class="line"> wordMap.put(word, wordMap.get(word) + <span class="number">1</span>);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> wordMap.put(word, <span class="number">1</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> i += wordLength - <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> wordMap;</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">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> List<String> list = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> list.add(<span class="string">"法轮"</span>);</span><br><span class="line"> list.add(<span class="string">"法轮功"</span>);</span><br><span class="line"> list.add(<span class="string">"冰毒"</span>);</span><br><span class="line"> <span class="comment">//初始hua敏感词库</span></span><br><span class="line"> initMap(list);</span><br><span class="line"> String content=<span class="string">"我是一个好人,并不会卖冰毒,也不操练法轮功,我真的不卖冰毒"</span>;</span><br><span class="line"> Map<String, Integer> map = matchWords(content);</span><br><span class="line"> System.out.println(map);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="4-8-5-项目中集成自管理敏感词过滤"><a href="#4-8-5-项目中集成自管理敏感词过滤" class="headerlink" title="4.8.5 项目中集成自管理敏感词过滤"></a>4.8.5 项目中集成自管理敏感词过滤</h4><p>①:创建敏感词表,导入资料中wm_sensitive到leadnews_wemedia库中,并创建对应的实体类</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.model.wemedia.pojos;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.IdType;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.TableField;</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 class="keyword">import</span> lombok.Data;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.Serializable;</span><br><span class="line"><span class="keyword">import</span> java.util.Date;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <p></span></span><br><span class="line"><span class="comment"> * 敏感词信息表</span></span><br><span class="line"><span class="comment"> * </p></span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> itheima</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("wm_sensitive")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WmSensitive</span> <span class="keyword">implements</span> <span class="title class_">Serializable</span> {</span><br><span class="line"></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"> * 主键</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@TableId(value = "id", type = IdType.AUTO)</span></span><br><span class="line"> <span class="keyword">private</span> Integer id;</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">@TableField("sensitives")</span></span><br><span class="line"> <span class="keyword">private</span> String sensitives;</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">@TableField("created_time")</span></span><br><span class="line"> <span class="keyword">private</span> Date createdTime;</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>②:拷贝对应的wm_sensitive的mapper到项目中</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.wemedia.mapper;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.core.mapper.BaseMapper;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.wemedia.pojos.WmSensitive;</span><br><span class="line"><span class="keyword">import</span> org.apache.ibatis.annotations.Mapper;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="meta">@Mapper</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">interface</span> <span class="title class_">WmSensitiveMapper</span> <span class="keyword">extends</span> <span class="title class_">BaseMapper</span><WmSensitive> {</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>③:在文章审核的代码中添加自管理敏感词审核</p>
|
||
<p>第一:在WmNewsAutoScanServiceImpl中的autoScanWmNews方法上添加如下代码</p>
|
||
<figure class="highlight java"><table><tr><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><br><span class="line"><span class="comment">//自管理的敏感词过滤</span></span><br><span class="line"><span class="type">boolean</span> <span class="variable">isSensitive</span> <span class="operator">=</span> handleSensitiveScan((String) textAndImages.get(<span class="string">"content"</span>), wmNews);</span><br><span class="line"><span class="keyword">if</span>(!isSensitive) <span class="keyword">return</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">//2.审核文本内容 阿里云接口</span></span><br><span class="line"><span class="comment">//.....省略</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>新增自管理敏感词审核代码</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Autowired</span></span><br><span class="line"><span class="keyword">private</span> WmSensitiveMapper wmSensitiveMapper;</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> content</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> wmNews</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> <span class="type">boolean</span> <span class="title function_">handleSensitiveScan</span><span class="params">(String content, WmNews wmNews)</span> {</span><br><span class="line"></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"></span><br><span class="line"> <span class="comment">//获取所有的敏感词</span></span><br><span class="line"> List<WmSensitive> wmSensitives = wmSensitiveMapper.selectList(Wrappers.<WmSensitive>lambdaQuery().select(WmSensitive::getSensitives));</span><br><span class="line"> List<String> sensitiveList = wmSensitives.stream().map(WmSensitive::getSensitives).collect(Collectors.toList());</span><br><span class="line"></span><br><span class="line"> <span class="comment">//初始化敏感词库</span></span><br><span class="line"> SensitiveWordUtil.initMap(sensitiveList);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//查看文章中是否包含敏感词</span></span><br><span class="line"> Map<String, Integer> map = SensitiveWordUtil.matchWords(content);</span><br><span class="line"> <span class="keyword">if</span>(map.size() ><span class="number">0</span>){</span><br><span class="line"> updateWmNews(wmNews,(<span class="type">short</span>) <span class="number">2</span>,<span class="string">"当前文章中存在违规内容"</span>+map);</span><br><span class="line"> flag = <span class="literal">false</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> flag;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20231203161902523.png" alt="image-20231203161902523"></p>
|
||
<h3 id="4-9-图片识别文字审核敏感词"><a href="#4-9-图片识别文字审核敏感词" class="headerlink" title="4.9 图片识别文字审核敏感词"></a>4.9 图片识别文字审核敏感词</h3><p>详细教程: <a href="https://qingling.icu/posts/58456.html">https://qingling.icu/posts/58456.html</a></p>
|
||
<p>①:在heima-leadnews-common中创建工具类,简单封装一下tess4j</p>
|
||
<p>需要先导入pom</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>net.sourceforge.tess4j<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>tess4j<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>4.1.1<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>工具类</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.common.tess4j;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> lombok.Getter;</span><br><span class="line"><span class="keyword">import</span> lombok.Setter;</span><br><span class="line"><span class="keyword">import</span> net.sourceforge.tess4j.ITesseract;</span><br><span class="line"><span class="keyword">import</span> net.sourceforge.tess4j.Tesseract;</span><br><span class="line"><span class="keyword">import</span> net.sourceforge.tess4j.TesseractException;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.context.properties.ConfigurationProperties;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Component;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.awt.image.BufferedImage;</span><br><span class="line"></span><br><span class="line"><span class="meta">@Getter</span></span><br><span class="line"><span class="meta">@Setter</span></span><br><span class="line"><span class="meta">@Component</span></span><br><span class="line"><span class="meta">@ConfigurationProperties(prefix = "tess4j")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Tess4jClient</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String dataPath;</span><br><span class="line"> <span class="keyword">private</span> String language;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">doOCR</span><span class="params">(BufferedImage image)</span> <span class="keyword">throws</span> TesseractException {</span><br><span class="line"> <span class="comment">//创建Tesseract对象</span></span><br><span class="line"> <span class="type">ITesseract</span> <span class="variable">tesseract</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Tesseract</span>();</span><br><span class="line"> <span class="comment">//设置字体库路径</span></span><br><span class="line"> tesseract.setDatapath(dataPath);</span><br><span class="line"> <span class="comment">//中文识别</span></span><br><span class="line"> tesseract.setLanguage(language);</span><br><span class="line"> <span class="comment">//执行ocr识别</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">result</span> <span class="operator">=</span> tesseract.doOCR(image);</span><br><span class="line"> <span class="comment">//替换回车和tal键 使结果为一行</span></span><br><span class="line"> result = result.replaceAll(<span class="string">"\\r|\\n"</span>, <span class="string">"-"</span>).replaceAll(<span class="string">" "</span>, <span class="string">""</span>);</span><br><span class="line"> <span class="keyword">return</span> result;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>在spring.factories配置中添加该类,完整如下:</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line">org.springframework.boot.autoconfigure.EnableAutoConfiguration=\</span><br><span class="line"> com.heima.common.exception.ExceptionCatch,\</span><br><span class="line"> com.heima.common.swagger.SwaggerConfiguration,\</span><br><span class="line"> com.heima.common.swagger.Swagger2Configuration,\</span><br><span class="line"> com.heima.common.aliyun.GreenTextScan,\</span><br><span class="line"> com.heima.common.aliyun.GreenImageScan,\</span><br><span class="line"> com.heima.common.tess4j.Tess4jClient</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>②:在heima-leadnews-wemedia中的配置中添加两个属性</p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">tess4j:</span></span><br><span class="line"> <span class="attr">data-path:</span> <span class="string">D:\workspace\tessdata</span></span><br><span class="line"> <span class="attr">language:</span> <span class="string">chi_sim</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>③:在WmNewsAutoScanServiceImpl中的handleImageScan方法上添加如下代码</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">try</span> {</span><br><span class="line"> <span class="keyword">for</span> (String image : images) {</span><br><span class="line"> <span class="type">byte</span>[] bytes = fileStorageService.downLoadFile(image);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//图片识别文字审核---begin-----</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">//从byte[]转换为butteredImage</span></span><br><span class="line"> <span class="type">ByteArrayInputStream</span> <span class="variable">in</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ByteArrayInputStream</span>(bytes);</span><br><span class="line"> <span class="type">BufferedImage</span> <span class="variable">imageFile</span> <span class="operator">=</span> ImageIO.read(in);</span><br><span class="line"> <span class="comment">//识别图片的文字</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">result</span> <span class="operator">=</span> tess4jClient.doOCR(imageFile);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//审核是否包含自管理的敏感词</span></span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isSensitive</span> <span class="operator">=</span> handleSensitiveScan(result, wmNews);</span><br><span class="line"> <span class="keyword">if</span>(!isSensitive){</span><br><span class="line"> <span class="keyword">return</span> isSensitive;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//图片识别文字审核---end-----</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> imageList.add(bytes);</span><br><span class="line"></span><br><span class="line"> } </span><br><span class="line">}<span class="keyword">catch</span> (Exception e){</span><br><span class="line"> e.printStackTrace();</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>最后附上文章审核的完整代码如下:</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.wemedia.service.impl;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.alibaba.fastjson.JSONArray;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.core.toolkit.Wrappers;</span><br><span class="line"><span class="keyword">import</span> com.heima.apis.article.IArticleClient;</span><br><span class="line"><span class="keyword">import</span> com.heima.common.aliyun.GreenImageScan;</span><br><span class="line"><span class="keyword">import</span> com.heima.common.aliyun.GreenTextScan;</span><br><span class="line"><span class="keyword">import</span> com.heima.common.tess4j.Tess4jClient;</span><br><span class="line"><span class="keyword">import</span> com.heima.file.service.FileStorageService;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.article.dtos.ArticleDto;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.common.dtos.ResponseResult;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.wemedia.pojos.WmChannel;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.wemedia.pojos.WmNews;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.wemedia.pojos.WmSensitive;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.wemedia.pojos.WmUser;</span><br><span class="line"><span class="keyword">import</span> com.heima.utils.common.SensitiveWordUtil;</span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.mapper.WmChannelMapper;</span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.mapper.WmNewsMapper;</span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.mapper.WmSensitiveMapper;</span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.mapper.WmUserMapper;</span><br><span class="line"><span class="keyword">import</span> com.heima.wemedia.service.WmNewsAutoScanService;</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.apache.commons.lang3.StringUtils;</span><br><span class="line"><span class="keyword">import</span> org.springframework.beans.BeanUtils;</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.scheduling.annotation.Async;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Service;</span><br><span class="line"><span class="keyword">import</span> org.springframework.transaction.annotation.Transactional;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.imageio.ImageIO;</span><br><span class="line"><span class="keyword">import</span> java.awt.image.BufferedImage;</span><br><span class="line"><span class="keyword">import</span> java.io.ByteArrayInputStream;</span><br><span class="line"><span class="keyword">import</span> java.util.*;</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><br><span class="line"><span class="meta">@Service</span></span><br><span class="line"><span class="meta">@Slf4j</span></span><br><span class="line"><span class="meta">@Transactional</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WmNewsAutoScanServiceImpl</span> <span class="keyword">implements</span> <span class="title class_">WmNewsAutoScanService</span> {</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> WmNewsMapper wmNewsMapper;</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> 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="meta">@Async</span> <span class="comment">//标明当前方法是一个异步方法</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">autoScanWmNews</span><span class="params">(Integer id)</span> {</span><br><span class="line"></span><br><span class="line"><span class="comment">// int a = 1/0;</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">//1.查询自媒体文章</span></span><br><span class="line"> <span class="type">WmNews</span> <span class="variable">wmNews</span> <span class="operator">=</span> wmNewsMapper.selectById(id);</span><br><span class="line"> <span class="keyword">if</span> (wmNews == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"WmNewsAutoScanServiceImpl-文章不存在"</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span> (wmNews.getStatus().equals(WmNews.Status.SUBMIT.getCode())) {</span><br><span class="line"> <span class="comment">//从内容中提取纯文本内容和图片</span></span><br><span class="line"> Map<String, Object> textAndImages = handleTextAndImages(wmNews);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//自管理的敏感词过滤</span></span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isSensitive</span> <span class="operator">=</span> handleSensitiveScan((String) textAndImages.get(<span class="string">"content"</span>), wmNews);</span><br><span class="line"> <span class="keyword">if</span>(!isSensitive) <span class="keyword">return</span>;</span><br><span class="line"></span><br><span class="line"> <span class="comment">//2.审核文本内容 阿里云接口</span></span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isTextScan</span> <span class="operator">=</span> handleTextScan((String) textAndImages.get(<span class="string">"content"</span>), wmNews);</span><br><span class="line"> <span class="keyword">if</span> (!isTextScan) <span class="keyword">return</span>;</span><br><span class="line"></span><br><span class="line"> <span class="comment">//3.审核图片 阿里云接口</span></span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isImageScan</span> <span class="operator">=</span> handleImageScan((List<String>) textAndImages.get(<span class="string">"images"</span>), wmNews);</span><br><span class="line"> <span class="keyword">if</span> (!isImageScan) <span class="keyword">return</span>;</span><br><span class="line"></span><br><span class="line"> <span class="comment">//4.审核成功,保存app端的相关的文章数据</span></span><br><span class="line"> <span class="type">ResponseResult</span> <span class="variable">responseResult</span> <span class="operator">=</span> saveAppArticle(wmNews);</span><br><span class="line"> <span class="keyword">if</span> (!responseResult.getCode().equals(<span class="number">200</span>)) {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"WmNewsAutoScanServiceImpl-文章审核,保存app端相关文章数据失败"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//回填article_id</span></span><br><span class="line"> wmNews.setArticleId((Long) responseResult.getData());</span><br><span class="line"> updateWmNews(wmNews, (<span class="type">short</span>) <span class="number">9</span>, <span class="string">"审核成功"</span>);</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line"> }</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> WmSensitiveMapper wmSensitiveMapper;</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> content</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> wmNews</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> <span class="type">boolean</span> <span class="title function_">handleSensitiveScan</span><span class="params">(String content, WmNews wmNews)</span> {</span><br><span class="line"></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"></span><br><span class="line"> <span class="comment">//获取所有的敏感词</span></span><br><span class="line"> List<WmSensitive> wmSensitives = wmSensitiveMapper.selectList(Wrappers.<WmSensitive>lambdaQuery().select(WmSensitive::getSensitives));</span><br><span class="line"> List<String> sensitiveList = wmSensitives.stream().map(WmSensitive::getSensitives).collect(Collectors.toList());</span><br><span class="line"></span><br><span class="line"> <span class="comment">//初始化敏感词库</span></span><br><span class="line"> SensitiveWordUtil.initMap(sensitiveList);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//查看文章中是否包含敏感词</span></span><br><span class="line"> Map<String, Integer> map = SensitiveWordUtil.matchWords(content);</span><br><span class="line"> <span class="keyword">if</span>(map.size() ><span class="number">0</span>){</span><br><span class="line"> updateWmNews(wmNews,(<span class="type">short</span>) <span class="number">2</span>,<span class="string">"当前文章中存在违规内容"</span>+map);</span><br><span class="line"> flag = <span class="literal">false</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> flag;</span><br><span class="line"> }</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> IArticleClient articleClient;</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> WmChannelMapper wmChannelMapper;</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> WmUserMapper wmUserMapper;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 保存app端相关的文章数据</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> wmNews</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> ResponseResult <span class="title function_">saveAppArticle</span><span class="params">(WmNews wmNews)</span> {</span><br><span class="line"></span><br><span class="line"> <span class="type">ArticleDto</span> <span class="variable">dto</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ArticleDto</span>();</span><br><span class="line"> <span class="comment">//属性的拷贝</span></span><br><span class="line"> BeanUtils.copyProperties(wmNews, dto);</span><br><span class="line"> <span class="comment">//文章的布局</span></span><br><span class="line"> dto.setLayout(wmNews.getType());</span><br><span class="line"> <span class="comment">//频道</span></span><br><span class="line"> <span class="type">WmChannel</span> <span class="variable">wmChannel</span> <span class="operator">=</span> wmChannelMapper.selectById(wmNews.getChannelId());</span><br><span class="line"> <span class="keyword">if</span> (wmChannel != <span class="literal">null</span>) {</span><br><span class="line"> dto.setChannelName(wmChannel.getName());</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//作者</span></span><br><span class="line"> dto.setAuthorId(wmNews.getUserId().longValue());</span><br><span class="line"> <span class="type">WmUser</span> <span class="variable">wmUser</span> <span class="operator">=</span> wmUserMapper.selectById(wmNews.getUserId());</span><br><span class="line"> <span class="keyword">if</span> (wmUser != <span class="literal">null</span>) {</span><br><span class="line"> dto.setAuthorName(wmUser.getName());</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//设置文章id</span></span><br><span class="line"> <span class="keyword">if</span> (wmNews.getArticleId() != <span class="literal">null</span>) {</span><br><span class="line"> dto.setId(wmNews.getArticleId());</span><br><span class="line"> }</span><br><span class="line"> dto.setCreatedTime(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"></span><br><span class="line"> <span class="type">ResponseResult</span> <span class="variable">responseResult</span> <span class="operator">=</span> articleClient.saveArticle(dto);</span><br><span class="line"> <span class="keyword">return</span> responseResult;</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line"></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> FileStorageService fileStorageService;</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> GreenImageScan greenImageScan;</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> Tess4jClient tess4jClient;</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> images</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> wmNews</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> <span class="type">boolean</span> <span class="title function_">handleImageScan</span><span class="params">(List<String> images, WmNews wmNews)</span> {</span><br><span class="line"></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"></span><br><span class="line"> <span class="keyword">if</span> (images == <span class="literal">null</span> || images.size() == <span class="number">0</span>) {</span><br><span class="line"> <span class="keyword">return</span> flag;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//下载图片 minIO</span></span><br><span class="line"> <span class="comment">//图片去重</span></span><br><span class="line"> images = images.stream().distinct().collect(Collectors.toList());</span><br><span class="line"></span><br><span class="line"> List<<span class="type">byte</span>[]> imageList = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="keyword">for</span> (String image : images) {</span><br><span class="line"> <span class="type">byte</span>[] bytes = fileStorageService.downLoadFile(image);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//图片识别文字审核---begin-----</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">//从byte[]转换为butteredImage</span></span><br><span class="line"> <span class="type">ByteArrayInputStream</span> <span class="variable">in</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ByteArrayInputStream</span>(bytes);</span><br><span class="line"> <span class="type">BufferedImage</span> <span class="variable">imageFile</span> <span class="operator">=</span> ImageIO.read(in);</span><br><span class="line"> <span class="comment">//识别图片的文字</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">result</span> <span class="operator">=</span> tess4jClient.doOCR(imageFile);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//审核是否包含自管理的敏感词</span></span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isSensitive</span> <span class="operator">=</span> handleSensitiveScan(result, wmNews);</span><br><span class="line"> <span class="keyword">if</span>(!isSensitive){</span><br><span class="line"> <span class="keyword">return</span> isSensitive;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//图片识别文字审核---end-----</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> imageList.add(bytes);</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line"> }<span class="keyword">catch</span> (Exception e){</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</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">try</span> {</span><br><span class="line"> <span class="type">Map</span> <span class="variable">map</span> <span class="operator">=</span> greenImageScan.imageScan(imageList);</span><br><span class="line"> <span class="keyword">if</span> (map != <span class="literal">null</span>) {</span><br><span class="line"> <span class="comment">//审核失败</span></span><br><span class="line"> <span class="keyword">if</span> (map.get(<span class="string">"suggestion"</span>).equals(<span class="string">"block"</span>)) {</span><br><span class="line"> flag = <span class="literal">false</span>;</span><br><span class="line"> updateWmNews(wmNews, (<span class="type">short</span>) <span class="number">2</span>, <span class="string">"当前文章中存在违规内容"</span>);</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">if</span> (map.get(<span class="string">"suggestion"</span>).equals(<span class="string">"review"</span>)) {</span><br><span class="line"> flag = <span class="literal">false</span>;</span><br><span class="line"> updateWmNews(wmNews, (<span class="type">short</span>) <span class="number">3</span>, <span class="string">"当前文章中存在不确定内容"</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> flag = <span class="literal">false</span>;</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> flag;</span><br><span class="line"> }</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> GreenTextScan greenTextScan;</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> content</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> wmNews</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> <span class="type">boolean</span> <span class="title function_">handleTextScan</span><span class="params">(String content, WmNews wmNews)</span> {</span><br><span class="line"></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"></span><br><span class="line"> <span class="keyword">if</span> ((wmNews.getTitle() + <span class="string">"-"</span> + content).length() == <span class="number">0</span>) {</span><br><span class="line"> <span class="keyword">return</span> flag;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">Map</span> <span class="variable">map</span> <span class="operator">=</span> greenTextScan.greeTextScan((wmNews.getTitle() + <span class="string">"-"</span> + content));</span><br><span class="line"> <span class="keyword">if</span> (map != <span class="literal">null</span>) {</span><br><span class="line"> <span class="comment">//审核失败</span></span><br><span class="line"> <span class="keyword">if</span> (map.get(<span class="string">"suggestion"</span>).equals(<span class="string">"block"</span>)) {</span><br><span class="line"> flag = <span class="literal">false</span>;</span><br><span class="line"> updateWmNews(wmNews, (<span class="type">short</span>) <span class="number">2</span>, <span class="string">"当前文章中存在违规内容"</span>);</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">if</span> (map.get(<span class="string">"suggestion"</span>).equals(<span class="string">"review"</span>)) {</span><br><span class="line"> flag = <span class="literal">false</span>;</span><br><span class="line"> updateWmNews(wmNews, (<span class="type">short</span>) <span class="number">3</span>, <span class="string">"当前文章中存在不确定内容"</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> flag = <span class="literal">false</span>;</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> flag;</span><br><span class="line"></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 class="doctag">@param</span> wmNews</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> status</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> reason</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">void</span> <span class="title function_">updateWmNews</span><span class="params">(WmNews wmNews, <span class="type">short</span> status, String reason)</span> {</span><br><span class="line"> wmNews.setStatus(status);</span><br><span class="line"> wmNews.setReason(reason);</span><br><span class="line"> wmNewsMapper.updateById(wmNews);</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"> * 1。从自媒体文章的内容中提取文本和图片</span></span><br><span class="line"><span class="comment"> * 2.提取文章的封面图片</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> wmNews</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> Map<String, Object> <span class="title function_">handleTextAndImages</span><span class="params">(WmNews wmNews)</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">//存储纯文本内容</span></span><br><span class="line"> <span class="type">StringBuilder</span> <span class="variable">stringBuilder</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">StringBuilder</span>();</span><br><span class="line"></span><br><span class="line"> List<String> images = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"></span><br><span class="line"> <span class="comment">//1。从自媒体文章的内容中提取文本和图片</span></span><br><span class="line"> <span class="keyword">if</span> (StringUtils.isNotBlank(wmNews.getContent())) {</span><br><span class="line"> List<Map> maps = JSONArray.parseArray(wmNews.getContent(), Map.class);</span><br><span class="line"> <span class="keyword">for</span> (Map map : maps) {</span><br><span class="line"> <span class="keyword">if</span> (map.get(<span class="string">"type"</span>).equals(<span class="string">"text"</span>)) {</span><br><span class="line"> stringBuilder.append(map.get(<span class="string">"value"</span>));</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span> (map.get(<span class="string">"type"</span>).equals(<span class="string">"image"</span>)) {</span><br><span class="line"> images.add((String) map.get(<span class="string">"value"</span>));</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//2.提取文章的封面图片</span></span><br><span class="line"> <span class="keyword">if</span> (StringUtils.isNotBlank(wmNews.getImages())) {</span><br><span class="line"> String[] split = wmNews.getImages().split(<span class="string">","</span>);</span><br><span class="line"> images.addAll(Arrays.asList(split));</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> Map<String, Object> resultMap = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> resultMap.put(<span class="string">"content"</span>, stringBuilder.toString());</span><br><span class="line"> resultMap.put(<span class="string">"images"</span>, images);</span><br><span class="line"> <span class="keyword">return</span> resultMap;</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-10-文章详情-静态文件生成"><a href="#4-10-文章详情-静态文件生成" class="headerlink" title="4.10 文章详情-静态文件生成"></a>4.10 文章详情-静态文件生成</h3><p><img src="/pictures/image-20231209210352188.png" alt="image-20231209210352188"></p>
|
||
<p><strong>实现步骤</strong></p>
|
||
<p>1.新建ArticleFreemarkerService ,定义创建静态文件并上传到minIO中方法</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.article.service;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.heima.model.article.pojos.ApArticle;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">interface</span> <span class="title class_">ArticleFreemarkerService</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 生成静态文件上传到minIO中</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> apArticle</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> content</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">buildArticleToMinIO</span><span class="params">(ApArticle apArticle,String content)</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.article.service.Impl;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.alibaba.fastjson.JSONArray;</span><br><span class="line"><span class="keyword">import</span> com.heima.article.service.ApArticleService;</span><br><span class="line"><span class="keyword">import</span> com.heima.article.service.ArticleFreemarkerService;</span><br><span class="line"><span class="keyword">import</span> com.heima.file.service.FileStorageService;</span><br><span class="line"><span class="keyword">import</span> com.heima.model.article.pojos.ApArticle;</span><br><span class="line"><span class="keyword">import</span> freemarker.template.Configuration;</span><br><span class="line"><span class="keyword">import</span> freemarker.template.Template;</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.apache.commons.lang.StringUtils;</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.scheduling.annotation.Async;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Service;</span><br><span class="line"><span class="keyword">import</span> org.springframework.transaction.annotation.Transactional;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.ByteArrayInputStream;</span><br><span class="line"><span class="keyword">import</span> java.io.InputStream;</span><br><span class="line"><span class="keyword">import</span> java.io.StringWriter;</span><br><span class="line"><span class="keyword">import</span> java.util.HashMap;</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/12/9</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">@Service</span></span><br><span class="line"><span class="meta">@Slf4j</span></span><br><span class="line"><span class="meta">@Transactional</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ArticleFreemarkerServiceImpl</span> <span class="keyword">implements</span> <span class="title class_">ArticleFreemarkerService</span> {</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> Configuration configuration;</span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="keyword">private</span> FileStorageService fileStorageService;</span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="keyword">private</span> ApArticleService apArticleService;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Async</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> <span class="keyword">void</span> <span class="title function_">buildArticleToMinio</span><span class="params">(ApArticle apArticle, String content)</span> {</span><br><span class="line"> <span class="comment">//已知文章的id</span></span><br><span class="line"> <span class="comment">//1.获取文章的内容</span></span><br><span class="line"> <span class="keyword">if</span> (StringUtils.isNotBlank(content)) {</span><br><span class="line"> <span class="type">StringWriter</span> <span class="variable">out</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">StringWriter</span>();</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">//2.文章内容通过freemarker生成html文件 详细教程见:https://qingling.icu/posts/29367.html</span></span><br><span class="line"> <span class="type">Template</span> <span class="variable">template</span> <span class="operator">=</span> configuration.getTemplate(<span class="string">"article.ftl"</span>);</span><br><span class="line"> <span class="comment">//构建数据模型</span></span><br><span class="line"> HashMap<String, Object> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> map.put(<span class="string">"content"</span>, JSONArray.parseArray(content));</span><br><span class="line"> <span class="comment">//输出流</span></span><br><span class="line"> out = <span class="keyword">new</span> <span class="title class_">StringWriter</span>();</span><br><span class="line"> <span class="comment">//合成html文件</span></span><br><span class="line"> template.process(map, out);</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//3.把html文件上传到minio中</span></span><br><span class="line"> <span class="comment">//构建一个输入流</span></span><br><span class="line"> <span class="type">InputStream</span> <span class="variable">in</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ByteArrayInputStream</span>(out.toString().getBytes());</span><br><span class="line"> <span class="comment">//上传到minio并返回访问的路径</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">path</span> <span class="operator">=</span> fileStorageService.uploadHtmlFile(<span class="string">""</span>, apArticle.getId() + <span class="string">".html"</span>, in);</span><br><span class="line"> log.info(<span class="string">"文件在minio中的路径:"</span> + path);</span><br><span class="line"> <span class="comment">//4.修改ap_article表,保存static_url字段</span></span><br><span class="line"> apArticle.setStaticUrl(path);</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isSuccess</span> <span class="operator">=</span> apArticleService.updateById(apArticle);</span><br><span class="line"> log.info(isSuccess ? <span class="string">"文件上传成功"</span> : <span class="string">"文件上传失败"</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.在ApArticleService的saveArticle实现方法中添加调用生成文件的方法</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 保存app端相关文章</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> dto</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> ResponseResult <span class="title function_">saveArticle</span><span class="params">(ArticleDto dto)</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">// try {</span></span><br><span class="line"> <span class="comment">// Thread.sleep(3000);</span></span><br><span class="line"> <span class="comment">// } catch (InterruptedException e) {</span></span><br><span class="line"> <span class="comment">// e.printStackTrace();</span></span><br><span class="line"> <span class="comment">// }</span></span><br><span class="line"> <span class="comment">//1.检查参数</span></span><br><span class="line"> <span class="keyword">if</span>(dto == <span class="literal">null</span>){</span><br><span class="line"> <span class="keyword">return</span> ResponseResult.errorResult(AppHttpCodeEnum.PARAM_INVALID);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="type">ApArticle</span> <span class="variable">apArticle</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ApArticle</span>();</span><br><span class="line"> BeanUtils.copyProperties(dto,apArticle);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//2.判断是否存在id</span></span><br><span class="line"> <span class="keyword">if</span>(dto.getId() == <span class="literal">null</span>){</span><br><span class="line"> <span class="comment">//2.1 不存在id 保存 文章 文章配置 文章内容</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">//保存文章</span></span><br><span class="line"> save(apArticle);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//保存配置</span></span><br><span class="line"> <span class="type">ApArticleConfig</span> <span class="variable">apArticleConfig</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ApArticleConfig</span>(apArticle.getId());</span><br><span class="line"> apArticleConfigMapper.insert(apArticleConfig);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//保存 文章内容</span></span><br><span class="line"> <span class="type">ApArticleContent</span> <span class="variable">apArticleContent</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ApArticleContent</span>();</span><br><span class="line"> apArticleContent.setArticleId(apArticle.getId());</span><br><span class="line"> apArticleContent.setContent(dto.getContent());</span><br><span class="line"> apArticleContentMapper.insert(apArticleContent);</span><br><span class="line"></span><br><span class="line"> }<span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">//2.2 存在id 修改 文章 文章内容</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">//修改 文章</span></span><br><span class="line"> updateById(apArticle);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//修改文章内容</span></span><br><span class="line"> <span class="type">ApArticleContent</span> <span class="variable">apArticleContent</span> <span class="operator">=</span> apArticleContentMapper.selectOne(Wrappers.<ApArticleContent>lambdaQuery().eq(ApArticleContent::getArticleId, dto.getId()));</span><br><span class="line"> apArticleContent.setContent(dto.getContent());</span><br><span class="line"> apArticleContentMapper.updateById(apArticleContent);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//异步调用 生成静态文件上传到minio中</span></span><br><span class="line"> articleFreemarkerService.buildArticleToMinIO(apArticle,dto.getContent());</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="comment">//3.结果返回 文章的id</span></span><br><span class="line"> <span class="keyword">return</span> ResponseResult.okResult(apArticle.getId());</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3.文章微服务开启异步调用</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.article;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.DbType;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;</span><br><span class="line"><span class="keyword">import</span> org.mybatis.spring.annotation.MapperScan;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.SpringApplication;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.autoconfigure.SpringBootApplication;</span><br><span class="line"><span class="keyword">import</span> org.springframework.cloud.client.discovery.EnableDiscoveryClient;</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.scheduling.annotation.EnableAsync;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="meta">@SpringBootApplication</span></span><br><span class="line"><span class="meta">@EnableDiscoveryClient</span></span><br><span class="line"><span class="meta">@EnableAsync</span> <span class="comment">//开启异步调用</span></span><br><span class="line"><span class="meta">@MapperScan("com.heima.article.mapper")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ArticleApplication</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> SpringApplication.run(ArticleApplication.class,args);</span><br><span class="line"> }</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> MybatisPlusInterceptor <span class="title function_">mybatisPlusInterceptor</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">MybatisPlusInterceptor</span> <span class="variable">interceptor</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">MybatisPlusInterceptor</span>();</span><br><span class="line"> interceptor.addInnerInterceptor(<span class="keyword">new</span> <span class="title class_">PaginationInnerInterceptor</span>(DbType.MYSQL));</span><br><span class="line"> <span class="keyword">return</span> interceptor;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>测试</strong></p>
|
||
<p><img src="/pictures/image-20231209214205338.png" alt="image-20231209214205338"></p>
|
||
<p><img src="/pictures/image-20231209214309957.png" alt="image-20231209214309957"></p>
|
||
<h3 id="4-11-文章定时发布"><a href="#4-11-文章定时发布" class="headerlink" title="4.11 文章定时发布"></a>4.11 文章定时发布</h3>]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>项目实战</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>开源项目-若依框架</title>
|
||
<url>/posts/5293.html</url>
|
||
<content><![CDATA[<h1 id="一-若依简介"><a href="#一-若依简介" class="headerlink" title="一.若依简介"></a>一.若依简介</h1><p><strong>官网简介</strong></p>
|
||
<p>RuoYi 是一个后台管理系统,主要目的让开发者注重专注业务,降低技术难度,从而节省人力成本,缩短项目周期,提高软件安全质量。</p>
|
||
<p>单体版本技术栈:Spring Boot、Apache Shiro、MyBatis、Thymeleaf</p>
|
||
<p>前后端分离版本技术栈:SpringBoot、Spring Security、Jwt、Vue</p>
|
||
<p>微服务版本技术栈:Spring Boot、Spring Cloud & Alibaba</p>
|
||
<p><strong>相关网站</strong></p>
|
||
<ul>
|
||
<li>若依官网:<a href="http://ruoyi.vip/">http://ruoyi.vip(opens new window)</a></li>
|
||
<li>演示地址:<a href="http://demo.ruoyi.vip/">http://demo.ruoyi.vip(opens new window)</a></li>
|
||
<li>代码下载:<a href="https://gitee.com/y_project/RuoYi">https://gitee.com/y_project/RuoYi</a></li>
|
||
<li>文档地址:<a href="https://doc.ruoyi.vip/ruoyi/">https://doc.ruoyi.vip/ruoyi/</a></li>
|
||
</ul>
|
||
<p><strong>总结</strong></p>
|
||
<p>若依就是一个后台管理系统的通用模板,这个模板中包含了后台管理系统的常用功能,比如登录、权限管理、菜单管理、用户管理等,避免我们在开发中重复造轮子,让开发回归到业务本身。</p>
|
||
<h1 id="二-下载使用"><a href="#二-下载使用" class="headerlink" title="二.下载使用"></a>二.下载使用</h1><h2 id="1-前置环境"><a href="#1-前置环境" class="headerlink" title="1.前置环境"></a>1.前置环境</h2><p>后端:JDK、Maven、Mysql、Redis</p>
|
||
<p>前端:Node、Npm</p>
|
||
<h2 id="2-下载运行"><a href="#2-下载运行" class="headerlink" title="2.下载运行"></a>2.下载运行</h2><p>1.克隆命令</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">git clone https://gitee.com/y_project/RuoYi-Vue.git</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.使用Idea打开项目并初始化数据库脚本</p>
|
||
<blockquote>
|
||
<p>执行克隆的项目工程目录下sql目录中的两个sql文件初始化数据库</p>
|
||
</blockquote>
|
||
<p>3.修改Mysql和Redis的连接信息</p>
|
||
<blockquote>
|
||
<p>在application.yml中修改redis的连接信息,在application-druid.yml中修改mysql的连接信息</p>
|
||
<p>application.yml</p>
|
||
<p>application-druid.yml</p>
|
||
</blockquote>
|
||
<p>4.使用Vscode或者Idea打开前端项目并执行命令初始化前端项目</p>
|
||
<figure class="highlight shell"><table><tr><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><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">进入项目目录</span></span><br><span class="line">cd ruoyi-ui</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">npm install</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题</span></span><br><span class="line">npm install --registry=https://registry.npmmirror.com</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">npm run dev</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20240203135647790.png" alt="image-20240203135647790"></p>
|
||
<h1 id="三-项目功能实现逻辑"><a href="#三-项目功能实现逻辑" class="headerlink" title="三.项目功能实现逻辑"></a>三.项目功能实现逻辑</h1><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><p><strong>配置的原因是在前端解决跨域</strong></p>
|
||
<p>1.浏览器发送<code>http://localhost/prod-api/captchaImage</code> 请求</p>
|
||
<p>2.前端接收<code>http://localhost/prod-api/captchaImage</code> 请求,通过下面的配置重写url,然后再将请求发送给后端(通过<code>['^' + process.env.VUE_APP_BASE_API]: ''</code>配置将<code>http://localhost/prod-api/captchaImage</code>重写为<code>http://localhost:8080/captchaImage</code>)</p>
|
||
<p>该配置在<code>vue.config.js</code>配置文件中</p>
|
||
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line"><span class="attr">devServer</span>: {</span><br><span class="line"> <span class="attr">host</span>: <span class="string">'0.0.0.0'</span>,</span><br><span class="line"> <span class="attr">port</span>: port,</span><br><span class="line"> <span class="attr">open</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="attr">proxy</span>: {</span><br><span class="line"> <span class="comment">// detail: https://cli.vuejs.org/config/#devserver-proxy</span></span><br><span class="line"> [process.<span class="property">env</span>.<span class="property">VUE_APP_BASE_API</span>]: {</span><br><span class="line"> <span class="comment">//在这里我们我们可以把target修改为我们自己的后端服务地址</span></span><br><span class="line"> <span class="attr">target</span>: <span class="string">`http://localhost:8080`</span>,</span><br><span class="line"> <span class="attr">changeOrigin</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="attr">pathRewrite</span>: {</span><br><span class="line"> <span class="comment">//将VUE_APP_BASE_API(VUE_APP_BASE_API的值可能为dev-api、pood-api)置换为空,再在前面拼接target</span></span><br><span class="line"> [<span class="string">'^'</span> + process.<span class="property">env</span>.<span class="property">VUE_APP_BASE_API</span>]: <span class="string">''</span></span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> },</span><br><span class="line"> <span class="attr">disableHostCheck</span>: <span class="literal">true</span></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="2-登录功能"><a href="#2-登录功能" class="headerlink" title="2.登录功能"></a>2.登录功能</h2><p><img src="/pictures/image-20240203152609601.png" alt="image-20240203152609601"></p>
|
||
<p><strong>实现思路</strong></p>
|
||
<p>1.后端生成一个计算表达式 ,例如 1+1=?@2</p>
|
||
<p>2.然后将1+1=?以流的方式传递给前端,前端展示为图片,同时后端也会传递一个UUID给前端,这个UUID为就是<code>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</code>,2作为结果value值存入Redis中。存入Redis中的key的格式为<code>captcha_codes:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</code> </p>
|
||
<p>3.用户在填写完表单之后会携带账号、密码、验证码的结果值,以及之前后端传递给前端的UUID值给后端,后端会先以<code>captcha_codes:+UUID</code>作为key在reidis中查找value值,再和前端输入的验证码结果值作比较,如果验证码相同再比较账号密码,账号密码在数据库中也可以匹配上就登录成功,反之返回给前端账号密码错误;如果验证码不相同,直接返回给前端,验证码错误。</p>
|
||
<p><strong>代码实现</strong></p>
|
||
<p>1.前端在页面初始化或者刷新验证码的时候会调用下面的方法获取验证码和UUID值</p>
|
||
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line"><span class="title function_">getCode</span>(<span class="params"></span>) {</span><br><span class="line"> <span class="title function_">getCodeImg</span>().<span class="title function_">then</span>(<span class="function"><span class="params">res</span> =></span> {</span><br><span class="line"> <span class="variable language_">this</span>.<span class="property">captchaEnabled</span> = res.<span class="property">captchaEnabled</span> === <span class="literal">undefined</span> ? <span class="literal">true</span> : res.<span class="property">captchaEnabled</span>;</span><br><span class="line"> <span class="keyword">if</span> (<span class="variable language_">this</span>.<span class="property">captchaEnabled</span>) {</span><br><span class="line"> <span class="variable language_">this</span>.<span class="property">codeUrl</span> = <span class="string">"data:image/gif;base64,"</span> + res.<span class="property">img</span>;</span><br><span class="line"> <span class="variable language_">this</span>.<span class="property">loginForm</span>.<span class="property">uuid</span> = res.<span class="property">uuid</span>;</span><br><span class="line"> }</span><br><span class="line"> });</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.后端生成验证码的过程</p>
|
||
<figure class="highlight java"><table><tr><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("/captchaImage")</span></span><br><span class="line"><span class="keyword">public</span> AjaxResult <span class="title function_">getCode</span><span class="params">(HttpServletResponse response)</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="comment">//创建一个ajax的返回值对象</span></span><br><span class="line"> <span class="type">AjaxResult</span> <span class="variable">ajax</span> <span class="operator">=</span> AjaxResult.success();</span><br><span class="line"> </span><br><span class="line"> <span class="comment">//判断是否开启的验证码功能</span></span><br><span class="line"> <span class="type">boolean</span> <span class="variable">captchaEnabled</span> <span class="operator">=</span> configService.selectCaptchaEnabled();</span><br><span class="line"> ajax.put(<span class="string">"captchaEnabled"</span>, captchaEnabled);</span><br><span class="line"> <span class="keyword">if</span> (!captchaEnabled) {</span><br><span class="line"> <span class="keyword">return</span> ajax;</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">//获取uui</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">uuid</span> <span class="operator">=</span> IdUtils.simpleUUID();</span><br><span class="line"> <span class="comment">//生成验证码的key值</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">verifyKey</span> <span class="operator">=</span> CacheConstants.CAPTCHA_CODE_KEY + uuid;</span><br><span class="line"></span><br><span class="line"> <span class="type">String</span> <span class="variable">capStr</span> <span class="operator">=</span> <span class="literal">null</span>, code = <span class="literal">null</span>;</span><br><span class="line"> <span class="type">BufferedImage</span> <span class="variable">image</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"></span><br><span class="line"> <span class="comment">// 生成验证码</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">captchaType</span> <span class="operator">=</span> RuoYiConfig.getCaptchaType();</span><br><span class="line"> <span class="keyword">if</span> (<span class="string">"math"</span>.equals(captchaType)) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">capText</span> <span class="operator">=</span> captchaProducerMath.createText();</span><br><span class="line"> capStr = capText.substring(<span class="number">0</span>, capText.lastIndexOf(<span class="string">"@"</span>));</span><br><span class="line"> code = capText.substring(capText.lastIndexOf(<span class="string">"@"</span>) + <span class="number">1</span>);</span><br><span class="line"> image = captchaProducerMath.createImage(capStr);</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (<span class="string">"char"</span>.equals(captchaType)) {</span><br><span class="line"> capStr = code = captchaProducer.createText();</span><br><span class="line"> image = captchaProducer.createImage(capStr);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);</span><br><span class="line"> <span class="comment">// 转换流信息写出</span></span><br><span class="line"> <span class="type">FastByteArrayOutputStream</span> <span class="variable">os</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">FastByteArrayOutputStream</span>();</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> ImageIO.write(image, <span class="string">"jpg"</span>, os);</span><br><span class="line"> } <span class="keyword">catch</span> (IOException e) {</span><br><span class="line"> <span class="keyword">return</span> AjaxResult.error(e.getMessage());</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> ajax.put(<span class="string">"uuid"</span>, uuid);</span><br><span class="line"> ajax.put(<span class="string">"img"</span>, Base64.encode(os.toByteArray()));</span><br><span class="line"> <span class="keyword">return</span> ajax;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3.前端登录提交的表单和处理登录的方法</p>
|
||
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line"><span class="title function_">data</span>(<span class="params"></span>) {</span><br><span class="line"> <span class="keyword">return</span> {</span><br><span class="line"> <span class="comment">//验证码图片的链接</span></span><br><span class="line"> <span class="attr">codeUrl</span>: <span class="string">""</span>,</span><br><span class="line"> <span class="comment">//登录提交的表单信息</span></span><br><span class="line"> <span class="attr">loginForm</span>: {</span><br><span class="line"> <span class="comment">//用户名</span></span><br><span class="line"> <span class="attr">username</span>: <span class="string">"admin"</span>,</span><br><span class="line"> <span class="comment">//密码</span></span><br><span class="line"> <span class="attr">password</span>: <span class="string">"admin123"</span>,</span><br><span class="line"> <span class="comment">//是否记住密码</span></span><br><span class="line"> <span class="attr">rememberMe</span>: <span class="literal">false</span>,</span><br><span class="line"> <span class="comment">//验证码结果值</span></span><br><span class="line"> <span class="attr">code</span>: <span class="string">""</span>,</span><br><span class="line"> <span class="comment">//uuid值</span></span><br><span class="line"> <span class="attr">uuid</span>: <span class="string">""</span></span><br><span class="line"> }</span><br><span class="line"> };</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line"><span class="title function_">handleLogin</span>(<span class="params"></span>) {</span><br><span class="line"> <span class="variable language_">this</span>.<span class="property">$refs</span>.<span class="property">loginForm</span>.<span class="title function_">validate</span>(<span class="function"><span class="params">valid</span> =></span> {</span><br><span class="line"> <span class="keyword">if</span> (valid) {</span><br><span class="line"> <span class="variable language_">this</span>.<span class="property">loading</span> = <span class="literal">true</span>;</span><br><span class="line"> <span class="keyword">if</span> (<span class="variable language_">this</span>.<span class="property">loginForm</span>.<span class="property">rememberMe</span>) {</span><br><span class="line"> <span class="title class_">Cookies</span>.<span class="title function_">set</span>(<span class="string">"username"</span>, <span class="variable language_">this</span>.<span class="property">loginForm</span>.<span class="property">username</span>, { <span class="attr">expires</span>: <span class="number">30</span> });</span><br><span class="line"> <span class="title class_">Cookies</span>.<span class="title function_">set</span>(<span class="string">"password"</span>, <span class="title function_">encrypt</span>(<span class="variable language_">this</span>.<span class="property">loginForm</span>.<span class="property">password</span>), { <span class="attr">expires</span>: <span class="number">30</span> });</span><br><span class="line"> <span class="title class_">Cookies</span>.<span class="title function_">set</span>(<span class="string">'rememberMe'</span>, <span class="variable language_">this</span>.<span class="property">loginForm</span>.<span class="property">rememberMe</span>, { <span class="attr">expires</span>: <span class="number">30</span> });</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="title class_">Cookies</span>.<span class="title function_">remove</span>(<span class="string">"username"</span>);</span><br><span class="line"> <span class="title class_">Cookies</span>.<span class="title function_">remove</span>(<span class="string">"password"</span>);</span><br><span class="line"> <span class="title class_">Cookies</span>.<span class="title function_">remove</span>(<span class="string">'rememberMe'</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="variable language_">this</span>.<span class="property">$store</span>.<span class="title function_">dispatch</span>(<span class="string">"Login"</span>, <span class="variable language_">this</span>.<span class="property">loginForm</span>).<span class="title function_">then</span>(<span class="function">() =></span> {</span><br><span class="line"> <span class="variable language_">this</span>.<span class="property">$router</span>.<span class="title function_">push</span>({ <span class="attr">path</span>: <span class="variable language_">this</span>.<span class="property">redirect</span> || <span class="string">"/"</span> }).<span class="title function_">catch</span>(<span class="function">()=></span>{});</span><br><span class="line"> }).<span class="title function_">catch</span>(<span class="function">() =></span> {</span><br><span class="line"> <span class="variable language_">this</span>.<span class="property">loading</span> = <span class="literal">false</span>;</span><br><span class="line"> <span class="keyword">if</span> (<span class="variable language_">this</span>.<span class="property">captchaEnabled</span>) {</span><br><span class="line"> <span class="variable language_">this</span>.<span class="title function_">getCode</span>();</span><br><span class="line"> }</span><br><span class="line"> });</span><br><span class="line"> }</span><br><span class="line"> });</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>4.后端登录的实现逻辑</p>
|
||
]]></content>
|
||
<categories>
|
||
<category>开源项目</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>若依</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>免费好用的PDF工具</title>
|
||
<url>/posts/40733.html</url>
|
||
<content><![CDATA[<h1 id="一-PDFgear"><a href="#一-PDFgear" class="headerlink" title="一.PDFgear"></a>一.PDFgear</h1><blockquote>
|
||
<p>免费、无需登录注册、支持编辑和PDF与格式文件的相互转换!</p>
|
||
</blockquote>
|
||
<h2 id="1-下载地址"><a href="#1-下载地址" class="headerlink" title="1.下载地址"></a>1.下载地址</h2><p>官网地址:<a href="https://www.pdfgear.com/zh/">https://www.pdfgear.com/zh/</a></p>
|
||
<p><img src="/pictures/image-20240113151450334.png" alt="image-20240113151450334"></p>
|
||
<h2 id="2-介绍"><a href="#2-介绍" class="headerlink" title="2.介绍"></a>2.介绍</h2><p>无需登录,无需付费、支持PDF与其他格式的文件的相互转化、拆分合并PDF、压缩PDF、OCR文字识别</p>
|
||
<p><img src="/pictures/image-20240113151556929.png" alt="image-20240113151556929"></p>
|
||
<p><img src="/pictures/image-20240113151834234.png" alt="image-20240113151834234"></p>
|
||
<h1 id="二-stiring-pdf"><a href="#二-stiring-pdf" class="headerlink" title="二.stiring-pdf"></a>二.stiring-pdf</h1><blockquote>
|
||
<p>github开源,需要自己使用Docker部署!</p>
|
||
</blockquote>
|
||
<p>github仓库地址:<a href="https://github.com/Stirling-Tools/Stirling-PDF">https://github.com/Stirling-Tools/Stirling-PDF</a></p>
|
||
<p><img src="/pictures/stirling-home.png" alt="stirling-home.png"></p>
|
||
<p>部署命令</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">docker run -d \</span><br><span class="line"> -p 8080:8080 \</span><br><span class="line"> -v /location/of/trainingData:/usr/share/tesseract-ocr/5/tessdata \</span><br><span class="line"> -v /location/of/extraConfigs:/configs \</span><br><span class="line"> -v /location/of/logs:/logs \</span><br><span class="line"> -e DOCKER_ENABLE_SECURITY=false \</span><br><span class="line"> --name stirling-pdf \</span><br><span class="line"> frooodle/s-pdf:latest</span><br></pre></td></tr></table></figure>
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>常用工具</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>PDF</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>Linux运维管理面板-1Panel</title>
|
||
<url>/posts/56106.html</url>
|
||
<content><![CDATA[<h1 id="一-官方文档"><a href="#一-官方文档" class="headerlink" title="一.官方文档"></a>一.官方文档</h1><p><strong>官网:</strong><a href="https://1panel.cn/">1Panel - 现代化、开源的 Linux 服务器运维管理面板</a></p>
|
||
<p><strong>官方文档:</strong><a href="https://1panel.cn/docs/">1Panel 文档</a></p>
|
||
<div class="note success flat"><p>1Panel是飞致云旗下的一款现代化、开源的 Linux 服务器运维管理面板</p>
|
||
</div>
|
||
|
||
<h1 id="二-安装教程"><a href="#二-安装教程" class="headerlink" title="二.安装教程"></a>二.安装教程</h1><p><strong>详细安装教程见官方文档:</strong><a href="https://1panel.cn/docs/installation/online_installation/">在线安装 - 1Panel 文档</a></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">linux命令一键安装并启动</span></span><br><span class="line">curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && sh quick_start.sh</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>安装成功后浏览器访问<code>http://目标服务器 IP 地址:目标端口/安全入口</code>进入运维面板(安装成功后根据命令行返回链接和密码信息访问并登录面板即可)</p>
|
||
<p><img src="/pictures/image-20240101201242287.png" alt="image-20240101201242287"></p>
|
||
<h1 id="三-常用工具"><a href="#三-常用工具" class="headerlink" title="三.常用工具"></a>三.常用工具</h1><h2 id="1-Fail2ban"><a href="#1-Fail2ban" class="headerlink" title="1.Fail2ban"></a>1.Fail2ban</h2><p><strong>简介</strong></p>
|
||
<p>Fail2Ban 是一款入侵防御软件,可以保护服务器免受暴力攻击。 它是用 Python 编程语言编写的。 Fail2Ban 基于auth 日志文件工作,默认情况下它会扫描所有 auth 日志文件,如 /var/log/auth.log、/var/log/apache/access.log 等,并禁止带有恶意标志的IP,比如密码失败太多,寻找漏洞等等标志。通常,Fail2Ban 用于更新防火墙规则,用于在指定的时间内拒绝 IP 地址。 它也会发送邮件通知。 Fail2Ban 为各种服务提供了许多过滤器,如 ssh、apache、nginx、squid、named、mysql、nagios 等。(简单来说就是避免别人暴力破解服务器的连接账号密码信息,入侵服务器)</p>
|
||
<p><strong>安装</strong></p>
|
||
<p><strong>详细教程:</strong> <a href="https://1panel.cn/docs/user_manual/toolbox/fail2ban/">Fail2ban - 1Panel 文档</a></p>
|
||
<p>1、安装 epel 源</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">yum install -y epel-release</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2、安装 Fail2ban</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">yum install -y fail2ban</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3、启动 Fail2ban 服务</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">systemctl start fail2ban</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>4、开机自启动</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">systemctl enable fail2ban</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>5、查看 Fail2ban 服务状态</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">systemctl status fail2ban</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>默认配置</strong> (后续自定义的配置直接在运维面板中更改即可)</p>
|
||
<figure class="highlight properties"><table><tr><td class="code"><pre><span class="line"><span class="comment">#DEFAULT-START</span></span><br><span class="line"><span class="attr">[DEFAULT]</span></span><br><span class="line"><span class="attr">bantime</span> = <span class="string">600</span></span><br><span class="line"><span class="attr">findtime</span> = <span class="string">300</span></span><br><span class="line"><span class="attr">maxretry</span> = <span class="string">5</span></span><br><span class="line"><span class="attr">banaction</span> = <span class="string">firewallcmd-ipset</span></span><br><span class="line"><span class="attr">action</span> = <span class="string">%(action_mwl)s</span></span><br><span class="line"><span class="comment">#DEFAULT-END</span></span><br><span class="line"></span><br><span class="line"><span class="attr">[sshd]</span></span><br><span class="line"><span class="attr">ignoreip</span> = <span class="string">127.0.0.1/8 # 白名单</span></span><br><span class="line"><span class="attr">enabled</span> = <span class="string">true</span></span><br><span class="line"><span class="attr">filter</span> = <span class="string">sshd</span></span><br><span class="line"><span class="attr">port</span> = <span class="string">22 # 端口</span></span><br><span class="line"><span class="attr">maxretry</span> = <span class="string">2 # 最大尝试次数</span></span><br><span class="line"><span class="attr">findtime</span> = <span class="string">300 # 发现周期 单位s [在findtime(300秒)周期内尝试次数超过maxretry(2)次,就 #加入黑名单</span></span><br><span class="line"><span class="attr">bantime</span> = <span class="string">600 # 封禁时间,单位s。-1为永久封禁</span></span><br><span class="line"><span class="attr">action</span> = <span class="string">%(action_mwl)s</span></span><br><span class="line"><span class="attr">banaction</span> = <span class="string">iptables-multiport # 禁用方式</span></span><br><span class="line"><span class="attr">logpath</span> = <span class="string">/var/log/secure # SSH 登陆日志位置</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>验证</strong></p>
|
||
<p><img src="/pictures/image-20240101195315281.png" alt="image-20240101195315281"></p>
|
||
<p><img src="/pictures/image-20240101195455038.png" alt="image-20240101195455038"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>运维</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>1Panel</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>OCR-图片文字识别</title>
|
||
<url>/posts/58456.html</url>
|
||
<content><![CDATA[<h2 id="一-什么是OCR"><a href="#一-什么是OCR" class="headerlink" title="一.什么是OCR"></a>一.什么是OCR</h2><p>OCR (Optical Character Recognition,光学字符识别)是指电子设备(例如扫描仪或数码相机)检查纸上打印的字符,通过检测暗、亮的模式确定其形状,然后用字符识别方法将形状翻译成计算机文字的过程</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th><strong>方案</strong></th>
|
||
<th><strong>说明</strong></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>百度OCR</td>
|
||
<td>收费</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Tesseract-OCR</td>
|
||
<td>Google维护的开源OCR引擎,支持Java,Python等语言调用</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Tess4J</td>
|
||
<td>封装了Tesseract-OCR ,支持Java调用</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<h2 id="二-Tesseract-OCR-的特点"><a href="#二-Tesseract-OCR-的特点" class="headerlink" title="二.Tesseract-OCR 的特点"></a>二.Tesseract-OCR 的特点</h2><ul>
|
||
<li><p>Tesseract支持UTF-8编码格式,并且可以“开箱即用”地识别100多种语言</p>
|
||
</li>
|
||
<li><p>Tesseract支持多种输出格式:纯文本,hOCR(HTML),PDF等</p>
|
||
</li>
|
||
<li><p>官方建议,为了获得更好的OCR结果,最好提供给高质量的图像</p>
|
||
</li>
|
||
<li><p>Tesseract进行识别其他语言的训练,具体的训练方式请参考官方提供的文档:<a href="https://tesseract-ocr.github.io/tessdoc/">https://tesseract-ocr.github.io/tessdoc/</a></p>
|
||
</li>
|
||
</ul>
|
||
<h2 id="三-使用案例"><a href="#三-使用案例" class="headerlink" title="三.使用案例"></a>三.使用案例</h2><h3 id="1-导入相关的依赖"><a href="#1-导入相关的依赖" class="headerlink" title="1.导入相关的依赖"></a>1.导入相关的依赖</h3><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>net.sourceforge.tess4j<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>tess4j<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>4.1.1<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-导入中文字体库"><a href="#2-导入中文字体库" class="headerlink" title="2.导入中文字体库"></a>2.导入中文字体库</h3><p>地址: <a href="https://wwvc.lanzouj.com/iuPhc1h7j46f">https://wwvc.lanzouj.com/iuPhc1h7j46f</a></p>
|
||
<blockquote>
|
||
<p>chi_sim.traineddata</p>
|
||
</blockquote>
|
||
<p><img src="/pictures/image-20231208212352206.png" alt="image-20231208212352206"></p>
|
||
<h3 id="3-编写测试类进行测试"><a href="#3-编写测试类进行测试" class="headerlink" title="3.编写测试类进行测试"></a>3.编写测试类进行测试</h3><p><strong>待识别的图片</strong></p>
|
||
<p><img src="/pictures/image-20231208205943762.png" alt="image-20231208205943762"></p>
|
||
<p><strong>测试程序</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> net.sourceforge.tess4j.Tesseract;</span><br><span class="line"><span class="keyword">import</span> net.sourceforge.tess4j.TesseractException;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.File;</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/12/8</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">class</span> <span class="title class_">Main</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="comment"> * <span class="doctag">@param</span> args</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> TesseractException {</span><br><span class="line"> <span class="comment">//创建实例</span></span><br><span class="line"> <span class="type">Tesseract</span> <span class="variable">tesseract</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Tesseract</span>();</span><br><span class="line"> <span class="comment">//设置字体库的路径</span></span><br><span class="line"> tesseract.setDatapath(<span class="string">"C:\\Gong\\data\\tess4j"</span>);</span><br><span class="line"> <span class="comment">//设置语言</span></span><br><span class="line"> <span class="comment">//字体库为chi_sim.traineddata,语言取.前面的内容,即文件名</span></span><br><span class="line"> <span class="comment">//简体中文</span></span><br><span class="line"> tesseract.setLanguage(<span class="string">"chi_sim"</span>);</span><br><span class="line"> <span class="comment">//识别图片</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">ocr</span> <span class="operator">=</span> tesseract.doOCR(<span class="keyword">new</span> <span class="title class_">File</span>(<span class="string">"C:\\Gong\\data\\tess4j\\tess4j.png"</span>));</span><br><span class="line"> <span class="comment">//打印识别的结果</span></span><br><span class="line"> <span class="comment">//打印的时候可以去除回车和tab空格</span></span><br><span class="line"> <span class="comment">//System.out.println(ocr.replaceAll("\\n|\\r","-"));</span></span><br><span class="line"> System.out.println(ocr);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>识别的结果</strong></p>
|
||
<p><img src="/pictures/image-20231208211200859.png" alt="image-20231208211200859"></p>
|
||
<h2 id="四-封装成工具类使用"><a href="#四-封装成工具类使用" class="headerlink" title="四.封装成工具类使用"></a>四.封装成工具类使用</h2><h3 id="1-创建工具类"><a href="#1-创建工具类" class="headerlink" title="1.创建工具类"></a>1.创建工具类</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.common.tess4j;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> lombok.Getter;</span><br><span class="line"><span class="keyword">import</span> lombok.Setter;</span><br><span class="line"><span class="keyword">import</span> net.sourceforge.tess4j.ITesseract;</span><br><span class="line"><span class="keyword">import</span> net.sourceforge.tess4j.Tesseract;</span><br><span class="line"><span class="keyword">import</span> net.sourceforge.tess4j.TesseractException;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.context.properties.ConfigurationProperties;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Component;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.awt.image.BufferedImage;</span><br><span class="line"></span><br><span class="line"><span class="meta">@Getter</span></span><br><span class="line"><span class="meta">@Setter</span></span><br><span class="line"><span class="meta">@Component</span></span><br><span class="line"><span class="meta">@ConfigurationProperties(prefix = "tess4j")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Tess4jClient</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String dataPath;</span><br><span class="line"> <span class="keyword">private</span> String language;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">doOCR</span><span class="params">(BufferedImage image)</span> <span class="keyword">throws</span> TesseractException {</span><br><span class="line"> <span class="comment">//创建Tesseract对象</span></span><br><span class="line"> <span class="type">ITesseract</span> <span class="variable">tesseract</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Tesseract</span>();</span><br><span class="line"> <span class="comment">//设置字体库路径</span></span><br><span class="line"> tesseract.setDatapath(dataPath);</span><br><span class="line"> <span class="comment">//中文识别</span></span><br><span class="line"> tesseract.setLanguage(language);</span><br><span class="line"> <span class="comment">//执行ocr识别</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">result</span> <span class="operator">=</span> tesseract.doOCR(image);</span><br><span class="line"> <span class="comment">//替换回车和tal键 使结果为一行</span></span><br><span class="line"> result = result.replaceAll(<span class="string">"\\r|\\n"</span>, <span class="string">"-"</span>).replaceAll(<span class="string">" "</span>, <span class="string">""</span>);</span><br><span class="line"> <span class="keyword">return</span> result;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-配置文件中添加配置"><a href="#2-配置文件中添加配置" class="headerlink" title="2.配置文件中添加配置"></a>2.配置文件中添加配置</h3><figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">tess4j:</span></span><br><span class="line"> <span class="attr">data-path:</span> <span class="string">C:\workspace\tessdata</span> <span class="comment"># 字体库的路径</span></span><br><span class="line"> <span class="attr">language:</span> <span class="string">chi_sim</span> <span class="comment"># 识别的字体d</span></span><br></pre></td></tr></table></figure>
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>OCR</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>DFA算法实现敏感词自管理</title>
|
||
<url>/posts/28101.html</url>
|
||
<content><![CDATA[<h2 id="一-需求分析"><a href="#一-需求分析" class="headerlink" title="一.需求分析"></a>一.需求分析</h2><p> 在审核文本内容的时候,我们可以调用第三方成熟的服务(例如阿里云的内容安全)来实现,但是基于不同的场景,第三方的服务不可能涉及到方方面面的敏感词,比如在游戏类的场景中,开挂一词算敏感词,但是在其它的场景中,开挂一词是一个正常的词汇。这时候需要我们根据不同场景自己维护一套敏感词,在文本审核的时候,需要验证文本中是否包含这些敏感词。</p>
|
||
<h2 id="二-可选方案"><a href="#二-可选方案" class="headerlink" title="二.可选方案"></a>二.可选方案</h2><table>
|
||
<thead>
|
||
<tr>
|
||
<th><strong>方案</strong></th>
|
||
<th><strong>说明</strong></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>数据库模糊查询</td>
|
||
<td>效率太低</td>
|
||
</tr>
|
||
<tr>
|
||
<td>String.indexOf(“”)查找</td>
|
||
<td>数据库量大的话也是比较慢</td>
|
||
</tr>
|
||
<tr>
|
||
<td>全文检索</td>
|
||
<td>分词再匹配</td>
|
||
</tr>
|
||
<tr>
|
||
<td>DFA算法</td>
|
||
<td>确定有穷自动机(一种数据结构)</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<h2 id="三-DFA算法"><a href="#三-DFA算法" class="headerlink" title="三. DFA算法"></a>三. DFA算法</h2><h3 id="1-简介"><a href="#1-简介" class="headerlink" title="1.简介"></a>1.简介</h3><p>DFA全称为:Deterministic Finite Automaton,即确定有穷自动机。</p>
|
||
<p>存储:一次性的把所有的敏感词存储到了多个map中,就是下图表示这种结构</p>
|
||
<p>敏感词:冰毒、大麻、大坏蛋</p>
|
||
<p><img src="/pictures/image-20231203134106231.png" alt="image-20231203134106231"></p>
|
||
<h3 id="2-检索过程"><a href="#2-检索过程" class="headerlink" title="2.检索过程"></a>2.检索过程</h3><p><img src="/pictures/image-20231203134335076.png" alt="image-20231203134335076"></p>
|
||
<h2 id="四-工具类"><a href="#四-工具类" class="headerlink" title="四.工具类"></a>四.工具类</h2><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.utils.common;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.*;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">SensitiveWordUtil</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> Map<String, Object> dictionaryMap = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</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 class="doctag">@param</span> words</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">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">initMap</span><span class="params">(Collection<String> words)</span> {</span><br><span class="line"> <span class="keyword">if</span> (words == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"敏感词列表不能为空"</span>);</span><br><span class="line"> <span class="keyword">return</span> ;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">// map初始长度words.size(),整个字典库的入口字数(小于words.size(),因为不同的词可能会有相同的首字)</span></span><br><span class="line"> Map<String, Object> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>(words.size());</span><br><span class="line"> <span class="comment">// 遍历过程中当前层次的数据</span></span><br><span class="line"> Map<String, Object> curMap = <span class="literal">null</span>;</span><br><span class="line"> Iterator<String> iterator = words.iterator();</span><br><span class="line"></span><br><span class="line"> <span class="keyword">while</span> (iterator.hasNext()) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">word</span> <span class="operator">=</span> iterator.next();</span><br><span class="line"> curMap = map;</span><br><span class="line"> <span class="type">int</span> <span class="variable">len</span> <span class="operator">=</span> word.length();</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span><span class="number">0</span>; i < len; i++) {</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.valueOf(word.charAt(i));</span><br><span class="line"> <span class="comment">// 当前字在当前层是否存在, 不存在则新建, 当前层数据指向下一个节点, 继续判断是否存在数据</span></span><br><span class="line"> Map<String, Object> wordMap = (Map<String, Object>) curMap.get(key);</span><br><span class="line"> <span class="keyword">if</span> (wordMap == <span class="literal">null</span>) {</span><br><span class="line"> <span class="comment">// 每个节点存在两个数据: 下一个节点和isEnd(是否结束标志)</span></span><br><span class="line"> wordMap = <span class="keyword">new</span> <span class="title class_">HashMap</span><>(<span class="number">2</span>);</span><br><span class="line"> wordMap.put(<span class="string">"isEnd"</span>, <span class="string">"0"</span>);</span><br><span class="line"> curMap.put(key, wordMap);</span><br><span class="line"> }</span><br><span class="line"> curMap = wordMap;</span><br><span class="line"> <span class="comment">// 如果当前字是词的最后一个字,则将isEnd标志置1</span></span><br><span class="line"> <span class="keyword">if</span> (i == len -<span class="number">1</span>) {</span><br><span class="line"> curMap.put(<span class="string">"isEnd"</span>, <span class="string">"1"</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> dictionaryMap = map;</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 class="doctag">@param</span> text</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> beginIndex</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> <span class="keyword">static</span> <span class="type">int</span> <span class="title function_">checkWord</span><span class="params">(String text, <span class="type">int</span> beginIndex)</span> {</span><br><span class="line"> <span class="keyword">if</span> (dictionaryMap == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"字典不能为空"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isEnd</span> <span class="operator">=</span> <span class="literal">false</span>;</span><br><span class="line"> <span class="type">int</span> <span class="variable">wordLength</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> Map<String, Object> curMap = dictionaryMap;</span><br><span class="line"> <span class="type">int</span> <span class="variable">len</span> <span class="operator">=</span> text.length();</span><br><span class="line"> <span class="comment">// 从文本的第beginIndex开始匹配</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> beginIndex; i < len; i++) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">key</span> <span class="operator">=</span> String.valueOf(text.charAt(i));</span><br><span class="line"> <span class="comment">// 获取当前key的下一个节点</span></span><br><span class="line"> curMap = (Map<String, Object>) curMap.get(key);</span><br><span class="line"> <span class="keyword">if</span> (curMap == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> wordLength ++;</span><br><span class="line"> <span class="keyword">if</span> (<span class="string">"1"</span>.equals(curMap.get(<span class="string">"isEnd"</span>))) {</span><br><span class="line"> isEnd = <span class="literal">true</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (!isEnd) {</span><br><span class="line"> wordLength = <span class="number">0</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> wordLength;</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 class="doctag">@param</span> text</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">public</span> <span class="keyword">static</span> Map<String, Integer> <span class="title function_">matchWords</span><span class="params">(String text)</span> {</span><br><span class="line"> Map<String, Integer> wordMap = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> <span class="type">int</span> <span class="variable">len</span> <span class="operator">=</span> text.length();</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < len; i++) {</span><br><span class="line"> <span class="type">int</span> <span class="variable">wordLength</span> <span class="operator">=</span> checkWord(text, i);</span><br><span class="line"> <span class="keyword">if</span> (wordLength > <span class="number">0</span>) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">word</span> <span class="operator">=</span> text.substring(i, i + wordLength);</span><br><span class="line"> <span class="comment">// 添加关键词匹配次数</span></span><br><span class="line"> <span class="keyword">if</span> (wordMap.containsKey(word)) {</span><br><span class="line"> wordMap.put(word, wordMap.get(word) + <span class="number">1</span>);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> wordMap.put(word, <span class="number">1</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> i += wordLength - <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> wordMap;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> List<String> list = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> list.add(<span class="string">"法轮"</span>);</span><br><span class="line"> list.add(<span class="string">"法轮功"</span>);</span><br><span class="line"> list.add(<span class="string">"冰毒"</span>);</span><br><span class="line"> <span class="comment">//初始化敏感词库</span></span><br><span class="line"> initMap(list);</span><br><span class="line"> String content=<span class="string">"我是一个好人,并不会卖冰毒,也不操练法轮功,我真的不卖冰毒"</span>;</span><br><span class="line"> Map<String, Integer> map = matchWords(content);</span><br><span class="line"> System.out.println(map);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>结果:</strong></p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">{冰毒=2, 法轮功=1}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>最佳实践:</strong> <a href="https://qingling.icu/posts/64695.html">项目实战-黑马头条 | The Blog (qingling.icu)</a></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>DFA</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>特殊符号大全</title>
|
||
<url>/posts/12367.html</url>
|
||
<content><![CDATA[<h4 id="中文字符"><a href="#中文字符" class="headerlink" title="中文字符"></a>中文字符</h4><p>零壹贰叁肆伍陆柒捌玖拾佰仟万亿吉太拍艾分厘毫微卍卐卄巜弍弎弐朤氺曱甴囍兀々〆のぁ〡〢〣〤〥〦〧〨〩㊎㊍㊌㊋㊏㊚㊛㊐㊊㊣㊤㊥㊦㊧㊨㊒㊫㊑㊓㊔㊕㊖㊗㊘㊜㊝㊞㊟㊠㊡㊢㊩㊪㊬㊭㊮㊯㊰㊀㊁㊂㊃㊄㊅㊆㊇㊈㊉</p>
|
||
<h4 id="常用特殊符号"><a href="#常用特殊符号" class="headerlink" title="常用特殊符号"></a>常用特殊符号</h4><p>❤❥웃유♋☮✌☏☢☠✔☑♚▲♪✈✞÷↑↓◆◇⊙■□△▽¿─│♥❣♂♀☿Ⓐ✍✉☣☤✘☒♛▼♫⌘☪≈←→◈◎☉★☆⊿※¡━┃♡ღツ☼☁❅♒✎©®™Σ✪✯☭➳卐√↖↗●◐Θ◤◥︻〖〗┄┆℃℉°✿ϟ☃☂✄¢€£∞✫★½✡×↙↘○◑⊕◣◢︼【】┅┇☽☾✚〓▂▃▄▅▆▇█▉▊▋▌▍▎▏↔↕☽☾の•▸◂▴▾┈┊①②③④⑤⑥⑦⑧⑨⑩ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ㍿▓♨♛❖♓☪✙┉┋☹☺☻تヅツッシÜϡﭢ™℠℗©®♥❤❥❣❦❧♡۵웃유ღ♋♂♀☿☼☀☁☂☄☾☽❄☃☈⊙☉℃℉❅✺ϟ☇♤♧♡♢♠♣♥♦☜☞☝✍☚☛☟✌✽✾✿❁❃❋❀⚘☑✓✔√☐☒✗✘ㄨ✕✖✖⋆✢✣✤✥❋✦✧✩✰✪✫✬✭✮✯❂✡★✱✲✳✴✵✶✷✸✹✺✻✼❄❅❆❇❈❉❊†☨✞✝☥☦☓☩☯☧☬☸✡♁✙♆。,、':∶;?‘’“”〝〞ˆˇ﹕︰﹔﹖﹑•¨….¸;!´?!~—ˉ|‖"〃`@﹫¡¿﹏﹋﹌︴々﹟#﹩$﹠&﹪%*﹡﹢﹦﹤‐ ̄¯―﹨ˆ˜﹍﹎+=<__-\ˇ~﹉﹊()〈〉‹›﹛﹜『』〖〗[]《》〔〕{}「」【】︵︷︿︹︽_﹁﹃︻︶︸﹀︺︾ˉ﹂﹄︼☩☨☦✞✛✜✝✙✠✚†‡◉○◌◍◎●◐◑◒◓◔◕◖◗❂☢⊗⊙◘◙◍⅟½⅓⅕⅙⅛⅔⅖⅚⅜¾⅗⅝⅞⅘≂≃≄≅≆≇≈≉≊≋≌≍≎≏≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≠≡≢≣≤≥≦≧≨≩⊰⊱⋛⋚∫∬∭∮∯∰∱∲∳%℅‰‱㊣㊎㊍㊌㊋㊏㊐㊊㊚㊛㊤㊥㊦㊧㊨㊒㊞㊑㊒㊓㊔㊕㊖㊗㊘㊜㊝㊟㊠㊡㊢㊩㊪㊫㊬㊭㊮㊯㊰㊙㉿囍♔♕♖♗♘♙♚♛♜♝♞♟ℂℍℕℙℚℝℤℬℰℯℱℊℋℎℐℒℓℳℴ℘ℛℭ℮ℌℑℜℨ♪♫♩♬♭♮♯°øⒶ☮✌☪✡☭✯卐✐✎✏✑✒✍✉✁✂✃✄✆✉☎☏➟➡➢➣➤➥➦➧➨➚➘➙➛➜➝➞➸♐➲➳⏎➴➵➶➷➸➹➺➻➼➽←↑→↓↔↕↖↗↘↙↚↛↜↝↞↟↠↡↢↣↤↥↦↧↨➫➬➩➪➭➮➯➱↩↪↫↬↭↮↯↰↱↲↳↴↵↶↷↸↹↺↻↼↽↾↿⇀⇁⇂⇃⇄⇅⇆⇇⇈⇉⇊⇋⇌⇍⇎⇏⇐⇑⇒⇓⇔⇕⇖⇗⇘⇙⇚⇛⇜⇝⇞⇟⇠⇡⇢⇣⇤⇥⇦⇧⇨⇩⇪➀➁➂➃➄➅➆➇➈➉➊➋➌➍➎➏➐➑➒➓㊀㊁㊂㊃㊄㊅㊆㊇㊈㊉ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅬⅭⅮⅯⅰⅱⅲⅳⅴⅵⅶⅷⅸⅹⅺⅻⅼⅽⅾⅿ┌┍┎┏┐┑┒┓└┕┖┗┘┙┚┛├┝┞┟┠┡┢┣┤┥┦┧┨┩┪┫┬┭┮┯┰┱┲┳┴┵┶┷┸┹┺┻┼┽┾┿╀╁╂╃╄╅╆╇╈╉╊╋╌╍╎╏═║╒╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡╢╣╤╥╦╧╨╩╪╫╬◤◥◄►▶◀◣◢▲▼◥▸◂▴▾△▽▷◁⊿▻◅▵▿▹◃❏❐❑❒▀▁▂▃▄▅▆▇▉▊▋█▌▍▎▏▐░▒▓▔▕■□▢▣▤▥▦▧▨▩▪▫▬▭▮▯㋀㋁㋂㋃㋄㋅㋆㋇㋈㋉㋊㋋㏠㏡㏢㏣㏤㏥㏦㏧㏨㏩㏪㏫㏬㏭㏮㏯㏰㏱㏲㏳㏴㏵㏶㏷㏸㏹㏺㏻㏼㏽㏾㍙㍚㍛㍜㍝㍞㍟㍠㍡㍢㍣㍤㍥㍦㍧㍨㍩㍪㍫㍬㍭㍮㍯㍰㍘☰☲☱☴☵☶☳☷☯</p>
|
||
<h4 id="十二星座符号"><a href="#十二星座符号" class="headerlink" title="十二星座符号"></a>十二星座符号</h4><table>
|
||
<thead>
|
||
<tr>
|
||
<th>♈</th>
|
||
<th>♉</th>
|
||
<th>♊</th>
|
||
<th>♋</th>
|
||
<th>♌</th>
|
||
<th>♍</th>
|
||
<th>♎</th>
|
||
<th>♏</th>
|
||
<th>♐</th>
|
||
<th>♑</th>
|
||
<th>♒</th>
|
||
<th>♓</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>牧羊</td>
|
||
<td>金牛</td>
|
||
<td>双子</td>
|
||
<td>巨蟹</td>
|
||
<td>狮子</td>
|
||
<td>处女</td>
|
||
<td>天秤</td>
|
||
<td>天蝎</td>
|
||
<td>射手</td>
|
||
<td>摩羯</td>
|
||
<td>水瓶</td>
|
||
<td>双鱼</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<h4 id="特殊符号"><a href="#特殊符号" class="headerlink" title="特殊符号"></a>特殊符号</h4><p>♠♣♧♡♥❤❥❣♂♀✲☀☼☾☽◐◑☺☻☎☏✿❀№↑↓←→√×÷★℃℉°◆◇⊙■□△▽¿½☯✡㍿卍卐♂♀✚〓㎡♪♫♩♬㊚㊛囍㊒㊖Φ♀♂‖$@*&#※卍卐Ψ♫♬♭♩♪♯♮⌒¶∮‖€£¥$</p>
|
||
<h4 id="编号序号"><a href="#编号序号" class="headerlink" title="编号序号"></a>编号序号</h4><p>①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳⓪❶❷❸❹❺❻❼❽❾❿⓫⓬⓭⓮⓯⓰⓱⓲⓳⓴㊀㊁㊂㊃㊄㊅㊆㊇㊈㊉㈠㈡㈢㈣㈤㈥㈦㈧㈨㈩⑴⑵⑶⑷⑸⑹⑺⑻⑼⑽⑾⑿⒀⒁⒂⒃⒄⒅⒆⒇⒈⒉⒊⒋⒌⒍⒎⒏⒐⒑⒒⒓⒔⒕⒖⒗⒘⒙⒚⒛ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅰⅱⅲⅳⅴⅵⅶⅷⅸⅹⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵</p>
|
||
<h4 id="数学符号"><a href="#数学符号" class="headerlink" title="数学符号"></a>数学符号</h4><p>﹢﹣×÷±/=≌∽≦≧≒﹤﹥≈≡≠=≤≥<>≮≯∷∶∫∮∝∞∧∨∑∏∪∩∈∵∴⊥∥∠⌒⊙√∟⊿㏒㏑%‰⅟½⅓⅕⅙⅛⅔⅖⅚⅜¾⅗⅝⅞⅘≂≃≄≅≆≇≈≉≊≋≌≍≎≏≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≠≡≢≣≤≥≦≧≨≩⊰⊱⋛⋚∫∬∭∮∯∰∱∲∳%℅‰‱øØπ</p>
|
||
<h4 id="爱心符号"><a href="#爱心符号" class="headerlink" title="爱心符号"></a>爱心符号</h4><p>♥❣ღ♠♡♤❤❥</p>
|
||
<h4 id="标点符号"><a href="#标点符号" class="headerlink" title="标点符号"></a>标点符号</h4><p>。,、':∶;?‘’“”〝〞ˆˇ﹕︰﹔﹖﹑•¨….¸;!´?!~—ˉ|‖"〃`@﹫¡¿﹏﹋﹌︴々﹟#﹩$﹠&﹪%*﹡﹢﹦﹤‐ ̄¯―﹨ˆ˜﹍﹎+=<__-\ˇ~﹉﹊()〈〉‹›﹛﹜『』〖〗[]《》〔〕{}「」【】︵︷︿︹︽_﹁﹃︻︶︸﹀︺︾ˉ﹂﹄︼❝❞</p>
|
||
<h4 id="单位符号"><a href="#单位符号" class="headerlink" title="单位符号"></a>单位符号</h4><p>°′″$¥〒¢£%@℃℉﹩﹪‰﹫㎡㏕㎜㎝㎞㏎m³㎎㎏㏄º○¤%$º¹²³</p>
|
||
<h4 id="货币符号"><a href="#货币符号" class="headerlink" title="货币符号"></a>货币符号</h4><p>€£Ұ₴$₰¢₤¥₳₲₪₵元₣₱฿¤₡₮₭₩ރ円₢₥₫₦zł﷼₠₧₯₨Kčर₹ƒ₸¢</p>
|
||
<h4 id="箭头符号"><a href="#箭头符号" class="headerlink" title="箭头符号"></a>箭头符号</h4><p>↑↓←→↖↗↘↙↔↕➻➼➽➸➳➺➻➴➵➶➷➹▶►▷◁◀◄«»➩➪➫➬➭➮➯➱⏎➲➾➔➘➙➚➛➜➝➞➟➠➡➢➣➤➥➦➧➨↚↛↜↝↞↟↠↠↡↢↣↤↤↥↦↧↨⇄⇅⇆⇇⇈⇉⇊⇋⇌⇍⇎⇏⇐⇑⇒⇓⇔⇖⇗⇘⇙⇜↩↪↫↬↭↮↯↰↱↲↳↴↵↶↷↸↹☇☈↼↽↾↿⇀⇁⇂⇃⇞⇟⇠⇡⇢⇣⇤⇥⇦⇧⇨⇩⇪↺↻⇚⇛♐</p>
|
||
<h4 id="符号图案"><a href="#符号图案" class="headerlink" title="符号图案"></a>符号图案</h4><p>✐✎✏✑✒✍✉✁✂✃✄✆✉☎☏☑✓✔√☐☒✗✘ㄨ✕✖✖☢☠☣✈★☆✡囍㍿☯☰☲☱☴☵☶☳☷☜☞☝✍☚☛☟✌♤♧♡♢♠♣♥♦☀☁☂❄☃♨웃유❖☽☾☪✿♂♀✪✯☭➳卍卐√×■◆●○◐◑✙☺☻❀⚘♔♕♖♗♘♙♚♛♜♝♞♟♧♡♂♀♠♣♥❤☜☞☎☏⊙◎☺☻☼▧▨♨◐◑↔↕▪▒◊◦▣▤▥▦▩◘◈◇♬♪♩♭♪の★☆→あぃ£Ю〓§♤♥▶¤✲❈✿✲❈➹☀☂☁【】┱┲❣✚✪✣✤✥✦❉❥❦❧❃❂❁❀✄☪☣☢☠☭ღ▶▷◀◁☀☁☂☃☄★☆☇☈⊙☊☋☌☍ⓛⓞⓥⓔ╬『』∴☀♫♬♩♭♪☆∷﹌の★◎▶☺☻►◄▧▨♨◐◑↔↕↘▀▄█▌◦☼♪の☆→♧ぃ£❤▒▬♦◊◦♠♣▣۰•❤•۰►◄▧▨♨◐◑↔↕▪▫☼♦⊙●○①⊕◎Θ⊙¤㊣★☆♀◆◇◣◢◥▲▼△▽⊿◤◥✐✌✍✡✓✔✕✖♂♀♥♡☜☞☎☏⊙◎☺☻►◄▧▨♨◐◑↔↕♥♡▪▫☼♦▀▄█▌▐░▒▬♦◊◘◙◦☼♠♣▣▤▥▦▩◘◙◈♫♬♪♩♭♪✄☪☣☢☠♯♩♪♫♬♭♮☎☏☪♈ºº₪¤큐«»™♂✿♥ ◕‿-。 。◕‿◕。</p>
|
||
<h4 id="希腊字母"><a href="#希腊字母" class="headerlink" title="希腊字母"></a>希腊字母</h4><p>ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζνξοπρσηθικλμτυφχψω</p>
|
||
<h4 id="俄语字母"><a href="#俄语字母" class="headerlink" title="俄语字母"></a>俄语字母</h4><p>АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя</p>
|
||
<h4 id="汉语拼音"><a href="#汉语拼音" class="headerlink" title="汉语拼音"></a>汉语拼音</h4><p>āáǎàōóǒòēéěèīíǐìūúǔùǖǘǚǜüêɑńňɡㄅㄆㄇㄈㄉㄊㄋㄌㄍㄎㄏㄐㄑㄒㄓㄔㄕㄖㄗㄘㄙㄚㄛㄜㄝㄞㄟㄠㄡㄢㄣㄤㄥㄦㄧㄨㄩ</p>
|
||
<h4 id="日文平假名片假名"><a href="#日文平假名片假名" class="headerlink" title="日文平假名片假名"></a>日文平假名片假名</h4><p>ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをんゔゕゖァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶヷヸヹヺ・ーヽヾヿ゠ㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ</p>
|
||
<h4 id="制表符"><a href="#制表符" class="headerlink" title="制表符"></a>制表符</h4><p>─ ━│┃╌╍╎╏┄ ┅┆┇┈ ┉┊┋┌┍┎┏┐┑┒┓└ ┕┖┗ ┘┙┚┛├┝┞┟┠┡┢┣ ┤┥┦┧┨┩┪┫┬ ┭ ┮ ┯ ┰ ┱ ┲ ┳ ┴ ┵ ┶ ┷ ┸ ┹ ┺ ┻┼ ┽ ┾ ┿ ╀ ╁ ╂ ╃ ╄ ╅ ╆ ╇ ╈ ╉ ╊ ╋ ╪ ╫ ╬═║╒╓╔ ╕╖╗╘╙╚ ╛╜╝╞╟╠ ╡╢╣╤ ╥ ╦ ╧ ╨ ╩ ╳╔ ╗╝╚ ╬ ═ ╓ ╩ ┠ ┨┯ ┷┏ ┓┗ ┛┳ ⊥ ﹃ ﹄┌ ╮ ╭ ╯╰</p>
|
||
<h4 id="皇冠符号"><a href="#皇冠符号" class="headerlink" title="皇冠符号"></a>皇冠符号</h4><p>♚ ♛ ♝ ♞ ♜ ♟ ♔ ♕ ♗ ♘ ♖ ♟</p>
|
||
<h4 id="表情符号"><a href="#表情符号" class="headerlink" title="表情符号"></a>表情符号</h4><p>😀😁😂😃😄😅😆😉😊😋😎😍😘😗😙😚☺😇😐😑😶😏😣😥😮😯😪😫😴😌😛😜😝😒😓😔😕😲😷😖😞😟😤😢😭😦😧😨😬😰😱😳😵😡😠😈👿👹👺💀👻👽👦👧👨👩👴👵👶👱👮👲👳👷👸💂🎅👰👼💆💇🙍🙎🙅🙆💁🙋🙇🙌🙏👤👥🚶🏃👯💃👫👬👭💏💑👪💪👈👉☝👆👇✌✋👌👍👎✊👊👋👏👐✍👣👀👂👃👅👄💋👓👔👕👖👗👘👙👚👛👜👝🎒💼👞👟👠👡👢👑👒🎩🎓💄💅💍🌂🙈🙉🙊🐵🐒🐶🐕🐩🐺🐱😺😸😹😻😼😽🙀😿😾🐈🐯🐅🐆🐴🐎🐮🐂🐃🐄🐷🐖🐗🐽🐏🐑🐐🐪🐫🐘🐭🐁🐀🐹🐰🐇🐻🐨🐼🐾🐔🐓🐣🐤🐥🐦🐧🐸🐊🐢🐍🐲🐉🐳🐋🐬🐟🐠🐡🐙🐚🐌🐛🐜🐝🐞🦋💐🌸💮🌹🌺🌻🌼🌷🌱🌲🌳🌴🌵🌾🌿🍀🍁🍂🍃🌍🌎🌏🌐🌑🌒🌓🌔🌕🌖🌗🌘🌙🌚🌛🌜☀🌝🌞⭐🌟🌠☁⛅☔⚡❄🔥💧🌊💩🍇🍈🍉🍊🍋🍌🍍🍎🍏🍐🍑🍒🍓🍅🍆🌽🍄🌰🍞🍖🍗🍔🍟🍕🍳🍲🍱🍘🍙🍚🍛🍜🍝🍠🍢🍣🍤🍥🍡🍦🍧🍨🍩🍪🎂🍰🍫🍬🍭🍮🍯🍼☕🍵🍶🍷🍸🍹🍺🍻🍴🎪🎭🎨🎰🚣🛀🎫🏆⚽⚾🏀🏈🏉🎾🎱🎳⛳🎣🎽🎿🏂🏄🏇🏊🚴🚵🎯🎮🎲🎷🎸🎺🎻🎬👾🌋🗻🏠🏡🏢🏣🏤🏥🏦🏨🏩🏪🏫🏬🏭🏯🏰💒🗼🗽⛪⛲🌁🌃🌆🌇🌉🌌🎠🎡🎢🚂🚃🚄🚅🚆🚇🚈🚉🚊🚝🚞🚋🚌🚍🚎🚏🚐🚑🚒🚓🚔🚕🚖🚗🚘🚚🚛🚜🚲⛽🚨🚥🚦🚧⚓⛵🚤🚢✈💺🚁🚟🚠🚡🚀🎑🗿🛂🛃🛄🛅💌💎🔪💈🚪🚽🚿🛁⌛⏳⌚⏰🎈🎉🎊🎎🎏🎐🎀🎁📯📻📱📲☎📞📟📠🔋🔌💻💽💾💿📀🎥📺📷📹📼🔍🔎🔬🔭📡💡🔦🏮📔📕📖📗📘📙📚📓📃📜📄📰📑🔖💰💴💵💶💷💸💳✉📧📨📩📤📥📦📫📪📬📭📮✏✒📝📁📂📅📆📇📈📉📊📋📌📍📎📏📐✂🔒🔓🔏🔐🔑🔨🔫🔧🔩🔗💉💊🚬🔮🚩🎌💦💨💣☠♠♥♦♣🀄🎴🔇🔈🔉🔊📢📣💤💢💬💭♨🌀🔔🔕✡✝🔯📛🔰🔱⭕✅☑✔✖❌❎➕➖➗➰➿〽✳✴❇‼⁉❓❔❕❗©®™🎦🔅🔆💯🔠🔡🔢🔣🔤🅰🆎🅱🆑🆒🆓ℹ🆔Ⓜ🆕🆖🅾🆗🅿🆘🆙🆚🈁🈂🈷🈶🈯🉐🈹🈚🈲🉑🈸🈴🈳㊗㊙🈺🈵▪▫◻◼◽◾⬛⬜🔶🔷🔸🔹🔺🔻💠🔲🔳⚪⚫🔴🔵♈♉♊♋♌♍♎♏♐♑♒♓⛎💘❤💓💔💕💖💗💙💚💛💜💝💞💟❣🌿🚧💒☎📟💽⬆↗➡↘⬇↙⬅↖↕↔↩↪⤴⤵🔃🔄🔙🔚🔛🔜🔝🔀🔁🔂▶⏩◀⏪🔼⏫🔽⏬📱📶📳📴♻🏧🚮🚰♿🚹🚺🚻🚼🚾⚠🚸⛔🚫🚳🚭🚯🚱🚷🔞</p>
|
||
<p>汉语字典为您提供特殊符号大全,网名符号,特殊符号☎☏✄☪☣☢☠♨« »큐〓㊚㊛囍㊒㊖☑✔☐☒✘㍿☯☰☷♥♠♤❤♂♀★☆☯✡※卍卐■□◆◇▲△▂▃▄▅▆▇█●○◎⊕⊙㊣↑↓←→↖↗↘↙㎡№§※≡✿ⓛⓞⓥⓔ∞∑√øπ×÷±∫∵∴⊥∥∠€¥℃™©®①❶㊀㈠⑴⒈Ⓐⓐ⒜</p>
|
||
<p>转载于: <a href="https://shijianchuo.net/tesufuhao">https://shijianchuo.net/tesufuhao</a></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>其它</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>特殊符号</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>SpringCloud相关资料</title>
|
||
<url>/posts/62429.html</url>
|
||
<content><![CDATA[<h1 id="SpringCloud相关资料"><a href="#SpringCloud相关资料" class="headerlink" title="SpringCloud相关资料"></a>SpringCloud相关资料</h1><h2 id="一-Eureka注册中心、Ribbon负载均衡、Nacos注册中心"><a href="#一-Eureka注册中心、Ribbon负载均衡、Nacos注册中心" class="headerlink" title="一.Eureka注册中心、Ribbon负载均衡、Nacos注册中心"></a>一.Eureka注册中心、Ribbon负载均衡、Nacos注册中心</h2>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/SpringCloud01.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<h2 id="二-Nacos配置中心、Feign远程调用、Gateway服务网关"><a href="#二-Nacos配置中心、Feign远程调用、Gateway服务网关" class="headerlink" title="二.Nacos配置中心、Feign远程调用、Gateway服务网关"></a>二.Nacos配置中心、Feign远程调用、Gateway服务网关</h2>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/SpringCloud02.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<h2 id="三-Docker容器化技术"><a href="#三-Docker容器化技术" class="headerlink" title="三.Docker容器化技术"></a>三.Docker容器化技术</h2>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/Docker实用篇.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<h2 id="四-RabbitMQ"><a href="#四-RabbitMQ" class="headerlink" title="四.RabbitMQ"></a>四.RabbitMQ</h2>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/RabbitMQ.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>SpringCloud</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>大数据开发相关笔记</title>
|
||
<url>/posts/46054.html</url>
|
||
<content><![CDATA[<div class="note success flat"><p>笔记转载于黑马程序员,详细的笔记来源于:<a href="https://www.bilibili.com/video/BV1WY4y197g7/?spm_id_from=333.337.search-card.all.click&vd_source=22300b9f40de74b7db529eb8f04510a9">https://www.bilibili.com/video/BV1WY4y197g7/?spm_id_from=333.337.search-card.all.click&vd_source=22300b9f40de74b7db529eb8f04510a9</a></p>
|
||
</div>
|
||
|
||
<h1 id="一-Hive"><a href="#一-Hive" class="headerlink" title="一.Hive"></a>一.Hive</h1><h2 id="1-Hive-SQL语法大全"><a href="#1-Hive-SQL语法大全" class="headerlink" title="1.Hive SQL语法大全"></a>1.Hive SQL语法大全</h2>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/Hive-SQL语法大全.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<h2 id="2-Hive函数"><a href="#2-Hive函数" class="headerlink" title="2.Hive函数"></a>2.Hive函数</h2>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/Hive函数.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/hive函数大全.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>大数据</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>大数据</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>Linux从入门到进阶</title>
|
||
<url>/posts/8957.html</url>
|
||
<content><![CDATA[<div class="note success flat"><p>本篇博客转载于传智播客黑马程序员,只作在线笔记使用,详细的课程资料请关注黑马程序员!</p>
|
||
</div>
|
||
|
||
<p>Linux相关的书籍: <a href="https://qingling.icu/posts/3661.html">技术书籍-Linux指令大全 | The Blog (qingling.icu)</a></p>
|
||
<h1 id="一-初识Linux"><a href="#一-初识Linux" class="headerlink" title="一.初识Linux"></a>一.初识Linux</h1><p> Linux是一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX和UNIX的多用户、多任务、支持多线程和多CPU的操作系统。它能运行主要的UNIX工具软件、应用程序和网络协议。支持32位和64位硬件。Linux继承了Unix以网络为核心的设计思想,是一个性能稳定的多用户网络操作系统。</p>
|
||
<p><img src="/pictures/image-20230919214601245.png" alt="image-20230919214601245"></p>
|
||
<p>视频链接: <a href="https://www.bilibili.com/video/BV1n84y1i7td/?share_source=copy_web&vd_source=aee5e475191b69e6c781059ab6662584">https://www.bilibili.com/video/BV1n84y1i7td/?share_source=copy_web&vd_source=aee5e475191b69e6c781059ab6662584</a></p>
|
||
<h1 id="二-Linux的安装和配置教程"><a href="#二-Linux的安装和配置教程" class="headerlink" title="二.Linux的安装和配置教程"></a>二.Linux的安装和配置教程</h1><h2 id="1-通过虚拟机安装Linux"><a href="#1-通过虚拟机安装Linux" class="headerlink" title="1.通过虚拟机安装Linux"></a>1.通过虚拟机安装Linux</h2><p>Linux安装教程: <a href="https://qingling.icu/posts/47407.html">VMWare虚拟机安装Linux教程 | The Blog (qingling.icu)</a></p>
|
||
<p>Linux设置静态IP:<a href="https://qingling.icu/posts/21883.html">Linux设置静态IP | The Blog (qingling.icu)</a></p>
|
||
<h2 id="2-通过WSL获取Linux环境"><a href="#2-通过WSL获取Linux环境" class="headerlink" title="2.通过WSL获取Linux环境"></a>2.通过WSL获取Linux环境</h2><p><strong>安装教程:</strong> <a href="https://qingling.icu/posts/25154.html">Windows10的Linux子系统WSL的安装和使用 | The Blog (qingling.icu)</a></p>
|
||
<h1 id="三-Linux的目录结构"><a href="#三-Linux的目录结构" class="headerlink" title="三.Linux的目录结构"></a>三.Linux的目录结构</h1><p><img src="/pictures/image-20230919230906304.png" alt="image-20230919230906304"></p>
|
||
<p><img src="/pictures/image-20230919231127383.png" alt="image-20230919231127383"></p>
|
||
<h1 id="四-LInux基础命令"><a href="#四-LInux基础命令" class="headerlink" title="四.LInux基础命令"></a>四.LInux基础命令</h1><h2 id="ls命令"><a href="#ls命令" class="headerlink" title="ls命令"></a>ls命令</h2><p>功能:列出文件夹信息</p>
|
||
<p>语法:<code>ls [-l -h -a] [参数]</code></p>
|
||
<ul>
|
||
<li>参数:被查看的文件夹,不提供参数,表示查看当前工作目录</li>
|
||
<li>-l,以列表形式查看</li>
|
||
<li>-h,配合-l,以更加人性化的方式显示文件大小</li>
|
||
<li>-a,显示隐藏文件</li>
|
||
</ul>
|
||
<h3 id="隐藏文件、文件夹"><a href="#隐藏文件、文件夹" class="headerlink" title="隐藏文件、文件夹"></a>隐藏文件、文件夹</h3><p>在Linux中以 <code>.</code>开头的,均是隐藏的。</p>
|
||
<p>默认不显示出来,需要 <code>-a</code>选项才可查看到。</p>
|
||
<h2 id="pwd命令"><a href="#pwd命令" class="headerlink" title="pwd命令"></a>pwd命令</h2><p>功能:展示当前工作目录</p>
|
||
<p>语法:<code>pwd</code></p>
|
||
<h2 id="cd命令"><a href="#cd命令" class="headerlink" title="cd命令"></a>cd命令</h2><p>功能:切换工作目录</p>
|
||
<p>语法:<code>cd [目标目录]</code></p>
|
||
<p>参数:目标目录,要切换去的地方,不提供默认切换到 <code>当前登录用户HOME目录</code></p>
|
||
<h2 id="HOME目录"><a href="#HOME目录" class="headerlink" title="HOME目录"></a>HOME目录</h2><p>每一个用户在Linux系统中都有自己的专属工作目录,称之为HOME目录。</p>
|
||
<ul>
|
||
<li>普通用户的HOME目录,默认在:<code>/home/用户名</code></li>
|
||
<li>root用户的HOME目录,在:<code>/root</code></li>
|
||
</ul>
|
||
<p>FinalShell登陆终端后,默认的工作目录就是用户的HOME目录</p>
|
||
<h2 id="相对路径、绝对路径"><a href="#相对路径、绝对路径" class="headerlink" title="相对路径、绝对路径"></a>相对路径、绝对路径</h2><ul>
|
||
<li><p>相对路径,==非==<code>/</code>开头的称之为相对路径</p>
|
||
<p>相对路径表示以 <code>当前目录</code>作为起点,去描述路径,如 <code>test/a.txt</code>,表示当前工作目录内的test文件夹内的a.txt文件</p>
|
||
</li>
|
||
<li><p>绝对路径,==以==<code>/</code>开头的称之为绝对路径</p>
|
||
<p>绝对路径从 <code>根</code>开始描述路径</p>
|
||
</li>
|
||
</ul>
|
||
<h2 id="特殊路径符"><a href="#特殊路径符" class="headerlink" title="特殊路径符"></a>特殊路径符</h2><ul>
|
||
<li><code>.</code>,表示当前,比如./a.txt,表示当前文件夹内的 <code>a.txt</code>文件</li>
|
||
<li><code>..</code>,表示上级目录,比如 <code>../</code>表示上级目录,<code>../../</code>表示上级的上级目录</li>
|
||
<li><code>~</code>,表示用户的HOME目录,比如 <code>cd ~</code>,即可切回用户HOME目录</li>
|
||
</ul>
|
||
<h2 id="mkdir命令"><a href="#mkdir命令" class="headerlink" title="mkdir命令"></a>mkdir命令</h2><p>功能:创建文件夹</p>
|
||
<p>语法:<code>mkdir [-p] 参数</code></p>
|
||
<ul>
|
||
<li>参数:被创建文件夹的路径</li>
|
||
<li>选项:-p,可选,表示创建前置路径</li>
|
||
</ul>
|
||
<h2 id="touch命令"><a href="#touch命令" class="headerlink" title="touch命令"></a>touch命令</h2><p>功能:创建文件</p>
|
||
<p>语法:<code>touch 参数</code></p>
|
||
<ul>
|
||
<li>参数:被创建的文件路径</li>
|
||
</ul>
|
||
<h2 id="cat命令"><a href="#cat命令" class="headerlink" title="cat命令"></a>cat命令</h2><p>功能:查看文件内容</p>
|
||
<p>语法:<code>cat 参数</code></p>
|
||
<ul>
|
||
<li>参数:被查看的文件路径</li>
|
||
</ul>
|
||
<h2 id="more命令"><a href="#more命令" class="headerlink" title="more命令"></a>more命令</h2><p>功能:查看文件,可以支持翻页查看</p>
|
||
<p>语法:<code>more 参数</code></p>
|
||
<ul>
|
||
<li>参数:被查看的文件路径</li>
|
||
<li>在查看过程中:<ul>
|
||
<li><code>空格</code>键翻页</li>
|
||
<li><code>q</code>退出查看</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<h2 id="cp命令"><a href="#cp命令" class="headerlink" title="cp命令"></a>cp命令</h2><p>功能:复制文件、文件夹</p>
|
||
<p>语法:<code>cp [-r] 参数1 参数2</code></p>
|
||
<ul>
|
||
<li>参数1,被复制的</li>
|
||
<li>参数2,要复制去的地方</li>
|
||
<li>选项:-r,可选,复制文件夹使用</li>
|
||
</ul>
|
||
<p>示例:</p>
|
||
<ul>
|
||
<li>cp a.txt b.txt,复制当前目录下a.txt为b.txt</li>
|
||
<li>cp a.txt test/,复制当前目录a.txt到test文件夹内</li>
|
||
<li>cp -r test test2,复制文件夹test到当前文件夹内为test2存在</li>
|
||
</ul>
|
||
<h2 id="mv命令"><a href="#mv命令" class="headerlink" title="mv命令"></a>mv命令</h2><p>功能:移动文件、文件夹</p>
|
||
<p>语法:<code>mv 参数1 参数2</code></p>
|
||
<ul>
|
||
<li>参数1:被移动的</li>
|
||
<li>参数2:要移动去的地方,参数2如果不存在,则会进行改名</li>
|
||
</ul>
|
||
<h2 id="rm命令"><a href="#rm命令" class="headerlink" title="rm命令"></a>rm命令</h2><p>功能:删除文件、文件夹</p>
|
||
<p>语法:<code>rm [-r -f] 参数...参数</code></p>
|
||
<ul>
|
||
<li>参数:支持多个,每一个表示被删除的,空格进行分隔</li>
|
||
<li>选项:-r,删除文件夹使用</li>
|
||
<li>选项:-f,强制删除,不会给出确认提示,一般root用户会用到</li>
|
||
</ul>
|
||
<blockquote>
|
||
<p>rm命令很危险,一定要注意,特别是切换到root用户的时候。</p>
|
||
</blockquote>
|
||
<p><img src="/pictures/image-20230920231224351.png" alt="image-20230920231224351"></p>
|
||
<h2 id="which命令"><a href="#which命令" class="headerlink" title="which命令"></a>which命令</h2><p>功能:查看命令的程序本体文件路径</p>
|
||
<p>语法:<code>which 参数</code></p>
|
||
<ul>
|
||
<li>参数:被查看的命令</li>
|
||
</ul>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">jason@DESKTOP-PC4GEUR:~$ which pwd</span><br><span class="line">/usr/bin/pwd</span><br><span class="line">jason@DESKTOP-PC4GEUR:~$ which touch</span><br><span class="line">/usr/bin/touch</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="find命令"><a href="#find命令" class="headerlink" title="find命令"></a>find命令</h2><p>功能:搜索文件</p>
|
||
<p>语法1按文件名搜索:<code>find 路径 -name 参数</code></p>
|
||
<ul>
|
||
<li>路径,搜索的起始路径</li>
|
||
<li>参数,搜索的关键字,支持通配符*, 比如:<code>*</code>test表示搜索任意以test结尾的文件</li>
|
||
</ul>
|
||
<p><img src="/pictures/image-20230923175004853.png" alt="image-20230923175004853"></p>
|
||
<h2 id="grep命令"><a href="#grep命令" class="headerlink" title="grep命令"></a>grep命令</h2><p>功能:过滤关键字</p>
|
||
<p>语法:<code>grep [-n] 关键字 文件路径</code></p>
|
||
<ul>
|
||
<li>选项-n,可选,表示在结果中显示匹配的行的行号。</li>
|
||
<li>参数,关键字,必填,表示过滤的关键字,带有空格或其它特殊符号,建议使用””将关键字包围起来</li>
|
||
<li>参数,文件路径,必填,表示要过滤内容的文件路径,可作为内容输入端口</li>
|
||
</ul>
|
||
<blockquote>
|
||
<p>参数文件路径,可以作为管道符的输入</p>
|
||
</blockquote>
|
||
<h2 id="wc命令"><a href="#wc命令" class="headerlink" title="wc命令"></a>wc命令</h2><p>功能:统计</p>
|
||
<p>语法:<code>wc [-c -m -l -w] 文件路径</code></p>
|
||
<ul>
|
||
<li>选项,-c,统计bytes数量</li>
|
||
<li>选项,-m,统计字符数量</li>
|
||
<li>选项,-l,统计行数</li>
|
||
<li>选项,-w,统计单词数量</li>
|
||
<li>参数,文件路径,被统计的文件,可作为内容输入端口</li>
|
||
</ul>
|
||
<blockquote>
|
||
<p>参数文件路径,可作为管道符的输入</p>
|
||
</blockquote>
|
||
<h2 id="管道符"><a href="#管道符" class="headerlink" title="管道符|"></a>管道符|</h2><p>写法:<code>|</code></p>
|
||
<p>功能:将符号左边的结果,作为符号右边的输入</p>
|
||
<p>示例:</p>
|
||
<p><code>cat a.txt | grep itheima</code>,将cat a.txt的结果,作为grep命令的输入,用来过滤 <code>itheima</code>关键字</p>
|
||
<p>可以支持嵌套:</p>
|
||
<p><code>cat a.txt | grep itheima | grep itcast</code></p>
|
||
<h2 id="echo命令"><a href="#echo命令" class="headerlink" title="echo命令"></a>echo命令</h2><p>功能:输出内容</p>
|
||
<p>语法:<code>echo 参数</code></p>
|
||
<ul>
|
||
<li>参数:被输出的内容</li>
|
||
</ul>
|
||
<p><img src="/pictures/image-20230923181041583.png" alt="image-20230923181041583"></p>
|
||
<h2 id="反引号"><a href="#反引号" class="headerlink" title="`反引号"></a>`反引号</h2><p>功能:被两个反引号包围的内容,会作为命令执行</p>
|
||
<p>示例:</p>
|
||
<ul>
|
||
<li>echo `pwd`,会输出当前工作目录</li>
|
||
</ul>
|
||
<h2 id="tail命令"><a href="#tail命令" class="headerlink" title="tail命令"></a>tail命令</h2><p>功能:查看文件尾部内容</p>
|
||
<p>语法:<code>tail [-f] 参数</code></p>
|
||
<ul>
|
||
<li>参数:被查看的文件</li>
|
||
<li>选项:-f,持续跟踪文件修改</li>
|
||
<li>选项, -num,表示,查看尾部多少行,不填默认10行(tail -10 文件)</li>
|
||
</ul>
|
||
<h2 id="head命令"><a href="#head命令" class="headerlink" title="head命令"></a>head命令</h2><p>功能:查看文件头部内容</p>
|
||
<p>语法:<code>head [-n] 参数</code></p>
|
||
<ul>
|
||
<li>参数:被查看的文件</li>
|
||
<li>选项:-n,查看的行数</li>
|
||
</ul>
|
||
<h2 id="重定向符"><a href="#重定向符" class="headerlink" title="重定向符"></a>重定向符</h2><p>功能:将符号左边的结果,输出到右边指定的文件中去</p>
|
||
<ul>
|
||
<li><code>></code>,表示覆盖输出</li>
|
||
<li><code>>></code>,表示追加输出</li>
|
||
</ul>
|
||
<p><img src="/pictures/image-20230923181307011.png" alt="image-20230923181307011"></p>
|
||
<h2 id="vi编辑器"><a href="#vi编辑器" class="headerlink" title="vi编辑器"></a>vi编辑器</h2><h3 id="命令模式快捷键"><a href="#命令模式快捷键" class="headerlink" title="命令模式快捷键"></a>命令模式快捷键</h3><p><img src="/pictures/20221027215841.png" alt="image-20221027215841573"></p>
|
||
<p><img src="/pictures/20221027215846.png" alt="image-20221027215846581"></p>
|
||
<p><img src="/pictures/20221027215849.png" alt="image-20221027215849668"></p>
|
||
<h3 id="底线命令快捷键"><a href="#底线命令快捷键" class="headerlink" title="底线命令快捷键"></a>底线命令快捷键</h3><p><img src="/pictures/20221027215858.png" alt="image-20221027215858967"></p>
|
||
<h2 id="命令的选项"><a href="#命令的选项" class="headerlink" title="命令的选项"></a>命令的选项</h2><p>我们学习的一系列Linux命令,它们所拥有的选项都是非常多的。</p>
|
||
<p>比如,简单的ls命令就有:-a -A -b -c -C -d -D -f -F -g -G -h -H -i -I -k -l -L -m -n -N -o -p -q -Q -r-R -s -S -t -T -u -U -v -w -x -X -1等选项,可以发现选项是极其多的。</p>
|
||
<p>课程中, 并不会将全部的选项都进行讲解,否则,一个ls命令就可能讲解2小时之久。</p>
|
||
<p>课程中,会对常见的选项进行讲解, 足够满足绝大多数的学习、工作场景。</p>
|
||
<h3 id="查看命令的帮助"><a href="#查看命令的帮助" class="headerlink" title="查看命令的帮助"></a>查看命令的帮助</h3><p>可以通过:<code>命令 --help</code>查看命令的帮助手册</p>
|
||
<p><img src="/pictures/20221027220005.png" alt="image-20221027220005610"></p>
|
||
<h3 id="查看命令的详细手册"><a href="#查看命令的详细手册" class="headerlink" title="查看命令的详细手册"></a>查看命令的详细手册</h3><p>可以通过:<code>man 命令</code>查看某命令的详细手册</p>
|
||
<p><img src="/pictures/20221027220010.png" alt="image-20221027220009949"></p>
|
||
<h1 id="五-Linux常用操作"><a href="#五-Linux常用操作" class="headerlink" title="五.Linux常用操作"></a>五.Linux常用操作</h1><h2 id="软件安装"><a href="#软件安装" class="headerlink" title="软件安装"></a>软件安装</h2><ul>
|
||
<li>CentOS系统使用:<ul>
|
||
<li>yum [install remove search] [-y] 软件名称<ul>
|
||
<li>install 安装</li>
|
||
<li>remove 卸载</li>
|
||
<li>search 搜索</li>
|
||
<li>-y,自动确认</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li>Ubuntu系统使用<ul>
|
||
<li>apt [install remove search] [-y] 软件名称<ul>
|
||
<li>install 安装</li>
|
||
<li>remove 卸载</li>
|
||
<li>search 搜索</li>
|
||
<li>-y,自动确认</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<blockquote>
|
||
<p>yum 和 apt 均需要root权限</p>
|
||
</blockquote>
|
||
<h2 id="systemctl"><a href="#systemctl" class="headerlink" title="systemctl"></a>systemctl</h2><p>功能:控制系统服务的启动关闭等</p>
|
||
<p>语法:<code>systemctl start | stop | restart | disable | enable | status 服务名</code></p>
|
||
<ul>
|
||
<li>start,启动</li>
|
||
<li>stop,停止</li>
|
||
<li>status,查看状态</li>
|
||
<li>disable,关闭开机自启</li>
|
||
<li>enable,开启开机自启</li>
|
||
<li>restart,重启</li>
|
||
</ul>
|
||
<h2 id="软链接"><a href="#软链接" class="headerlink" title="软链接"></a>软链接</h2><p>功能:创建文件、文件夹软链接(快捷方式)</p>
|
||
<p>语法:<code>ln -s 参数1 参数2</code></p>
|
||
<ul>
|
||
<li>参数1:被链接的</li>
|
||
<li>参数2:要链接去的地方(快捷方式的名称和存放位置)</li>
|
||
</ul>
|
||
<h2 id="日期"><a href="#日期" class="headerlink" title="日期"></a>日期</h2><p>语法:<code>date [-d] [+格式化字符串]</code></p>
|
||
<ul>
|
||
<li><p>-d 按照给定的字符串显示日期,一般用于日期计算</p>
|
||
</li>
|
||
<li><p>格式化字符串:通过特定的字符串标记,来控制显示的日期格式</p>
|
||
<ul>
|
||
<li>%Y 年%y 年份后两位数字 (00..99)</li>
|
||
<li>%m 月份 (01..12)</li>
|
||
<li>%d 日 (01..31)</li>
|
||
<li>%H 小时 (00..23)</li>
|
||
<li>%M 分钟 (00..59)</li>
|
||
<li>%S 秒 (00..60)</li>
|
||
<li>%s 自 1970-01-01 00:00:00 UTC 到现在的秒数</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<p>示例:</p>
|
||
<ul>
|
||
<li><p>按照2022-01-01的格式显示日期</p>
|
||
<p><img src="/pictures/20221027220514.png" alt="image-20221027220514640"></p>
|
||
</li>
|
||
<li><p>按照2022-01-01 10:00:00的格式显示日期</p>
|
||
<p><img src="/pictures/20221027220525.png" alt="image-20221027220525625"></p>
|
||
</li>
|
||
<li><p>-d选项日期计算</p>
|
||
<p><img src="/pictures/20221027220429.png" alt="image-20221027220429831"></p>
|
||
<ul>
|
||
<li><p>支持的时间标记为:</p>
|
||
<p><img src="/pictures/20221027220449.png" alt="image-20221027220449312"></p>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<h2 id="时区"><a href="#时区" class="headerlink" title="时区"></a>时区</h2><p>修改时区为中国时区</p>
|
||
<p><img src="/pictures/20221027220554.png" alt="image-20221027220554654"></p>
|
||
<h2 id="ntp"><a href="#ntp" class="headerlink" title="ntp"></a>ntp</h2><p>功能:同步时间</p>
|
||
<p>安装:<code>yum install -y ntp</code></p>
|
||
<p>启动管理:<code>systemctl start | stop | restart | status | disable | enable ntpd</code></p>
|
||
<p>手动校准时间:<code>ntpdate -u ntp.aliyun.com</code></p>
|
||
<h2 id="ip地址"><a href="#ip地址" class="headerlink" title="ip地址"></a>ip地址</h2><p>格式:a.b.c.d</p>
|
||
<ul>
|
||
<li>abcd为0~255的数字</li>
|
||
</ul>
|
||
<p>特殊IP:</p>
|
||
<ul>
|
||
<li>127.0.0.1,表示本机</li>
|
||
<li>0.0.0.0<ul>
|
||
<li>可以表示本机</li>
|
||
<li>也可以表示任意IP(看使用场景)</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<p>查看ip:<code>ifconfig</code></p>
|
||
<h2 id="主机名"><a href="#主机名" class="headerlink" title="主机名"></a>主机名</h2><p>功能:Linux系统的名称</p>
|
||
<p>查看:<code>hostname</code></p>
|
||
<p>设置:<code>hostnamectl set-hostname 主机名</code></p>
|
||
<h2 id="配置VMware固定IP"><a href="#配置VMware固定IP" class="headerlink" title="配置VMware固定IP"></a>配置VMware固定IP</h2><ol>
|
||
<li><p>修改VMware网络,参阅PPT,图太多</p>
|
||
</li>
|
||
<li><p>设置Linux内部固定IP</p>
|
||
<p>修改文件:<code>/etc/sysconfig/network-scripts/ifcfg-ens33</code></p>
|
||
<p>示例文件内容:</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">TYPE="Ethernet"</span><br><span class="line">PROXY_METHOD="none"</span><br><span class="line">BROWSER_ONLY="no"</span><br><span class="line">BOOTPROTO="static" # 改为static,固定IP</span><br><span class="line">DEFROUTE="yes"</span><br><span class="line">IPV4_FAILURE_FATAL="no"</span><br><span class="line">IPV6INIT="yes"</span><br><span class="line">IPV6_AUTOCONF="yes"</span><br><span class="line">IPV6_DEFROUTE="yes"</span><br><span class="line">IPV6_FAILURE_FATAL="no"</span><br><span class="line">IPV6_ADDR_GEN_MODE="stable-privacy"</span><br><span class="line">NAME="ens33"</span><br><span class="line">UUID="1b0011cb-0d2e-4eaa-8a11-af7d50ebc876"</span><br><span class="line">DEVICE="ens33"</span><br><span class="line">ONBOOT="yes"</span><br><span class="line">IPADDR="192.168.88.131" # IP地址,自己设置,要匹配网络范围</span><br><span class="line">NETMASK="255.255.255.0" # 子网掩码,固定写法255.255.255.0</span><br><span class="line">GATEWAY="192.168.88.2" # 网关,要和VMware中配置的一致</span><br><span class="line">DNS1="192.168.88.2" # DNS1服务器,和网关一致即可</span><br></pre></td></tr></table></figure></li>
|
||
</ol>
|
||
<h2 id="ps命令"><a href="#ps命令" class="headerlink" title="ps命令"></a>ps命令</h2><p>功能:查看进程信息</p>
|
||
<p>语法:<code>ps -ef</code>,查看全部进程信息,可以搭配grep做过滤:<code>ps -ef | grep xxx</code></p>
|
||
<p><img src="/pictures/image-20230925200901791.png" alt="image-20230925200901791"></p>
|
||
<h2 id="kill命令"><a href="#kill命令" class="headerlink" title="kill命令"></a>kill命令</h2><p><img src="/pictures/20221027221303.png" alt="image-20221027221303037"></p>
|
||
<h2 id="nmap命令"><a href="#nmap命令" class="headerlink" title="nmap命令"></a>nmap命令</h2><p><img src="/pictures/20221027221241.png" alt="image-20221027221241123"></p>
|
||
<h2 id="netstat命令"><a href="#netstat命令" class="headerlink" title="netstat命令"></a>netstat命令</h2><p>功能:查看端口占用</p>
|
||
<p>用法:<code>netstat -anp | grep xxx</code></p>
|
||
<h2 id="ping命令"><a href="#ping命令" class="headerlink" title="ping命令"></a>ping命令</h2><p>测试网络是否联通</p>
|
||
<p>语法:<code>ping [-c num] 参数</code></p>
|
||
<p><img src="/pictures/20221027221129.png" alt="image-20221027221129782"></p>
|
||
<h2 id="wget命令"><a href="#wget命令" class="headerlink" title="wget命令"></a>wget命令</h2><p><img src="/pictures/20221027221149.png" alt="image-20221027221148964"></p>
|
||
<h2 id="curl命令"><a href="#curl命令" class="headerlink" title="curl命令"></a>curl命令</h2><p><img src="/pictures/20221027221201.png" alt="image-20221027221201079"></p>
|
||
<p><img src="/pictures/20221027221210.png" alt="image-20221027221210518"></p>
|
||
<h2 id="top命令"><a href="#top命令" class="headerlink" title="top命令"></a>top命令</h2><p>功能:查看主机运行状态</p>
|
||
<p>语法:<code>top</code>,查看基础信息</p>
|
||
<p>可用选项:</p>
|
||
<p><img src="/pictures/20221027221340.png" alt="image-20221027221340729"></p>
|
||
<p>交互式模式中,可用快捷键:</p>
|
||
<p><img src="/pictures/20221027221354.png" alt="image-20221027221354137"></p>
|
||
<p><img src="/pictures/image-20230925203631826.png" alt="image-20230925203631826"></p>
|
||
<p><img src="/pictures/image-20230925203743893.png" alt="image-20230925203743893"></p>
|
||
<h2 id="df命令"><a href="#df命令" class="headerlink" title="df命令"></a>df命令</h2><p>查看磁盘占用</p>
|
||
<p><img src="/pictures/20221027221413.png" alt="image-20221027221413787"></p>
|
||
<h2 id="iostat命令"><a href="#iostat命令" class="headerlink" title="iostat命令"></a>iostat命令</h2><p>查看CPU、磁盘的相关信息</p>
|
||
<p><img src="/pictures/20221027221440.png" alt="image-20221027221439990"></p>
|
||
<p><img src="/pictures/20221027221514.png" alt="image-20221027221514237"></p>
|
||
<h2 id="sar命令"><a href="#sar命令" class="headerlink" title="sar命令"></a>sar命令</h2><p>查看网络统计</p>
|
||
<p><img src="/pictures/20221027221545.png" alt="image-20221027221545822"></p>
|
||
<h2 id="环境变量"><a href="#环境变量" class="headerlink" title="环境变量"></a>环境变量</h2><ul>
|
||
<li>临时设置:export 变量名=变量值</li>
|
||
<li>永久设置:<ul>
|
||
<li>针对用户,设置用户HOME目录内:<code>.bashrc</code>文件</li>
|
||
<li>针对全局,设置 <code>/etc/profile</code></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<h3 id="PATH变量"><a href="#PATH变量" class="headerlink" title="PATH变量"></a>PATH变量</h3><p>记录了执行程序的搜索路径</p>
|
||
<p>可以将自定义路径加入PATH内,实现自定义命令在任意地方均可执行的效果</p>
|
||
<h2 id="符号"><a href="#符号" class="headerlink" title="$符号"></a>$符号</h2><p>可以取出指定的环境变量的值</p>
|
||
<p>语法:<code>$变量名</code></p>
|
||
<p>示例:</p>
|
||
<p><code>echo $PATH</code>,输出PATH环境变量的值</p>
|
||
<p><code>echo ${PATH}ABC</code>,输出PATH环境变量的值以及ABC</p>
|
||
<p>如果变量名和其它内容混淆在一起,可以使用${}</p>
|
||
<h2 id="RZ,SZ"><a href="#RZ,SZ" class="headerlink" title="RZ,SZ"></a>RZ,SZ</h2><p><img src="/pictures/image-20230925215103228.png" alt="image-20230925215103228"></p>
|
||
<h2 id="压缩解压"><a href="#压缩解压" class="headerlink" title="压缩解压"></a>压缩解压</h2><h3 id="压缩"><a href="#压缩" class="headerlink" title="压缩"></a>压缩</h3><p><code>tar -zcvf 压缩包 被压缩1...被压缩2...被压缩N</code></p>
|
||
<ul>
|
||
<li>-z表示使用gzip,可以不写</li>
|
||
</ul>
|
||
<p><code>zip [-r] 参数1 参数2 参数N</code></p>
|
||
<p><img src="/pictures/20221027221906.png" alt="image-20221027221906247"></p>
|
||
<p><img src="/pictures/image-20230925215409296.png" alt="image-20230925215409296"></p>
|
||
<h3 id="解压"><a href="#解压" class="headerlink" title="解压"></a>解压</h3><p><code>tar -zxvf 被解压的文件 -C 要解压去的地方</code></p>
|
||
<ul>
|
||
<li>-z表示使用gzip,可以省略</li>
|
||
<li>-C,可以省略,指定要解压去的地方,不写解压到当前目录</li>
|
||
</ul>
|
||
<p><code>unzip [-d] 参数</code></p>
|
||
<p><img src="/pictures/20221027221939.png" alt="image-20221027221939899"></p>
|
||
<h2 id="su命令"><a href="#su命令" class="headerlink" title="su命令"></a>su命令</h2><p>切换用户</p>
|
||
<p>语法:<code>su [-] [用户]</code></p>
|
||
<p><img src="/pictures/20221027222021.png" alt="image-20221027222021619"></p>
|
||
<h2 id="sudo命令"><a href="#sudo命令" class="headerlink" title="sudo命令"></a>sudo命令</h2><p><img src="/pictures/20221027222035.png" alt="image-20221027222035337"></p>
|
||
<p>比如:</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">itheima ALL=(ALL) NOPASSWD: ALL</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>在visudo内配置如上内容,可以让itheima用户,无需密码直接使用 <code>sudo</code></p>
|
||
<h2 id="chmod命令"><a href="#chmod命令" class="headerlink" title="chmod命令"></a>chmod命令</h2><p>修改文件、文件夹权限</p>
|
||
<p>语法:<code>chmod [-R] 权限 参数</code></p>
|
||
<p>权限可以用3位数字来代表,第一位数字表示用户权限,第二位表示用户组权限,第三位表示其它用户权限。数字的细节如下:r记为4,w记为2,x记为1,可以有:</p>
|
||
<ul>
|
||
<li><p>权限,要设置的权限,比如755,表示:<code>rwxr-xr-x</code></p>
|
||
<p><img src="/pictures/20221027222157.png" alt="image-20221027222157276"></p>
|
||
</li>
|
||
<li><p>参数,被修改的文件、文件夹</p>
|
||
</li>
|
||
<li><p>选项-R,设置文件夹和其内部全部内容一样生效</p>
|
||
</li>
|
||
</ul>
|
||
<p><strong>示例:</strong></p>
|
||
<p> • chmod u=rwx,g=rx,o=x hello.txt ,将文件权限修改为:rwxr-x–x</p>
|
||
<p> • 其中:u表示user所属用户权限,g表示group组权限,o表示other其它用户权限</p>
|
||
<p> • chmod -R u=rwx,g=rx,o=x test,将文件夹test以及文件夹内全部内容权限设置为:rwxr-x–x</p>
|
||
<p>除此之外,还有快捷写法:<strong>chmod 751 hello.txt</strong>,所以751表示: rwx(7) r-x(5) –x(1)[数字代表的含义见上面]</p>
|
||
<p><strong>rwx的含义</strong></p>
|
||
<p> • r表示读权限</p>
|
||
<p> • w表示写权限</p>
|
||
<p> • x表示执行权限</p>
|
||
<p><strong>针对文件、文件夹的不同,rwx的含义有细微差别</strong></p>
|
||
<p> •r,针对文件可以查看文件内容</p>
|
||
<p> •针对文件夹,可以查看文件夹内容,如ls命令</p>
|
||
<p> •w,针对文件表示可以修改此文件</p>
|
||
<p> •针对文件夹,可以在文件夹内:创建、删除、改名等操作</p>
|
||
<p> •x,针对文件表示可以将文件作为程序执行</p>
|
||
<p> •针对文件夹,表示可以更改工作目录到此文件夹,即cd进入</p>
|
||
<p><img src="/pictures/image-20230925112857636.png" alt="image-20230925112857636"></p>
|
||
<p>举例:drwxr-xr-x,表示:</p>
|
||
<p>•这是一个文件夹,首字母d表示</p>
|
||
<p>•所属用户(右上角图序号2)的权限是:有r有w有x,rwx</p>
|
||
<p>•所属用户组(右上角图序号3)的权限是:有r无w有x,r-x (-表示无此权限)</p>
|
||
<p>•其它用户的权限是:有r无w有x,r-x</p>
|
||
<h2 id="chown命令"><a href="#chown命令" class="headerlink" title="chown命令"></a>chown命令</h2><p>修改文件、文件夹所属用户、组</p>
|
||
<p>语法:<code>chown [-R] [用户][:][用户组] 文件或文件夹</code></p>
|
||
<p><img src="/pictures/20221027222326.png" alt="image-20221027222326192"></p>
|
||
<h2 id="用户组管理"><a href="#用户组管理" class="headerlink" title="用户组管理"></a>用户组管理</h2><p><img src="/pictures/20221027222354.png" alt="image-20221027222354498"></p>
|
||
<h2 id="用户管理"><a href="#用户管理" class="headerlink" title="用户管理"></a>用户管理</h2><p><img src="/pictures/20221027222407.png" alt="image-20221027222407618"></p>
|
||
<h2 id="genent命令"><a href="#genent命令" class="headerlink" title="genent命令"></a>genent命令</h2><ul>
|
||
<li><p><code>getent group</code>,查看系统全部的用户组</p>
|
||
<p><img src="/pictures/20221027222446.png" alt="image-20221027222446514"></p>
|
||
</li>
|
||
<li><p><code>getent passwd</code>,查看系统全部的用户</p>
|
||
<p><img src="/pictures/20221027222512.png" alt="image-20221027222512274"></p>
|
||
</li>
|
||
</ul>
|
||
<h2 id="env命令"><a href="#env命令" class="headerlink" title="env命令"></a>env命令</h2><p>查看系统全部的环境变量</p>
|
||
<p>语法:<code>env</code></p>
|
||
<h2 id="开启指定端口的防火墙限制"><a href="#开启指定端口的防火墙限制" class="headerlink" title="开启指定端口的防火墙限制"></a>开启指定端口的防火墙限制</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">永久性地在防火墙配置中打开TCP的9000端口</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">--permanent表示永久的</span></span><br><span class="line">sudo firewall-cmd --permanent --add-port=9000/tcp</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">刷新防火墙规则</span></span><br><span class="line">sudo firewall-cmd --reload</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="实用的小技巧"><a href="#实用的小技巧" class="headerlink" title="实用的小技巧"></a>实用的小技巧</h2><h3 id="history命令"><a href="#history命令" class="headerlink" title="history命令"></a>history命令</h3><p>用于查看历史输入的命令</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">root@DESKTOP-PC4GEUR:/# history</span><br><span class="line"> 1 cd /</span><br><span class="line"> 2 ls</span><br><span class="line"> 3 clear</span><br><span class="line"> 4 ls</span><br><span class="line"> 5 cd /</span><br><span class="line"> 略略略</span><br><span class="line"> 51 clear</span><br><span class="line"> 52 hostory</span><br><span class="line"> 53 clear</span><br><span class="line"> 54 history</span><br><span class="line">root@DESKTOP-PC4GEUR:/#</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="光标移动的快捷键"><a href="#光标移动的快捷键" class="headerlink" title="光标移动的快捷键"></a>光标移动的快捷键</h3><p><img src="/pictures/image-20230925132050649.png" alt="image-20230925132050649"></p>
|
||
<h3 id="小技巧汇总"><a href="#小技巧汇总" class="headerlink" title="小技巧汇总"></a>小技巧汇总</h3><p><img src="/pictures/image-20230925133017257.png" alt="image-20230925133017257"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>运维</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>Linux</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>免费域名注册教程</title>
|
||
<url>/posts/5727.html</url>
|
||
<content><![CDATA[<h1 id="一-域名注册"><a href="#一-域名注册" class="headerlink" title="一.域名注册"></a>一.域名注册</h1><p><strong>免费域名注册网址:<a href="https://nic.eu.org/">https://nic.eu.org</a></strong></p>
|
||
<p><img src="/pictures/image-20230913123344514.png" alt="image-20230913123344514"></p>
|
||
<h2 id="1-注册账号"><a href="#1-注册账号" class="headerlink" title="1.注册账号"></a>1.注册账号</h2><p>第一步:点击: here</p>
|
||
<p><img src="/pictures/image-20230913123704246.png" alt="image-20230913123704246"></p>
|
||
<p>第二步: 点击Register</p>
|
||
<p><img src="/pictures/image-20230913123809940.png" alt="image-20230913123809940"></p>
|
||
<p>第三步:填写相关的信息</p>
|
||
<p>地址信息填写英国的地址,可以使用在线地址生成器生成:<a href="https://www.meiguodizhi.com/uk-address">https://www.meiguodizhi.com/uk-address</a></p>
|
||
<p><img src="/pictures/image-20230913124042655.png" alt="image-20230913124042655"></p>
|
||
<p>填写地址相关的信息,其余的信息根据自己的情况填写(fax可不填)</p>
|
||
<p><img src="/pictures/image-20230913124616244.png" alt="image-20230913124616244"></p>
|
||
<p>显示下面的提示就是注册成功了</p>
|
||
<p><img src="/pictures/image-20230913124842536.png" alt="image-20230913124842536"></p>
|
||
<p>这时在系统会给刚才注册的邮箱发送一个激活链接,点击激活</p>
|
||
<p><img src="/pictures/image-20230913125129535.png" alt="image-20230913125129535"></p>
|
||
<p>打开链接之后点击的按钮<strong>Validate</strong>验证,验证之后显示如下页面表示成功</p>
|
||
<p><img src="/pictures/image-20230913125324974.png" alt="image-20230913125324974"></p>
|
||
<h2 id="2-登录"><a href="#2-登录" class="headerlink" title="2.登录"></a>2.登录</h2><p>登录的账号就在刚才发送的邮件里面,密码就是注册时设置的密码</p>
|
||
<p><img src="/pictures/image-20230913125539561.png" alt="image-20230913125539561"></p>
|
||
<h2 id="3-申请域名"><a href="#3-申请域名" class="headerlink" title="3.申请域名"></a>3.申请域名</h2><p>输入你要注册的域名,域名的格式是 xxxx.eu.org</p>
|
||
<p><img src="/pictures/image-20230913132602702.png" alt="image-20230913132602702"></p>
|
||
<p>域名验证</p>
|
||
<p><img src="/pictures/image-20230913132742999.png" alt="image-20230913132742999"></p>
|
||
<p>点击Submit按钮之后显示如下的内容表示这个免费的域名是可以申请到的,然后等待人工审核通过</p>
|
||
<p><img src="/pictures/image-20230913132918535.png" alt="image-20230913132918535"></p>
|
||
<p>审核通过之后,你注册时使用的邮箱就会收到信息</p>
|
||
]]></content>
|
||
<categories>
|
||
<category>个人</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>域名注册</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>代码注释模板</title>
|
||
<url>/posts/1727.html</url>
|
||
<content><![CDATA[<p>完整的模板大全:<a href="https://github.com/OBKoro1/koro1FileHeader/wiki/%E4%BD%9B%E7%A5%96%E4%BF%9D%E4%BD%91%E6%B0%B8%E6%97%A0BUG%E3%80%81%E7%A5%9E%E5%85%BD%E6%8A%A4%E4%BD%93%E3%80%81%E6%B3%A8%E9%87%8A%E5%9B%BE%E6%A1%88">佛祖保佑永无BUG、神兽护体、注释图案 · OBKoro1/koro1FileHeader Wiki (github.com)</a></p>
|
||
<p>在线生成代码注释模板:<a href="http://patorjk.com/software/taag/">http://patorjk.com/software/taag/</a></p>
|
||
<p><img src="/pictures/image-20240113150435680.png" alt="image-20240113150435680"></p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"></span><br><span class="line"> ██╗ █████╗ ███████╗ ██████╗ ███╗ ██╗███████╗ ██████╗ ██████╗ ███╗ ██╗ ██████╗ ██████╗ ██╗████████╗███████╗███████╗ ██╗ ██████╗ </span><br><span class="line"> ██║██╔══██╗██╔════╝██╔═══██╗████╗ ██║██╔════╝██╔════╝ ██╔═══██╗████╗ ██║██╔════╝ ██╔════╝ ██║╚══██╔══╝██╔════╝██╔════╝ ██║██╔═══██╗</span><br><span class="line"> ██║███████║███████╗██║ ██║██╔██╗ ██║███████╗██║ ███╗██║ ██║██╔██╗ ██║██║ ███╗ ██║ ███╗██║ ██║ █████╗ █████╗ ██║██║ ██║</span><br><span class="line">██ ██║██╔══██║╚════██║██║ ██║██║╚██╗██║╚════██║██║ ██║██║ ██║██║╚██╗██║██║ ██║ ██║ ██║██║ ██║ ██╔══╝ ██╔══╝ ██║██║ ██║</span><br><span class="line">╚█████╔╝██║ ██║███████║╚██████╔╝██║ ╚████║███████║╚██████╔╝╚██████╔╝██║ ╚████║╚██████╔╝██╗╚██████╔╝██║ ██║ ███████╗███████╗██╗██║╚██████╔╝</span><br><span class="line"> ╚════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚═╝╚═╝ ╚═════╝ </span><br></pre></td></tr></table></figure>
|
||
|
||
<p>VScode插件推荐:<strong>koroFileHeader</strong> (用于生成文件头部注释和函数注释的插件)</p>
|
||
<p><img src="/pictures/image-20230912105041466.png" alt="image-20230912105041466"></p>
|
||
<h2 id="佛祖保佑一"><a href="#佛祖保佑一" class="headerlink" title="佛祖保佑一"></a>佛祖保佑一</h2><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"></span><br><span class="line"><span class="comment">////////////////////////////////////////////////////////////////////</span></span><br><span class="line"><span class="comment">// _ooOoo_ //</span></span><br><span class="line"><span class="comment">// o8888888o //</span></span><br><span class="line"><span class="comment">// 88" . "88 //</span></span><br><span class="line"><span class="comment">// (| ^_^ |) //</span></span><br><span class="line"><span class="comment">// O\ = /O //</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="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="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="comment">// 佛祖保佑 永无BUG 永不修改 //</span></span><br><span class="line"><span class="comment">////////////////////////////////////////////////////////////////////</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="佛祖保佑一-1"><a href="#佛祖保佑一-1" class="headerlink" title="佛祖保佑一"></a>佛祖保佑一</h2><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * _ooOoo_</span></span><br><span class="line"><span class="comment"> * o8888888o</span></span><br><span class="line"><span class="comment"> * 88" . "88</span></span><br><span class="line"><span class="comment"> * (| -_- |)</span></span><br><span class="line"><span class="comment"> * O\ = /O</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="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="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="comment"> * 佛祖保佑 永无BUG</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="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="comment">*/</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="草泥马一"><a href="#草泥马一" class="headerlink" title="草泥马一"></a>草泥马一</h2><figure class="highlight java"><table><tr><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="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="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="comment"> * ┃ ┃ 代码无bug </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="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></pre></td></tr></table></figure>
|
||
|
||
<h2 id="草泥马二"><a href="#草泥马二" class="headerlink" title="草泥马二"></a>草泥马二</h2><figure class="highlight java"><table><tr><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="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="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="comment"> * ┃ ┃ 代码无bug </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="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></pre></td></tr></table></figure>
|
||
|
||
<h2 id="全键盘"><a href="#全键盘" class="headerlink" title="全键盘"></a>全键盘</h2><figure class="highlight java"><table><tr><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"> * │Esc│ │ F1│ F2│ F3│ F4│ │ F5│ F6│ F7│ F8│ │ F9│F10│F11│F12│ │P/S│S L│P/B│ ┌┐ ┌┐ ┌┐</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│@ 2│# 3│$ 4│% 5│^ 6│& 7│* 8│( 9│) 0│_ -│+ =│ BacSp │ │Ins│Hom│PUp│ │N L│ / │ * │ - │</span></span><br><span class="line"><span class="comment"> * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ ├───┼───┼───┼───┤</span></span><br><span class="line"><span class="comment"> * │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │{ [│} ]│ | \ │ │Del│End│PDn│ │ 7 │ 8 │ 9 │ │</span></span><br><span class="line"><span class="comment"> * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ ├───┼───┼───┤ + │</span></span><br><span class="line"><span class="comment"> * │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │: ;│" '│ Enter │ │ 4 │ 5 │ 6 │ │</span></span><br><span class="line"><span class="comment"> * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ ├───┼───┼───┼───┤</span></span><br><span class="line"><span class="comment"> * │ Shift │ Z │ X │ C │ V │ B │ N │ M │< ,│> .│? /│ Shift │ │ ↑ │ │ 1 │ 2 │ 3 │ │</span></span><br><span class="line"><span class="comment"> * ├─────┬──┴─┬─┴──┬┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ ├───┴───┼───┤ E││</span></span><br><span class="line"><span class="comment"> * │ Ctrl│ │Alt │ Space │ Alt│ │ │Ctrl│ │ ← │ ↓ │ → │ │ 0 │ . │←─┘│</span></span><br><span class="line"><span class="comment"> * └─────┴────┴────┴───────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ └───────┴───┴───┘</span></span><br><span class="line"><span class="comment"> */</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="小键盘"><a href="#小键盘" class="headerlink" title="小键盘"></a>小键盘</h2><figure class="highlight java"><table><tr><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"> * ││Esc│!1 │@2 │#3 │$4 │%5 │^6 │&7 │*8 │(9 │)0 │_- │+= │|\ │`~ ││</span></span><br><span class="line"><span class="comment"> * │├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┤│</span></span><br><span class="line"><span class="comment"> * ││ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │{[ │}] │ BS ││</span></span><br><span class="line"><span class="comment"> * │├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤│</span></span><br><span class="line"><span class="comment"> * ││ Ctrl │ A │ S │ D │ F │ G │ H │ J │ K │ L │: ;│" '│ Enter ││</span></span><br><span class="line"><span class="comment"> * │├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤│</span></span><br><span class="line"><span class="comment"> * ││ Shift │ Z │ X │ C │ V │ B │ N │ M │< ,│> .│? /│Shift │Fn ││</span></span><br><span class="line"><span class="comment"> * │└─────┬──┴┬──┴──┬┴───┴───┴───┴───┴───┴──┬┴───┴┬──┴┬─────┴───┘│</span></span><br><span class="line"><span class="comment"> * │ │Fn │ Alt │ Space │ Alt │Win│ HHKB │</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></pre></td></tr></table></figure>
|
||
|
||
<p><strong>耶稣</strong></p>
|
||
<figure class="highlight java"><table><tr><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="comment"> * | |</span></span><br><span class="line"><span class="comment"> * | |</span></span><br><span class="line"><span class="comment"> * |~.\\\_\~~~~~~~~~~~~~~xx~~~ ~~~~~~~~~~~~~~~~~~~~~/_//;~|</span></span><br><span class="line"><span class="comment"> * | \ o \_ ,XXXXX), _..-~ o / |</span></span><br><span class="line"><span class="comment"> * | ~~\ ~-. XXXXX`)))), _.--~~ .-~~~ |</span></span><br><span class="line"><span class="comment"> * ~~~~~~~`\ ~\~~~XXX' _/ ';)) |~~~~~~..-~ _.-~ ~~~~~~~</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="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="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="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="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="comment"> * ( | | |</span></span><br><span class="line"><span class="comment"> * | \ \ |</span></span><br><span class="line"><span class="comment"> * || o `.)|</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></pre></td></tr></table></figure>
|
||
|
||
<h2 id="美女"><a href="#美女" class="headerlink" title="美女"></a>美女</h2><figure class="highlight java"><table><tr><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="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="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="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></pre></td></tr></table></figure>
|
||
|
||
<h2 id="程序员之歌"><a href="#程序员之歌" class="headerlink" title="程序员之歌"></a>程序员之歌</h2><figure class="highlight java"><table><tr><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"> * 千行代码,Bug何处藏。</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="comment"> * 每晚灯火阑珊处,夜难寐,加班狂。</span></span><br><span class="line"><span class="comment"> * </span></span><br><span class="line"><span class="comment"> */</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="龙图腾"><a href="#龙图腾" class="headerlink" title="龙图腾"></a>龙图腾</h2><figure class="highlight java"><table><tr><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="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="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="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="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="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="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="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="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="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></pre></td></tr></table></figure>
|
||
|
||
<h2 id="蝙蝠"><a href="#蝙蝠" class="headerlink" title="蝙蝠"></a>蝙蝠</h2><figure class="highlight java"><table><tr><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="comment"> * _/############// (@::@) \############\_</span></span><br><span class="line"><span class="comment"> * /#############(( \\// ))#############\</span></span><br><span class="line"><span class="comment"> * -###############\\ (oo) //###############-</span></span><br><span class="line"><span class="comment"> * -#################\\ / VV \ //#################-</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"> * ` |/ V V ` V \#\| | | |/#/ V ' V V \| '</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"> * (vvv(VVV)(VVV)vvv)</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"> * 神兽保佑 永无BUG</span></span><br><span class="line"><span class="comment"> */</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="喷火龙"><a href="#喷火龙" class="headerlink" title="喷火龙"></a>喷火龙</h2><figure class="highlight java"><table><tr><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"> * ___-==_ _-~o~ \/ ||| \\ _/~~-</span></span><br><span class="line"><span class="comment"> * __---~~~.==~||\=_ -_--~/_-~|- |\\ \\ _/~</span></span><br><span class="line"><span class="comment"> * _-~~ .=~ | \\-_ '-~7 /- / || \ /</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="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"> * -_ ~\ ~~---l__i__i__i--~~_/</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="comment"> * </span></span><br><span class="line"><span class="comment"> * 神兽保佑 永无BUG</span></span><br><span class="line"><span class="comment"> */</span></span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>个人</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>注释模板</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>面试题集锦</title>
|
||
<url>/posts/29985.html</url>
|
||
<content><![CDATA[<p><strong>参考资料:</strong></p>
|
||
<p><a href="https://www.nowcoder.com/issue/tutorial?tutorialId=94&uuid=ea1986fcff294f6292385703e94689e8">Java工程师面试 宝典学习说明_互联网校招面试真题面经汇总_牛客网 (nowcoder.com)</a></p>
|
||
<p><a href="https://javaguide.cn/java/">Java | JavaGuide(Java面试 + 学习指南)</a></p>
|
||
<h2 id="一-Java基础面试题"><a href="#一-Java基础面试题" class="headerlink" title="一.Java基础面试题"></a>一.Java基础面试题</h2><h3 id="1-谈谈你对面向对象的理解"><a href="#1-谈谈你对面向对象的理解" class="headerlink" title="1.谈谈你对面向对象的理解"></a>1.谈谈你对面向对象的理解</h3><p> 对比面向过程,是两种不同处理问题的角度,面向过程更注重事情的每一步骤及顺序,面向对象更注重事情有哪些参与者(对象),以及各自需要做什么。面向过程比较直接高效,面向对象易于复用、扩展和维护。</p>
|
||
<p>面向对象的三大基本特征:封装、继承、多态(父类应用指向子类对象)</p>
|
||
<h3 id="2-JDK、JRE、JVM之间的区别"><a href="#2-JDK、JRE、JVM之间的区别" class="headerlink" title="2.JDK、JRE、JVM之间的区别"></a>2.JDK、JRE、JVM之间的区别</h3><p>JDK java 开发工具</p>
|
||
<p>JRE(Java Runtime Environment Java 运行环境)</p>
|
||
<p>JVM java虚拟机</p>
|
||
<p>JDK = JRE + 开发工具集(例如 Javac,java 编译工具等)</p>
|
||
<p>JRE = JVM + Java SE 标准类库(java 核心类库)</p>
|
||
<h3 id="3-和equals⽅法的区别"><a href="#3-和equals⽅法的区别" class="headerlink" title="3.==和equals⽅法的区别"></a>3.==和equals⽅法的区别</h3><p>==:如果是基本数据类型,⽐较是值,如果是引⽤类型,⽐较的是引⽤地址<br>equals:具体看各个类重写equals⽅法之后的⽐较逻辑,⽐如String类,虽然是引⽤类型,但是String类中重写了equals⽅法,⽅法内部⽐较的是字符串中的各个字符是否全部相等。</p>
|
||
<h3 id="4-String-StringBuffer-StringBuilder的区别"><a href="#4-String-StringBuffer-StringBuilder的区别" class="headerlink" title="4.String,StringBuffer,StringBuilder的区别"></a>4.String,StringBuffer,StringBuilder的区别</h3><p>1.String是不可变的,如果尝试去修改,会新⽣成⼀个字符串对象,StringBuffer和StringBuilder是可变的,修改是在原对象上操作的</p>
|
||
<p>2.StringBuffer是线程安全的,StringBuilder是线程不安全的,所以在单线程环境下StringBuilder效率会更⾼</p>
|
||
<p>性能: StringBuilder > StringBuffer > String</p>
|
||
<h3 id="5-重载和重写的区别"><a href="#5-重载和重写的区别" class="headerlink" title="5.重载和重写的区别"></a>5.重载和重写的区别</h3><p>重载:发生在同一个类中,方法名必须相同,参数类型不同、个数不同、顺序不同、方法返回值和访问修饰符可以不同,发生在编译时。</p>
|
||
<p>重写:发生在父子类中,方法名,参数列表必须相同,返回值范围小于等于父类,抛出异常范围小于等于父类,访问修饰符范围大于等于父类;如果父类访问修饰符为私有,子类不能重写该方法。</p>
|
||
<h3 id="6-接口和抽象类的区别"><a href="#6-接口和抽象类的区别" class="headerlink" title="6.接口和抽象类的区别"></a>6.接口和抽象类的区别</h3><p>1.抽象类可以有实现的方法和抽象的方法</p>
|
||
<p>2.抽象类的成员变量可以是各种类型的,接口中的成员变量只能是public static final类型(默认)的</p>
|
||
<p>3.抽象类只能继承一个,接口可以实现多个</p>
|
||
<p>4.关键字不同,接口的关键字是interface,抽象类的关键字是abstract</p>
|
||
<h3 id="7-List和set的区别"><a href="#7-List和set的区别" class="headerlink" title="7.List和set的区别"></a>7.List和set的区别</h3><p>List:有序,按对象进入的顺序保存对象,可重复,允许多个Null元素对象,可以使用iterator取出所有的元素,在逐一遍历,还可以使用get(int index)获取指定下标的元素。</p>
|
||
<p>Set:无序,不可重复,最多允许有一个Null元素对象,取元素时只能用iterator接口取得所有元素,再逐一遍历各个元素。</p>
|
||
<h3 id="8-hashCode-与equals-之间的关系"><a href="#8-hashCode-与equals-之间的关系" class="headerlink" title="8.hashCode()与equals()之间的关系"></a>8.hashCode()与equals()之间的关系</h3><p>hashCode()的作用是获取哈希码,也称散列码,哈希码的作用是确定该对象在哈希表中的索引位置。</p>
|
||
<ul>
|
||
<li><p>如果两个对象相等,那么它们的hashCode()值一定相同</p>
|
||
</li>
|
||
<li><p>如果两个对象hashCode()相等,它们并不一定相等</p>
|
||
</li>
|
||
</ul>
|
||
<h3 id="9-ArrayList和LinkedList的区别"><a href="#9-ArrayList和LinkedList的区别" class="headerlink" title="9.ArrayList和LinkedList的区别"></a>9.ArrayList和LinkedList的区别</h3><p>ArrayList:基于动态数组,连续内存存储,适合下标访问(随机访问)。扩容机制:因为数组长度固定,超出长度存数据时需要新建数组,将老数组的数据拷贝到新数组,然后插入需要加入到数组中的数据。</p>
|
||
<p>LinkedList:基于链表,可以存储在分散的内存中,适合做数据插入及删除操作,不适合查询。遍历LinkedList必须使用iterator不能使用for循环,因为for循环体内通过get(i)取得某一元素时都需要对list重新遍历,性能消耗大。</p>
|
||
<h3 id="10-HashMap和HashTable的区别?底层实现是什么"><a href="#10-HashMap和HashTable的区别?底层实现是什么" class="headerlink" title="10.HashMap和HashTable的区别?底层实现是什么?"></a>10.HashMap和HashTable的区别?底层实现是什么?</h3><p>区别:</p>
|
||
<p>1.HashMap方法没有synchronized修饰,线程非安全,HashTable线程安全</p>
|
||
<p>2.HashMap允许key和value为null,而HashTable不允许</p>
|
||
<p>底层实现: 数组 + 链表</p>
|
||
<h3 id="11-ConcurrentHashMap"><a href="#11-ConcurrentHashMap" class="headerlink" title="11.ConcurrentHashMap"></a>11.ConcurrentHashMap</h3><p>ConcurrentHashMap和HashTable都是线程安全的,但ConcurrentHashMap相比HashTable性能更高</p>
|
||
<h3 id="12-如何实现一个IOC容器"><a href="#12-如何实现一个IOC容器" class="headerlink" title="12.如何实现一个IOC容器"></a>12.如何实现一个IOC容器</h3><p>1.配置文件配置包扫描路径</p>
|
||
<p>2.递归包扫描获取.class文件</p>
|
||
<p>3.反射、确定需要交给IOC管理的类</p>
|
||
<p>4.对需要注入的类进行依赖注入</p>
|
||
<h3 id="13-什么是字节码?采用字节码的好处是什么?"><a href="#13-什么是字节码?采用字节码的好处是什么?" class="headerlink" title="13.什么是字节码?采用字节码的好处是什么?"></a>13.什么是字节码?采用字节码的好处是什么?</h3><p><strong>什么是字节码?</strong></p>
|
||
<p>Java中引入了虚拟机的概念,即在机器和编译程序之间加入了一层抽象的虚拟的机器。编译程序只需要面向虚拟机,生成虚拟机能够理解的代码,然后由解释器来将虚拟机代码转化为特定系统的机器码执行,在java中,这种供虚拟机理解的代码叫做字节码(即扩展名为.class的文件)。</p>
|
||
<p><strong>采用字节码的好处是什么?</strong></p>
|
||
<p>Java语言通过字节码的方式,在一定程度上解决了传统解释型语言执行效率的问题,同时又保留了解释型语言可移植的特点。所以Java程序运行时比较高效,而且,由于字节码并不专对一种特定的机器,因此,Java程序无需重新编译便可在多种计算机上运行。</p>
|
||
<h3 id="14-Java类加载器有哪些"><a href="#14-Java类加载器有哪些" class="headerlink" title="14.Java类加载器有哪些"></a>14.Java类加载器有哪些</h3><p>JDK有三个类加载器:</p>
|
||
<ol>
|
||
<li>bootstrap ClassLoader是ExClassLoader 的父类加载器,默认负责加载%JAVA_HOME%bin下的jar包和class文件</li>
|
||
<li>ExClassLoader是AppClassLoader的父类加载器,负责加载%JAVA_HOME%/bin/ext文件夹下的jar包和class文件</li>
|
||
<li>AppClassLoader是自定义加载器的父类,负责加载classpath下的类文件,系统类加载器,线程上下文加载器</li>
|
||
</ol>
|
||
<p>自定义加载器的方法: 继承ClassLoader实现自定义加载器</p>
|
||
<h3 id="15-双亲委派模型"><a href="#15-双亲委派模型" class="headerlink" title="15.双亲委派模型"></a>15.双亲委派模型</h3><p><strong>双亲委派模型的执行流程是这样的:</strong> </p>
|
||
<p>1、当加载一个类时,会先从应用程序类加载器的缓存里查找相应的类,如果能找到就返回对象,如果找不到就执行下面流程;</p>
|
||
<p>2、在扩展加载器缓存中查找相应的类,如果能找到就返回对象,如果找不到就继续下面流程;</p>
|
||
<p>3、在启动类加载器中查询相应的类,如果找到就返回对象,如果找不到就继续下面流程;</p>
|
||
<p>4、在扩展加载器中查找并加载类,如果能找到就返回对象,并将对象加入到缓存中,如果找不到就继续下面流程;</p>
|
||
<p>5、在应用程序类加载器中查找并加载类,如果能找到就返回对象,并将对象加入到缓存中,如果找不到就返回 ClassNotFound 异常。</p>
|
||
<p><strong>加载流程如下图所示:</strong></p>
|
||
<p><img src="/pictures/image-20230904161407239.png" alt="image-20230904161407239"></p>
|
||
<p>一般“双亲”指的是“父亲”和“母亲”,而在这里“双亲”指的是类加载类先向上找,再向下找的流程就叫做双亲委派模型。</p>
|
||
<p><strong>双亲委派模型的好处</strong></p>
|
||
<ol>
|
||
<li>主要是为了安全性,避免用户自己编写的类动他替换java的一些核心类,比如String</li>
|
||
<li>同时避免了类的重复加载,因为jvm中区分不同类,不仅仅是根据类名,相同的class文件被不同的ClassLoader加载就是不同的两个类</li>
|
||
</ol>
|
||
<h3 id="16-Java中的异常体系"><a href="#16-Java中的异常体系" class="headerlink" title="16.Java中的异常体系"></a>16.Java中的异常体系</h3><ol>
|
||
<li>Java中所有异常都来自顶级父类Throwable</li>
|
||
<li>Throwable下面有两个子类Exception和Error</li>
|
||
<li>Error是程序无法处理的错误,一旦出现这个错误,程序将被迫停止运行;Exception不会导致程序停止</li>
|
||
<li>Exception有分为两个部分RunTimeException运行时异常和CheckedException检查异常</li>
|
||
<li>RunTimeException常常发生在程序运行过程中,会导致程序当前线程执行失败。CheckedException常常发生在程序编译过程中,会导致程序编译不通过。</li>
|
||
</ol>
|
||
<h3 id="17-GC如何判断对象可以被回收"><a href="#17-GC如何判断对象可以被回收" class="headerlink" title="17.GC如何判断对象可以被回收"></a>17.GC如何判断对象可以被回收</h3><ul>
|
||
<li>引用计数法:每一个对象有一个引用计数属性,新增一个引用计数加1,引用释放减1,计数为0时可以回收。(java中没有使用这个方法,原因:可能会出现A引用了B,B又引用了A,这时就算他们都不再使用了,但是因为他们互相引用,计数器=1永远无法被回收)</li>
|
||
<li>可达性分析法:从GC Roots开始向下搜索,搜索所走过的路径称为引用链。当一个对象到GC Roots没有任何引用链相连时,则证明此对象是不可用的,那么虚拟机就可以判断是可回收对象。</li>
|
||
</ul>
|
||
<h3 id="18-线程的生命周期,线程有哪些状态"><a href="#18-线程的生命周期,线程有哪些状态" class="headerlink" title="18.线程的生命周期,线程有哪些状态"></a>18.线程的生命周期,线程有哪些状态</h3><p>线程通常有五种状态:创建、就绪、运行、阻塞、死亡状态</p>
|
||
<p>阻塞又分为三种情况:等待阻塞、同步阻塞、其他阻塞</p>
|
||
<ol>
|
||
<li>新建状态:新创建了一个线程对象</li>
|
||
<li>就绪状态:线程对象创建后,其他线程调用了该对象的start()方法。该线程位于可运行线程池中,变得可运行,等待获取CPU的使用权</li>
|
||
<li>运行状态:就绪状态的线程获取了CPU,执行了程序代码</li>
|
||
<li>阻塞状态:阻塞状态是线程因为某种原因放弃了CPU使用权,暂时停止运行。直到线程进入就绪状态,才有机会转到运行状态</li>
|
||
<li>死亡状态:线程执行完了或者因为异常退出了run()方法,该线程结束生命周期</li>
|
||
</ol>
|
||
<h3 id="19-sleep-wait-join-yield-的区别"><a href="#19-sleep-wait-join-yield-的区别" class="headerlink" title="19.sleep(),wait(),join(),yield()的区别"></a>19.sleep(),wait(),join(),yield()的区别</h3><p><strong>sleep(),wait()的区别</strong></p>
|
||
<ol>
|
||
<li>sleep()是Thread类的静态本地方法,wait()是Object类的本地方法</li>
|
||
<li>sleep()不会释放锁(把锁带着进入冻结状态),wait会释放锁</li>
|
||
<li>sleep方法不依赖于同步器synchronized,但是wait需要依赖synchronized关键字</li>
|
||
<li>sleep不需要被唤醒(休眠之后退出阻塞),但是wait需要(不指定时间需要被别人中断)</li>
|
||
<li>sleep一般用于当前线程休眠,或者轮循暂停操作,wait则用于多线程之间的通信</li>
|
||
<li>sleep会让出cpu执行时间且强制上下文切换,而wait则不一定,wait后可能还是有机会重新竞争到锁继续执行</li>
|
||
</ol>
|
||
<p><strong>yield()执行后线程直接进入就绪状态,马上释放了cpu,但是依然保留了cpu的执行资格,所有有可能cpu下次进行线程调度还会让这个线程取到执行权</strong></p>
|
||
<p><strong>join()执行后线程进入阻塞状态,例如在线程B中调用了A的join(),那线程B会进入到阻塞队列,直到线程A结束或者中断线程</strong></p>
|
||
<h3 id="20-说说你对线程安全的理解"><a href="#20-说说你对线程安全的理解" class="headerlink" title="20.说说你对线程安全的理解"></a>20.说说你对线程安全的理解</h3><p>线程安全讲的不是线程安全,应该是<strong>内存安全</strong>,<strong>堆是共享内存,可以被所有线程访问</strong></p>
|
||
<p><strong>线程安全的定义</strong>:当多个线程访问一个对象的时候,如果不用进行<strong>额外的同步控制或者其他的协调操作</strong>,调用这个对象的行为都可以获得<strong>正确的结果</strong>,我们就说这个线程数是安全的。</p>
|
||
<p><strong>产生线程安全问题的原因:</strong> 在每个进程的内存空间中都会有一块特殊的公共区域,通常称为堆(内存)。进程内所有线程都可以访问到该区域,这就是造成问题的潜在原因。</p>
|
||
<h3 id="21-说说你对守护线程的理解"><a href="#21-说说你对守护线程的理解" class="headerlink" title="21.说说你对守护线程的理解"></a>21.说说你对守护线程的理解</h3><p><strong>守护线程</strong>:为非守护线程(用户线程)提供服务的线程,任何一个守护线程都是整个jvm中所有非守护线程的守护线程。</p>
|
||
<p><strong>守护线程的作用:</strong></p>
|
||
<p>举例:GC垃圾回收机制,就是一个经典的守护线程,当我们的程序不再有任何运行的Thread,程序就不会再产生垃圾,垃圾回收器也就没事可做,所以当垃圾回收线程是jvm上仅剩的线程时,垃圾回收线程会自动离开,它始终再低级别的状态中运行,用于实时监控和管理系统中的可回收资源。</p>
|
||
<p><strong>应用场景:</strong></p>
|
||
<ol>
|
||
<li>为其他的线程提供服务支持情况</li>
|
||
<li>或者在任何情况下,程序结束时,这个线程必须正常的且立刻关闭,就可以作为守护线程来使用</li>
|
||
</ol>
|
||
<h3 id="22-ThreadLocal的原理和使用场景"><a href="#22-ThreadLocal的原理和使用场景" class="headerlink" title="22.ThreadLocal的原理和使用场景"></a>22.ThreadLocal的原理和使用场景</h3><p>同一个线程中通过ThreadLocal存进去的数据,在任何位置取出来是一致的</p>
|
||
<p><strong>原理</strong></p>
|
||
<p>每一个Thread对象均含有一个ThreadLocalMap类型的成员变量threadLocals,它存储<strong>本线程</strong>中所有ThreadLocal对象及对应的值。</p>
|
||
<p>当执行set()方法时,ThreadLocal首先会获取当前线程对象,然后获取当前线程的ThreadLocalMap对象。再以当前ThreadLocal对象为key,获取对应的value。</p>
|
||
<p>get方法的执行过程类似。ThreadLocal首先会获取当前线程对象,然后获取当前线程的ThreadLocalMap对象。再以当前ThreadLocal对象为key,获取对应的value。</p>
|
||
<p>由于每一条线程均含有各自<strong>私有</strong>的ThreadLocalMap容器,这些容器相互独立,互不影响,因此不会存在线程安全性问题,从而无需使用同步机制来保证多条线程访问容器的互斥性。</p>
|
||
<p><strong>使用场景</strong></p>
|
||
<ol>
|
||
<li>在进行对象的跨层传递的时候,使用ThreadLocal可以避免多次传递,打破层次间的约束</li>
|
||
<li>线程间数据隔离</li>
|
||
<li>进行事务操作,用于存储事务信息</li>
|
||
<li>数据库连接,Session会话管理</li>
|
||
</ol>
|
||
<h3 id="23-ThreadLocal内存泄漏原因,怎么避免"><a href="#23-ThreadLocal内存泄漏原因,怎么避免" class="headerlink" title="23.ThreadLocal内存泄漏原因,怎么避免"></a>23.ThreadLocal内存泄漏原因,怎么避免</h3><p><strong>内存泄漏</strong>:不会使用的对象或者变量占用的内存不能被回收,就是内存泄漏(内存泄漏为程序在申请内存后,无法释放已申请的内存空间,一次内存泄漏的危害可以忽略,但内存泄漏堆积后果很严重,无论多少内存,迟早会被占光,导致OOM。)</p>
|
||
<p>强引用:使用最普遍的引用(通过new),一个对象具有强应用,不会被垃圾回收器回收,即使是内存不足。我们想要取消强引用,可以显示的将引用赋值为null,jvm在合适的时间就会回收该对象。</p>
|
||
<p><strong>ThreadLocal内存泄漏的根源</strong></p>
|
||
<p>由于ThreadLocalMap的生命周期和Thread一样长,如果没有手动删除对应key就会导致内存泄漏</p>
|
||
<p><strong>怎么避免</strong></p>
|
||
<ol>
|
||
<li>每次使用ThreadLocal都调用它的remove()方法清除数据</li>
|
||
<li>将ThreadLocal变量定义成private static,这样就一直村子ThreadLocal的强应用,也就能保证任何时候都能通过ThreadLocal的弱引用访问到Entry的value值,进而清除掉。</li>
|
||
</ol>
|
||
<h3 id="24-产生内存泄漏的原因有哪些"><a href="#24-产生内存泄漏的原因有哪些" class="headerlink" title="24.产生内存泄漏的原因有哪些"></a>24.产生内存泄漏的原因有哪些</h3><ol>
|
||
<li>资源未关闭或释放导致内存泄露(io资源,数据库的连接)</li>
|
||
<li>使用 ThreadLocal 造成内存泄露</li>
|
||
<li>静态集合类引起内存泄漏,如HashMap、LinkedList等等。如果这些容器为静态的,那么它们的生命周期与程序一致,则容器中的对象在程序结束之前将不能被释放,从而造成内存泄漏。生命周期长的对象持有短生命周期对象的引用,尽管短生命周期的对象不再使用,但是因为长生命周期对象持有它的引用而导致不能被回收。</li>
|
||
<li>重写了 finalize() 的类,如果 finalize() 方法重写的不合理或 finalizer 队列无法跟上 Java 垃圾回收器的速度,那么迟早,应用程序会出现 OutOfMemoryError 异常</li>
|
||
</ol>
|
||
<h3 id="25-并发、并行、串行的区别"><a href="#25-并发、并行、串行的区别" class="headerlink" title="25.并发、并行、串行的区别"></a>25.并发、并行、串行的区别</h3><p>串行在时间上不可能发生重叠,前一个任务没有搞定,下一个任务只能等</p>
|
||
<p>并行在时间上是重叠的,两个任务在同一时刻互不干扰的同时执行</p>
|
||
<p>并发允许两个任务彼此干扰,同一时间点,只有一个任务运行,交替执行</p>
|
||
<h3 id="26-并发的三大特性"><a href="#26-并发的三大特性" class="headerlink" title="26.并发的三大特性"></a>26.并发的三大特性</h3><ul>
|
||
<li>原子性:是指在在一个操作中,CPU不可以在中途暂停然后再调度,即不被中断操作,要不全部执行完成,要不都不执行。</li>
|
||
<li>可见性:当多个线程访问同一个变量时,一个线程修改了这个变量的值,其他的线程能够立即看到修改的值。</li>
|
||
<li>有序性:虚拟机再进行代码编译的时,对于那些改变顺序之后不会对最终的结果造成影响的代码,虚拟机不一定会按照我们写的代码的顺序来执行,有可能将它们重排序。</li>
|
||
</ul>
|
||
<h3 id="27-为什么用线程池?解释线程池参数?"><a href="#27-为什么用线程池?解释线程池参数?" class="headerlink" title="27.为什么用线程池?解释线程池参数?"></a>27.为什么用线程池?解释线程池参数?</h3><p><strong>为什么</strong></p>
|
||
<ol>
|
||
<li>降低资源的消耗;提高线程的利用率,降低创建和销毁现成的消耗</li>
|
||
<li>提高响应速度,任务来了,直接有线程可用执行,不是创建线程之后再执行</li>
|
||
<li>提高线程的可管理性;线程是稀缺资源,使用线程池可以统一分配调优监控</li>
|
||
</ol>
|
||
<p><strong>线程池参数</strong></p>
|
||
<ul>
|
||
<li><code>corePoolSize</code>代表核心线程数,也就是正常情况下创建工作的线程数,这些线程创建之后不会消除,而是一种常驻线程。</li>
|
||
<li><code>maxnumPoolSize</code>代表最大线程数,它与核心线程数相对应,表示最大允许被创建的线程数,比如当前任务较多,将核心线程数都用完了,还无法满足要求时,此时就会创建新的线程,但是线程池总数不会超过最大线程数</li>
|
||
<li><code>keepAliveTime</code>空闲线程存活时间,当一个可被回收的线程的空闲时间大于keepAliveTime,就会被回收; unit:keepAliveTime的时间单位</li>
|
||
<li><code>workQueue</code>工作队列,存放待执行任务的队列:当提交的任务数超过核心线程数大小后,再提交的任务就存放在工作队列,任务调度时再从队列中取出任务。它仅仅用来存放被execute()方法提交的Runnable任务。工作队列实现了BlockingQueue接口。</li>
|
||
<li><code>threadFactory</code>线程工厂,创建线程的工厂,可以设定线程名、线程编号等。</li>
|
||
<li><code>handler</code>拒绝策略,当线程池线程数已满,并且工作队列达到限制,新提交的任务使用拒绝策略处理。可以自定义拒绝策略,拒绝策略需实现RejectedExecutionHandler接口。</li>
|
||
</ul>
|
||
<h3 id="28-简述线程池的处理流程"><a href="#28-简述线程池的处理流程" class="headerlink" title="28.简述线程池的处理流程"></a>28.简述线程池的处理流程</h3><p><img src="/pictures/image-20230905204135018.png" alt="image-20230905204135018"></p>
|
||
<h3 id="29-线程池中阻塞队列的作用?为什么是先添加队列而不是先创建最大线程?"><a href="#29-线程池中阻塞队列的作用?为什么是先添加队列而不是先创建最大线程?" class="headerlink" title="29.线程池中阻塞队列的作用?为什么是先添加队列而不是先创建最大线程?"></a>29.线程池中阻塞队列的作用?为什么是先添加队列而不是先创建最大线程?</h3><p><strong>线程池中阻塞队列的作用?</strong></p>
|
||
<p>1、一般的队列只能保证作为一个有限长度的缓冲区,如果超出了缓冲长度,就无法保留当前的任务了,阻塞队列通过阻塞可以保留住当前想要继续入队的任务。</p>
|
||
<p>2、阻塞队列可以保证任务队列中没有任务时阻塞获取任务的线程,使得线程进入wait状态,释放cpu资源。</p>
|
||
<p>3、阻塞队列自带阻塞和唤醒的功能,不需要额外处理,无任务执行时,线程池利用阻塞队列的take方法挂起,从而维持核心线程的存活,不至于一直占着cpu资源。</p>
|
||
<p><strong>为什么是先添加队列而不是先创建最大线程?</strong></p>
|
||
<p>在创建新线程的时候。是要获取全局锁的,这个时候其它就得阻塞,影响了整体效率。</p>
|
||
<p>就好比一个企业里面有10个(core)正式工的名额,最多招10个正式工,要是任务超过正式工人数,(task > core)的情况下,工厂领导(线程池)不是首先扩招工人,还是这10个人,但是任务会稍微的积压一下,即先放到队列去(代价低),10个正式工慢慢干,迟早会干完的,要是任务还在继续增加,超过正式工的加班忍耐极限了(队列满了),就得招外包帮忙了(注意是临时工),要是正式工加上外包还是不能完成任务,那新来的任务就会被领导拒绝了(线程池的拒绝策略)。</p>
|
||
<h3 id="30-线程池中线程复用原理"><a href="#30-线程池中线程复用原理" class="headerlink" title="30.线程池中线程复用原理"></a>30.线程池中线程复用原理</h3><p>线程池将线程和任务解耦,线程是线程,任务是任务,摆脱了之前通过Thread创建线程时的一个线程必须对应一个任务的限制。</p>
|
||
<p>在线程池中,同一个线程可以从阻塞队列中不断获取新任务来执行,其核心原理在于线程池对Thread进行了封装,并不是每次执行都会调用Thread.start()来创建新线程,而是让每个线程去执行一个“循环任务”,在这个“循环任务”中不停检查是否有任务需要被执行,如果有则执行,也就是调用任务中的run方法,将run方法当成一个普通的方法执行,通过这种方式只使用固定的线程就将所有任务的run方法串联起来。</p>
|
||
<h3 id="31-Spring是什么"><a href="#31-Spring是什么" class="headerlink" title="31.Spring是什么"></a>31.Spring是什么</h3><p>轻量级的开源的j2EE框架。他是一个容器框架,用来装javabean(java对象),中间层框架(万能胶)可以起一个连接作用,比如说把struts和hibernate粘合在一起运用,可以让我们的企业开发更快、更简洁</p>
|
||
<p>Spring是一个轻量级的控制反转(ioc)和面向切面(aop)的容器框架</p>
|
||
<ul>
|
||
<li>从大小与开销两方面而言Spring都是轻量级的</li>
|
||
<li>通过控制反转(ioc)的技术达到松耦合的目的</li>
|
||
<li>提供了面向切面编程的丰富支持,允许通过分离应用的业务逻辑与系统级服务进行内聚的开发</li>
|
||
<li>包含并管理应用对象(bean)的配置和生命周期,这个意义上是一个容器</li>
|
||
<li>将简单的组件配置、组合成复杂的应用,这个意义上是一个框架</li>
|
||
</ul>
|
||
<h3 id="32-谈谈你对AOP的理解"><a href="#32-谈谈你对AOP的理解" class="headerlink" title="32.谈谈你对AOP的理解"></a>32.谈谈你对AOP的理解</h3><p>系统是由许多不同的组件所组成的,每一个组件各负责一块特定的功能。除了实现自身的核心功能之外,这些组件还经常承担着额外的职责。例如日志、事务管理和安全这样的服务经常融入到自身具有核心业务逻辑的组件中去。这些系统服务经常被称为横切关注点,因为他们会跨域系统的多个组件。</p>
|
||
<p>当我们需要将分散的对象引入公共行为的时候,OOP则显得无能为力,也就是说,OOP允许你定义从上到下的关系,但并不适合定义从左到右的关系。例如日志功能</p>
|
||
<p>AOP:将程序中的交叉业务逻辑(比如安全、日志、事务),封装成一个切面。然后注入到目标对象(具体业务逻辑)中去。AOP可以对某个对象或者某些功能进行增强,比如对象中的方法进行增强,可以在执行某个方法之前额外做一些事情,在某个方法执行之后额外做一些事情。</p>
|
||
<h3 id="33-谈谈你对IOC的理解"><a href="#33-谈谈你对IOC的理解" class="headerlink" title="33.谈谈你对IOC的理解"></a>33.谈谈你对IOC的理解</h3><p>容器概念、控制反转、依赖注入三方面理解</p>
|
||
<p><strong>容器概念</strong></p>
|
||
<p>ioc容器:实际上就是个map(key、value),里面存的就是各种对象(在xml里配置bean节点、@Repository、@Service、@Controller),在项目启动的时候会读取配置文件路面的bean节点。</p>
|
||
<p><strong>控制反转</strong></p>
|
||
<p>在没有引入ioc容器之前,对象A依赖于对象B,那么对象A在初始化或者运行到某一点的时候,自己必须主动去创建对象B或者使用已经创建的对象B。无论是创建还是使用对象B,控制权都在自己手上。</p>
|
||
<p>引入ioc容器之后,对象A和对象B之间失去了直接联系。当对象A运行到需要对象B的时候,ioc容器会主动创建一个对象B注入到对象A需要的地方。</p>
|
||
<p>通过前后的对比,不难看出来:对象A获得依赖对象B的过程,由主动行为变成了被动行为,控制权颠倒过来了,这就是控制反转这个名称的由来。</p>
|
||
<p><strong>依赖注入</strong></p>
|
||
<p>“获得依赖对象的过程被反转了”。控制器反转之后,获得依赖对象的过程由自身管理变为了由IOC容器主动注入。依赖注入是实现IOC的方法,就是由IOC容器在运行期间,动态地将某种依赖关系注入到对象之中。</p>
|
||
<h3 id="34-BeanFactory和ApplicationContext有什么区别?"><a href="#34-BeanFactory和ApplicationContext有什么区别?" class="headerlink" title="34.BeanFactory和ApplicationContext有什么区别?"></a>34.BeanFactory和ApplicationContext有什么区别?</h3><p>ApplicationContext是BeanFactory的子接口</p>
|
||
<p>ApplicationContext提供了更完整的功能</p>
|
||
<p>1、继承了MessageSource,因此支持国际化</p>
|
||
<p>2、统一资源文件的访问方式</p>
|
||
<p>3、提供在监听器中注册bean的事件</p>
|
||
<p>4、同时加载多个配置文件</p>
|
||
<p>5、载入多个(有继承关系)上下文,使得每一个上下文都专注于一个特定的层次,比如应用的web层</p>
|
||
<h3 id="35-深拷贝和浅拷贝"><a href="#35-深拷贝和浅拷贝" class="headerlink" title="35.深拷贝和浅拷贝"></a>35.深拷贝和浅拷贝</h3><p>深拷贝和浅拷贝就是指对象的拷贝,一个对象中存在两种类型的属性,一种是基本数据类型,一种是实列对象的引用</p>
|
||
<ul>
|
||
<li>浅拷贝是指,只会拷贝基本数据类型的值,以及实例对象的引用地址,并不会复制一份引用地址所指向的对象,也就是浅拷贝出来的对象,内部的类属性指向的是一个对象</li>
|
||
<li>深拷贝是指,既会拷贝基本数据类型的值,也会针对实例对象的引用地址所指向的对象进行复制,深拷贝出来的对象,内部的类执行指向的不是同一个对象</li>
|
||
</ul>
|
||
<p>举例:A对象中有一个user属性,A1拷贝A对象,两个user指向同一个对象的话,就是浅拷贝,反之是深拷贝</p>
|
||
<h3 id="36-TCP和UDP有什么区别?TCP为什么是三次握手,而不是两次?"><a href="#36-TCP和UDP有什么区别?TCP为什么是三次握手,而不是两次?" class="headerlink" title="36.TCP和UDP有什么区别?TCP为什么是三次握手,而不是两次?"></a>36.TCP和UDP有什么区别?TCP为什么是三次握手,而不是两次?</h3><p><strong>TCP</strong> (Transfer Control Protocol)是一种面向连接的、可靠的、传输层通信协议</p>
|
||
<ul>
|
||
<li>面向连接的,点对点的通信,高可靠,效率比较低、占用系统的资源比较多(类似于打电话)</li>
|
||
</ul>
|
||
<p><strong>UDP</strong> (User Datagram Protocal) 是一种无连接、不可靠的、传输层通信协议</p>
|
||
<ul>
|
||
<li>不需要连接、发送方不管接收方有没有准备好,直接发消息;可以进行广播发送的;传输不可靠,有可能会丢失消息;效率比较高;协议比较简单,占用的系统资源少(类似于广播)</li>
|
||
</ul>
|
||
<p><strong>TCP为什么是三次握手,而不是两次?</strong></p>
|
||
<p>如果是两次握手,可能会造成连接资源浪费的问题</p>
|
||
<h3 id="37-JVM中有哪些垃圾回收算法?"><a href="#37-JVM中有哪些垃圾回收算法?" class="headerlink" title="37.JVM中有哪些垃圾回收算法?"></a>37.JVM中有哪些垃圾回收算法?</h3><p>MarkSweep标记清除算法</p>
|
||
<p>Copying拷贝算法</p>
|
||
<p>MarkCompack标记压缩算法</p>
|
||
<h3 id="38-集合相关的面试题"><a href="#38-集合相关的面试题" class="headerlink" title="38.集合相关的面试题"></a>38.集合相关的面试题</h3><p> <img src="/pictures/image-20230926110554758.png" alt="image-20230926110554758"></p>
|
||
<p><img src="/pictures/image-20230926122104134.png" alt="image-20230926122104134"></p>
|
||
<p><img src="/pictures/image-20230926121325686.png" alt="image-20230926121325686"></p>
|
||
<p><img src="/pictures/image-20230926121517150.png" alt="image-20230926121517150"></p>
|
||
<p><img src="/pictures/image-20230926122420662.png" alt="image-20230926122420662"></p>
|
||
<p><img src="/pictures/image-20230926122546930.png" alt="image-20230926122546930"></p>
|
||
<p><img src="/pictures/image-20230926133043725.png" alt="image-20230926133043725"></p>
|
||
<p><img src="/pictures/image-20230926133301807.png" alt="image-20230926133301807"></p>
|
||
<h2 id="二-框架篇相关面试题"><a href="#二-框架篇相关面试题" class="headerlink" title="二.框架篇相关面试题"></a>二.框架篇相关面试题</h2><h3 id="1-Spring-Bean的生命周期"><a href="#1-Spring-Bean的生命周期" class="headerlink" title="1.Spring Bean的生命周期"></a>1.Spring Bean的生命周期</h3><p><strong>1.创建前准备阶段</strong></p>
|
||
<p>这个阶段主要是在开始Bean加载之前,从Spring上下文和相关配置中解析并查找Bean有关的配置内容,比如<code>init-method</code>-容器在初始化bean时调用的方法、<code>destory-method</code>,容器在销毁Bean时调用的方法。以及,BeanFactoryPostProcessor这类的bean加载过程中的前置和后置处理。这些类或者配置其实是Spring提供给开发者,用来实现Bean加载过程中的扩展机制,在很多和Spring集成的中间件经常使用,比如Dubbo。</p>
|
||
<p><strong>2.创建实例阶段</strong></p>
|
||
<p>这个阶段主要是通过反射来创建Bean的实例对象,并且扫描和解析Bean声明的一些属性。</p>
|
||
<p><strong>3.依赖注入阶段</strong></p>
|
||
<p>在这个阶段,会检测被实例化的Bean是否存在其他依赖,如果存在其他依赖,就需要对这些被依赖Bean进行注入。比如通过<code>@Autowired</code>、@Setter等依赖注入的配置。在这个阶段还会触发一些扩展的调用,比如常见的扩展类:BeanPostProcessors(用来实现Bean初始化前后的回调)、InitializingBean类(这个类有一个afterPropertiesSet()方法,给属性赋值)、还有BeanFactoryAware等等。</p>
|
||
<p><strong>4.容器缓存阶段</strong></p>
|
||
<p>容器缓存阶段主要是把Bean保存到IoC容器中缓存起来,到了这个阶段,Bean就可以被开发者使用了。这个阶段涉及到的操作,常见的有<code>init-method</code>这个属性配置的方法,会在这个阶段调用。比如BeanPostProcessors方法中的后置处理器方法postProcessAfterInitialization,也是在这个阶段触发的。</p>
|
||
<p><strong>5.销毁实例阶段</strong></p>
|
||
<p>这个阶段,是完成Spring应用上下文关闭时,将销毁Spring上下文中所有的Bean。如果Bean实现了DisposableBean接口,或者配置了<code>destory-method</code>属 性,将会在这个阶段被调用。</p>
|
||
<p>实例化 -> 属性赋值 -> 初始化 -> 销毁</p>
|
||
<h3 id="2-Spring框架中的单例Bean是线程安全的吗?"><a href="#2-Spring框架中的单例Bean是线程安全的吗?" class="headerlink" title="2.Spring框架中的单例Bean是线程安全的吗?"></a>2.Spring框架中的单例Bean是线程安全的吗?</h3><p>不是线程安全的!</p>
|
||
<p>Sping中Bean默认是单例模式的,框架中并没有对Bean进行多线程的封装处理。</p>
|
||
<p>线程安全这个问题,要从单例与原型Bean分别进行说明。</p>
|
||
<p><strong>「原型Bean」</strong>对于原型Bean,每次创建一个新对象,也就是线程之间并不存在Bean共享,自然是不会有线程安全的问题。</p>
|
||
<p><strong>「单例Bean」</strong>对于单例Bean,所有线程都共享一个单例实例Bean,因此是存在资源的竞争。</p>
|
||
<p>如果单例Bean,是一个无状态Bean,也就是线程中的操作不会对Bean的成员执行<strong>「查询」</strong>以外的操作,那么这个单例Bean是线程安全的。比如Spring mvc 的 Controller、Service、Dao等,这些Bean大多是无状态的,只关注于方法本身。</p>
|
||
<h3 id="3-Spring-Bean作用域"><a href="#3-Spring-Bean作用域" class="headerlink" title="3.Spring Bean作用域"></a>3.Spring Bean作用域</h3><p>Spring 的 bean 作用域(scope)类型有5种:</p>
|
||
<p>1、singleton:单例,默认作用域。</p>
|
||
<p>2、prototype:原型,每次创建一个新对象。</p>
|
||
<p>3、request:请求,每次Http请求创建一个新对象,适用于WebApplicationContext环境下。</p>
|
||
<p>4、session:会话,同一个会话共享一个实例,不同会话使用不用的实例。</p>
|
||
<p>5、global-session:全局会话,所有会话共享一个实例。</p>
|
||
<h3 id="4-Spring框架中用到了哪些设计模式?"><a href="#4-Spring框架中用到了哪些设计模式?" class="headerlink" title="4.Spring框架中用到了哪些设计模式?"></a>4.Spring框架中用到了哪些设计模式?</h3><ol>
|
||
<li>简单工厂:由一个工厂类根据传入的参数,动态决定应该创建哪一个产品类。Spring中的BeanFactory就是简单工厂模式的体现,根据传入的一个唯一的标识来获得Bean对象,但是否在传入参数后创建还是传入参数前创建这个要根据具体情况来定。</li>
|
||
<li>工厂方法:实现了FactoryBean接口的bean是一类叫做factory的bean.其特点是,spring会在使用getBean()调用获得该bean时,会自动调用该bean的getObject()方法,所以返回的不是factory这个bean,而是这个bean.getObject()方法的返回值。</li>
|
||
<li>单例模式:保证一个类仅有一个实例,并提供一个访问它的全局访问点。spring对单例的实现:spring中的单例模式完成了后半句话,即提供了全局访问点BeanFactory,但没有从构造器级别去控制单例,这时因为spring管理的是任意的java对象。</li>
|
||
<li>适配器模式:spring中定义了一个适配接口,使得每一种Controller有一种对应的适配器实现类,让适配器代替controller执行响应的方法。这样扩展controller时,只需要增加一个适配类就完成了springMvc的扩展了。</li>
|
||
<li>装饰器模式:动态地给一个对象增加一些额外的职责。就增加功能来说,Decorator模式相比生成子类更为灵活。spring中用到的装饰器模式在类名上有两种表现:一是类名中含有wrapper,另一种时类名中含有Decorator.</li>
|
||
<li>动态代理:切面在应用运行的时刻被织入。一般情况下,在织入切面时,AOP容器会为目标对象动态地创建一个代理对象。SpringAOP就是以这种方式织入切面的。 织入:把切面应用到目标对象并创建新代理对象的过程。</li>
|
||
<li>观察者模式:Spring的事件驱动模型使用的是观察者模式,spring中observer模式常用的地方是listener的实现。</li>
|
||
<li>策略模式:spring框架的资源访问Resource接口。该接口提供了更强的资源访问能力,spring框架本身大量使用了Resource接口来访问底层资源。</li>
|
||
</ol>
|
||
<h3 id="5-spring中事务实现方和原理式以及隔离级别?"><a href="#5-spring中事务实现方和原理式以及隔离级别?" class="headerlink" title="5.spring中事务实现方和原理式以及隔离级别?"></a>5.spring中事务实现方和原理式以及隔离级别?</h3><p><strong>实现方式</strong></p>
|
||
<p>在使用Spring框架时,可以有两种使用事务的方式,一种是编程式,一种是申明式的,@Transactional注解就是申明式的。</p>
|
||
<p>首先,事务这个概念是数据库层面的,Spring只是基于数据库中的事务进行了扩展,以及提供了一些能让程序员更加方便操作事务的方式。比如我们可以通过在某个方法上增加@Transactional注解,就可以开启事务,这个方法中所有的sql都会在一个事务中执行,统一成功失败。</p>
|
||
<p><strong>原理</strong></p>
|
||
<p>在一个方法上加了@Transactional注解后,Spring会基于这个类生成一个代理对象,会将这个代理对象作为bean,当在使用这个代理对象的方法时,如果这个方法存在@Transactional注解,那么代理逻辑会先把事务的自动提价设置为false,然后再去执行原本的业务逻辑方法,如果执行业务逻辑方法没有异常,那么代理逻辑中就会将事务进行提交,如果执行业务逻辑方法出现了异常,那么则会将事务进行回滚。当然,针对哪些异常回滚事务是可以配置的,可以利用@Transactional注解中的rollbackFor属性进行配置,默认情况下会对RuntimeException和Error进行回滚。</p>
|
||
<p><strong>隔离级别</strong></p>
|
||
<p>spring的事务隔离级别就是数据库的隔离级别外加一个默认级别</p>
|
||
<ol>
|
||
<li>read uncommitted(未提交读)</li>
|
||
<li>read committed(提交读、不可重复读)</li>
|
||
<li>repeatable read (可重复读)</li>
|
||
<li>serializable(可串行化)</li>
|
||
</ol>
|
||
<p>注:数据库设置的隔离级别会被spring的配置覆盖</p>
|
||
<h3 id="6-Spring事务传播机制"><a href="#6-Spring事务传播机制" class="headerlink" title="6.Spring事务传播机制"></a>6.Spring事务传播机制</h3><p>多个事务方法相互调用的时,事务是如何在这些方法间传播</p>
|
||
<p>方法A是一个事务的方法,方法A执行过程中调用了方法B,那么方法B有无事务以及方法B对事务的要求不同都会对方法A的事务具体执行造成影响,同时方法A的事务对方法B的事务执行也有影响,这种影响具体是什么就由两个方法所定义的事务传播类型所决定。</p>
|
||
<p><strong>REQUIRED</strong>(Spring默认的事务传播类型)如果当前没有事务,则自己创建一个事务,如果当前存在事务,则加入这个事务</p>
|
||
<p><strong>SUPPORTS</strong>:当前存在事务,则加入当前事务,如果当前没有事务,就以非事务方法执行</p>
|
||
<p><strong>MANDATORY</strong>:当前存在事务,则加入当前事务,如果当前的事务不存在,则抛出异常</p>
|
||
<p><strong>REQUIRES_NEW</strong>:创建一个新事务,如果存在当前事务,则挂起该事务</p>
|
||
<p><strong>NOT_SUPPORTED</strong>:以非事务方式执行,如果当前存在事务,则挂起当前事务</p>
|
||
<p><strong>NEVER</strong>:不使用事务,如果当前事务存在,则抛出异常</p>
|
||
<p><strong>NESTED</strong>:如果当前事务存在,则在嵌套事务中执行,否则REQUIRED的操作一样(开启一个事务)</p>
|
||
<h3 id="7-Spring事务什么时候会失效?"><a href="#7-Spring事务什么时候会失效?" class="headerlink" title="7.Spring事务什么时候会失效?"></a>7.Spring事务什么时候会失效?</h3><p>Spring事务原理是AOP,进行了切面增强,那么失效的根本原因是这个AOP不起作用了,常见情况有如下几种</p>
|
||
<ol>
|
||
<li>发生自调用,类里面使用this调用本类的方法,此时这个this对象不是代理类,而是UserService对象本身</li>
|
||
<li>方法不是public的,非要在非public上使用事务,可以开启Aspectj代理模式</li>
|
||
<li>数据库不支持事务,例如使用的MyISAM存储引擎</li>
|
||
<li>没有被spring管理</li>
|
||
<li>异常被吃掉,事务不会回滚(或者抛出的异常没有定义,默认为RuntimeException)</li>
|
||
</ol>
|
||
<h3 id="8-什么是bean的自动装配,有哪些方式?"><a href="#8-什么是bean的自动装配,有哪些方式?" class="headerlink" title="8.什么是bean的自动装配,有哪些方式?"></a>8.什么是bean的自动装配,有哪些方式?</h3><p>autowire属性有五种装配的方式</p>
|
||
<ul>
|
||
<li>no – 缺省情况下,自动配置是通过“ref”属性手动设定</li>
|
||
</ul>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!--手动装配:以value或ref的方式明确指定属性值都是手动装配。 需要通过‘ref’属性来连接bean--></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<ul>
|
||
<li>byName-根据bean的属性名称进行自动装配</li>
|
||
</ul>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!--Cutomer的属性名称是person,Spring会将bean id为person的bean通过setter方法进行自动装配--></span></span><br><span class="line">< bean id=“cutomer” class=“com.xxx.xxx.Cutomer” autowire=“byName”/></span><br><span class="line">< bean id=“person” class=“com.xxx.xxx.Person”/></span><br></pre></td></tr></table></figure>
|
||
|
||
<ul>
|
||
<li>byType-根据bean的类型进行自动装配</li>
|
||
</ul>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!--Cutomer的属性person的类型为Person,Spirng会将Person类型通过setter方法进行自动装配--></span></span><br><span class="line">< bean> id=“cutomer” class=“com.xxx.xxx.Cutomer” autowire=“byType”/></span><br><span class="line">< bean> id=“person” class=“com.xxx.xxx.Person”/></span><br></pre></td></tr></table></figure>
|
||
|
||
<ul>
|
||
<li>constructor-类似byType,不过是应用于构造器的参数。如果一个bean与构造器参数的类型形<br>同,则进行自动装配,否则导致异常</li>
|
||
</ul>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!--Cutomer构造函数的参数person的类型为Person,Spirng会将Person类型通过构造方法进行自动装配--></span></span><br><span class="line">< bean> id=“cutomer” class=“com.xxx.xxx.Cutomer” autowire=“construtor”/></span><br><span class="line">< bean> id=“person” class=“com.xxx.xxx.Person”/></span><br></pre></td></tr></table></figure>
|
||
|
||
<ul>
|
||
<li>autodetect-如果有默认的构造器,则通过constructor方式进行自动装配,否则使用byType方式 进行自动装配</li>
|
||
</ul>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!--如果有默认的构造器,则通过constructor方式进行自动装配,否则使用byType方式进行自动装配--></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="9-Spring-Boot、SpringMVC和Spring有什么区别?"><a href="#9-Spring-Boot、SpringMVC和Spring有什么区别?" class="headerlink" title="9.Spring Boot、SpringMVC和Spring有什么区别?"></a>9.Spring Boot、SpringMVC和Spring有什么区别?</h3><p><strong>Spring</strong>是一个IOC容器,用来管理Bean,使用依赖注入实现控制反转,可以很方便的整合各种框架,提供AOP机制弥补OOP的代码重复问题,更方便将不同方法中的共同处理抽取成切面,自动注入给方法执行,比如日志、异常等</p>
|
||
<p><strong>SpringMvc</strong>是spring对web框架的一个解决方案,提供了一个总的前端控制器Servlet,用来接受请求,然后定义了一套路由策略(url到handle的映射)及适配执行handle,将handle结果使用视图解析技术生成视图展现给前端</p>
|
||
<p><strong>SpringBoot</strong>是Spring提供的一个快速开发工具包,让程序员更方便、更快速的开发spring + springmvc应用,简化了配置(约定了默认配置),整合了一系列的解决方案(starter机制),redis、mongodb、es可以开箱即用</p>
|
||
<h3 id="10-SpringMVC的工作流程"><a href="#10-SpringMVC的工作流程" class="headerlink" title="10.SpringMVC的工作流程"></a>10.SpringMVC的工作流程</h3><ol>
|
||
<li>用户发送请求到前端控制器DispatcherServlet</li>
|
||
<li>DispatcherServlet收到请求调用HandlerMapping处理器映射器</li>
|
||
<li>处理器映射器找到具体的处理器(可以根据xml配置、注解进行查找),生成处理器及处理器拦截器(如果有则生成)一并返回给DispatcherServlet</li>
|
||
<li>DispatcherServlet调用HandlerAdapter处理器适配器</li>
|
||
<li>HandlerAdapter调用具体的处理器(controller,也叫后端控制器)</li>
|
||
<li>Controller执行完成返回ModelAndView</li>
|
||
<li>HandlerAdapter将Controller执行结果ModelAndView返回给DispatcherServlet</li>
|
||
<li>DispatcherServlet将ModelAndView传给ViewReslover视图解析器</li>
|
||
<li>ViewReslover解析后返回具体view</li>
|
||
<li>DispatcherServlet根据view进行渲染视图(即将模型数据填充到视图中)</li>
|
||
<li>DispatcherServlet响应给用户</li>
|
||
</ol>
|
||
<p><img src="/pictures/image-20230911141826287.png" alt="image-20230911141826287"></p>
|
||
<h3 id="11-SpringMvc中的九大组件"><a href="#11-SpringMvc中的九大组件" class="headerlink" title="11.SpringMvc中的九大组件"></a>11.SpringMvc中的九大组件</h3><p>Handler是用来干活的工具;HandlerMapping用于根据需要干的活找到相应的工具;HandlerAdapter是使用工具干活的人</p>
|
||
<ol>
|
||
<li><p><strong>HandlerMapping</strong>是用来查找Handler的。在SpringMVC中会有很多请求,每个请求都需要一个Handler处理,具体接收到一个请求之后使用哪个Handler进行处理呢?这就是HandlerMapping需要做的事。</p>
|
||
</li>
|
||
<li><p><strong>HandlerAdapter</strong>,从名字上看,它就是一个适配器。因为SpringMVC中的Handler可以是任意的形式,只要能处理请求就ok,但是Servlet需要的处理方法的结构却是固定的,都是以request和response为参数的方法。如何让固定的Servlet处理方法调用灵活的Handler来进行处理呢?这就是HandlerAdapter要做的事情。</p>
|
||
</li>
|
||
<li><p><strong>HandlerExceptionResolver</strong>其它组件都是用来干活的。在干活的过程中难免会出现问题,出问题后怎么办呢?这就需要有一个专门的角色对异常情况进行处理,在SpringMVC中就是HandlerExceptionResolver。具体来说,此组件的作用是根据异常设置ModelAndView,之后再交给render方法进行渲染。</p>
|
||
</li>
|
||
<li><p><strong>ViewResolverViewResolver</strong>用来将String类型的视图名和Locale解析为View类型的视图。View是用来渲染页面的,也就是将程序返回的参数填入模板里,生成html(也可能是其它类型)文件。这里就有两个关键问题:使用哪个模板?用什么技术(规则)填入参数?这其实是ViewResolver主要要做的工作,ViewResolver需要找到渲染所用的模板和所用的技术(也就是视图的类型)进行渲染,具体的渲染过程则交由不同的视图自己完成。</p>
|
||
</li>
|
||
<li><p><strong>RequestToViewNameTranslatorViewName</strong>是根据ViewName查找View,但有的Handler处理完后并没有设置View也没有设置ViewName,这时就需要从request获取ViewName了,如何从request中获取ViewName就是RequestToViewNameTranslator要做的事情了。RequestToViewNameTranslator在Spring MVC容器里只可以配置一个,所以所有request到ViewName的转换规则都要在一个Translator里面全部实现。</p>
|
||
</li>
|
||
<li><p><strong>LocaleResolver</strong>解析视图需要两个参数:一是视图名,另一个是Locale。视图名是处理器返回的,Locale是从哪里来的?这就是LocaleResolver要做的事情。LocaleResolver用于从request解析出Locale,Locale就是zh-cn之类,表示一个区域,有了这个就可以对不同区域的用户显示不同的结果。SpringMVC主要有两个地方用到了Locale:一是ViewResolver视图解析的时候;二是用到国际化资源或者主题的时候。</p>
|
||
</li>
|
||
<li><p><strong>ThemeResolver</strong>用于解析主题。SpringMVC中一个主题对应一个properties文件,里面存放着跟当前主题相关的所有资源、如图片、css样式等。SpringMVC的主题也支持国际化,同一个主题不同区域也可以显示不同的风格。SpringMVC中跟主题相关的类有 ThemeResolver、ThemeSource和Theme。主题是通过一系列资源来具体体现的,要得到一个主题的资源,首先要得到资源的名称,这是ThemeResolver的工作。然后通过主题名称找到对应的主题(可以理解为一个配置)文件,这是ThemeSource的工作。最后从主题中获取资源就可以了。</p>
|
||
</li>
|
||
<li><p><strong>MultipartResolver</strong>用于处理上传请求。处理方法是将普通的request包装成MultipartHttpServletRequest,后者可以直接调用getFile方法获取File,如果上传多个文件,还可以调用getFileMap得到FileName->File结构的Map。此组件中一共有三个方法,作用分别是判断是不是上传请求,将request包装成MultipartHttpServletRequest、处理完后清理上传过程中产生的临时资源。</p>
|
||
</li>
|
||
<li><p><strong>FlashMapManager</strong>用来管理FlashMap的,FlashMap主要用在redirect中传递参数。</p>
|
||
</li>
|
||
</ol>
|
||
<h3 id="12-SpringBoot自动配置原理(简答的阐述见下面15条)"><a href="#12-SpringBoot自动配置原理(简答的阐述见下面15条)" class="headerlink" title="12.SpringBoot自动配置原理(简答的阐述见下面15条)"></a>12.SpringBoot自动配置原理(简答的阐述见下面15条)</h3><p>自动装配,简单来说就是自动把第三方组件的Bean装载到Spring IOC器里面,不需要开发人员再去写Bean的装配配置。</p>
|
||
<p>在Spring Boot应用里面,只需要在启动类加上@SpringBootApplication注解就可以实现自动装配。@SpringBootApplication是一个复合注解,真正实现自动装配的注解是@EnableAutoConfiguration。</p>
|
||
<p><img src="/pictures/image-20230911195638524.png" alt="image-20230911195638524"></p>
|
||
<h3 id="13-MyBatis的优缺点"><a href="#13-MyBatis的优缺点" class="headerlink" title="13.MyBatis的优缺点"></a>13.MyBatis的优缺点</h3><p><strong>优点:</strong></p>
|
||
<ol>
|
||
<li>基于SQL语句编程,相当灵活,不会对应用程序或者数据库的现有设计造成任何影响,SQL写在XML里,解除sql与程序代码的耦合,便于统一管理;提供XML标签,支持编写动态SQL语句,并可重用</li>
|
||
<li>与JDBC相比,减少了50%以上的代码量,消除了JDBC大量冗余的代码,不需要手动开关连接</li>
|
||
<li>很好的与各种数据库兼容(因为MyBatis使用JDBC来连接数据库,所以只要JDBC支持的数据库MyBatis都支持)</li>
|
||
<li>能够与Spring很好的集成</li>
|
||
<li>提供映射标签,支持对象与数据库的ORM字段关系映射;提供对象关系映射标签,支持对象关系组件维护</li>
|
||
</ol>
|
||
<p><strong>缺点:</strong></p>
|
||
<p>1.<br> SQL语句的编写工作量较大,尤其当字段多、关联表多时,对开发人员编写SQL语句的功底有一定要求<br>2. SQL语句依赖于数据库,导致数据库移植性差,不能随意更换数据库</p>
|
||
<h3 id="14-MyBatis中-和-的区别是什么?"><a href="#14-MyBatis中-和-的区别是什么?" class="headerlink" title="14.MyBatis中#{}和${}的区别是什么?"></a>14.MyBatis中#{}和${}的区别是什么?</h3><ol>
|
||
<li>功能不同:${} 是直接替换,而 #{} 是预处理</li>
|
||
<li>使用场景不同:普通参数使用 #{},如果传递的是 SQL 命令或 SQL 关键字,需要使用 ${},但在使用前一定要做好安全验证</li>
|
||
<li>安全性不同:使用 ${} 存在安全问题(SQL注入),而 #{} 则不存在安全问题</li>
|
||
</ol>
|
||
<h3 id="15-Spring-Boot自动装配的过程"><a href="#15-Spring-Boot自动装配的过程" class="headerlink" title="15.Spring Boot自动装配的过程"></a>15.Spring Boot自动装配的过程</h3><p><img src="/pictures/image-20230921145126572.png" alt="image-20230921145126572"></p>
|
||
<p><strong>整个自动装配的过程是</strong>:Spring Boot通过@EnableAutoConfiguration注解开启自动配置,加载spring.factories中注册的各AutoConfiguration类,当某个AutoConfiguration类满足其注解@Conditional指定的生效条件(Starters提供的依赖、配置或Spring容器中是否存在某个Bean等)时,实例化该AutoConfiguration类中定义的Bean(组件等),并注入Spring容器,就可以完成依赖框架的自动配置。</p>
|
||
<h2 id="二-Mysql相关面试题"><a href="#二-Mysql相关面试题" class="headerlink" title="二.Mysql相关面试题"></a>二.Mysql相关面试题</h2><h3 id="1-存储引擎InnoDB-与MyISAM-的区别"><a href="#1-存储引擎InnoDB-与MyISAM-的区别" class="headerlink" title="1.存储引擎InnoDB 与MyISAM 的区别"></a>1.存储引擎InnoDB 与MyISAM 的区别</h3><ol>
|
||
<li>数据存储的方式不同,MyISAM中的数据和索引是分开存储的,而InnoDB是把索引和数据存储在同一个文件里面</li>
|
||
<li>对于事务的支持不同,MyISAM不支持事务,而InnoDB支持ACID特性的事务处理</li>
|
||
<li>对于锁的支持不同,MyISAM只支持表锁,而InnoDB可以根据不同的情况,支持行锁,表锁,间隙锁,临键锁</li>
|
||
<li>MyISAM不支持外键,InnoDB支持外键因此基于这些特性,我们在实际应用中,可以根据不同的场景来选择合适的存储引擎</li>
|
||
<li>比如如果需要支持事务,那必须要选择InnoDB。如果大部分的表操作都是查询,可以选择MyISAM</li>
|
||
</ol>
|
||
<h3 id="2-索引的基本原理"><a href="#2-索引的基本原理" class="headerlink" title="2.索引的基本原理"></a>2.索引的基本原理</h3><p>原理:把无序的数据变成有序的查询</p>
|
||
<ol>
|
||
<li>把创建了索引的列的内容进行排序</li>
|
||
<li>对排序结果生成倒排表</li>
|
||
<li>在倒排表内容上拼上数据地址链</li>
|
||
<li>在查询的时候,先拿到倒排表的内容,再取出数据地址链,从而拿到数据</li>
|
||
</ol>
|
||
<h3 id="3-索引失效的场景"><a href="#3-索引失效的场景" class="headerlink" title="3.索引失效的场景"></a>3.索引失效的场景</h3><ol>
|
||
<li>索引在使用的时候没有遵循最左匹配法则.</li>
|
||
<li>模糊查询,如果%号在前面也会导致索引失效。</li>
|
||
<li>在添加索引的字段上进行了运算操作或者类型转换也都会导致索引失效。</li>
|
||
<li>如果使用了复合索引,中间使用了范围查询,右边的条件索引也会失效</li>
|
||
<li>查询的时候发生了类型转换,在查询的时候做了运算的操作和模糊查询也会导致索引失效</li>
|
||
</ol>
|
||
<h3 id="4-事务的隔离级别有哪些?MySQL-的默认隔离级别是什么?"><a href="#4-事务的隔离级别有哪些?MySQL-的默认隔离级别是什么?" class="headerlink" title="4.事务的隔离级别有哪些?MySQL 的默认隔离级别是什么?"></a>4.事务的隔离级别有哪些?MySQL 的默认隔离级别是什么?</h3><p>读未提交(Read Uncommitted)可能读到其他事务未提交的数据,也叫做脏读<br>读已提交(Read Committed)两次读取结果不一致,叫做不可重复读<br>可重复读(Repeatable Read)是mysql默认的隔离级别,每次读取的结果都一样,当时可能产生幻读<br>串行化(Serializable)一般是不会使用的,他给每一行读取的数据加锁,会导致大量超时和锁竞争的问题<br>Mysql 默认的事务隔离级别是可重复读(Repeatable Read)</p>
|
||
<h3 id="5-事务的基本特性"><a href="#5-事务的基本特性" class="headerlink" title="5.事务的基本特性"></a>5.事务的基本特性</h3><p>事务的基本特性ACID分别是:</p>
|
||
<ol>
|
||
<li>A 原子性:一个事务的操作要么全部成功,要么全部失败</li>
|
||
<li>C 一致性:数据库从一个一致性的状态转换到另一个一致性的状态</li>
|
||
<li>I 隔离性:一个事务的修改在最终提交前,对其他事务是不可见的</li>
|
||
<li>D 持久性 一旦事务提交,所做的修改就会永远的保存到数据库中</li>
|
||
</ol>
|
||
<h3 id="6-怎么处理慢查询"><a href="#6-怎么处理慢查询" class="headerlink" title="6.怎么处理慢查询"></a>6.怎么处理慢查询</h3><p>SQL查询慢的原因</p>
|
||
<ol>
|
||
<li>查询没有命中索引</li>
|
||
<li>查询了不需要的数据列</li>
|
||
<li>数据量太大</li>
|
||
</ol>
|
||
<p>根据上面的原因给出优化的措施</p>
|
||
<ol>
|
||
<li>分析语句的执行计划,然后获得其使用索引的情况,然后修改语句或者索引,使得语句可以尽可能的命中索引</li>
|
||
<li>分析语句,是否查询了不需要的数据列</li>
|
||
<li>如果对语句的优化已经无法进行,可以考虑表中的数据量是否太大,如果是的话可以进行横向或者纵向的分表</li>
|
||
</ol>
|
||
<h3 id="7-ACID靠什么保证的"><a href="#7-ACID靠什么保证的" class="headerlink" title="7.ACID靠什么保证的"></a>7.ACID靠什么保证的</h3><p>A 原子性由<strong>undo log日志</strong>保证,它记录了需要回滚的日志信息,事务回滚时撤销已经执行成功的sql</p>
|
||
<p>C 一致性由其他的三大特性保证 程序代码要保证业务上的一致性</p>
|
||
<p>I 隔离性由<strong>MVCC</strong>来保证</p>
|
||
<p>D 持久性由<strong>内存 + redo log</strong> 来保证。Mysql修改数据同时在内存和redo log记录这次操作,宕机的时候可以从redo log恢复</p>
|
||
<h2 id="三-Redis相关面试题"><a href="#三-Redis相关面试题" class="headerlink" title="三.Redis相关面试题"></a>三.Redis相关面试题</h2><h3 id="1-Redis过期键的删除策略"><a href="#1-Redis过期键的删除策略" class="headerlink" title="1.Redis过期键的删除策略"></a>1.Redis过期键的删除策略</h3><p>redis是key-value数据库,我们可以设置redis中缓存的key的过期时间。redis的过期策略就是指当redis中缓存的key过期了,redis该如何处理。</p>
|
||
<ul>
|
||
<li><strong>惰性过期</strong>:只有当访问一个key时,才会判断该key是否已过期,过期则删除。该策略可以最大化地节省CU资源,但是对内存非常的不友好。极端地情况可能出现大量地过期key没有再次被访问,从而不被清除,占用大量内存。</li>
|
||
<li>**定期过期:**每隔一定地时间,会扫描一定数量地数据库地expires字典中一定数量地key,并清除其中已过期的key。该策略是前两者的一个折中方案。通过定时扫描的时间间隔和每次扫描的限定功耗,可以在不同情况下使得CPU和内存资源达到最优的平衡效果。</li>
|
||
</ul>
|
||
<p>在Redis中同时使用了这两种策略</p>
|
||
<h3 id="2-Redis的线程模型,单线程为什么快"><a href="#2-Redis的线程模型,单线程为什么快" class="headerlink" title="2.Redis的线程模型,单线程为什么快"></a>2.Redis的线程模型,单线程为什么快</h3><p>IO多路复用机制监听多个Socket</p>
|
||
<p><strong>单线程快的原因:</strong></p>
|
||
<ol>
|
||
<li>纯内存操作</li>
|
||
<li>核心是基于非阻塞的IO多路复用机制</li>
|
||
<li>单线程反而避免了多线程的频繁上下文切换带来的性能问题</li>
|
||
</ol>
|
||
<h3 id="3-缓存雪崩、缓存穿透、缓存击穿"><a href="#3-缓存雪崩、缓存穿透、缓存击穿" class="headerlink" title="3.缓存雪崩、缓存穿透、缓存击穿"></a>3.缓存雪崩、缓存穿透、缓存击穿</h3><p><strong>缓存雪崩</strong> 缓存在同一时间大面积失效,所以,后面的请求都会落在数据库上,造成数据库短时间内承受大量请求而崩掉。</p>
|
||
<p>解决方案:</p>
|
||
<ol>
|
||
<li>缓存数据的过期时间设置随机,防止同一时间大量数据过期现象发生</li>
|
||
<li>给每一个缓存数据增加响应的缓存标记,记录缓存是否失效,如果缓存标记失效,则更新数据缓存</li>
|
||
<li>缓存预热,启动系统之前先把热点数据放在缓存中去</li>
|
||
<li>互斥锁</li>
|
||
</ol>
|
||
<p><strong>缓存穿透</strong> 缓存和数据库中都没有数据,导致所有的请求都落在数据库上,造成数据库短时间内承受大量请求</p>
|
||
<p>解决方案:</p>
|
||
<ol>
|
||
<li>接口层增加校验,如用户鉴权校验,id做基础校验,id<=0的直接拦截掉</li>
|
||
<li>从缓存取不到数据,在数据库中也没有取到,这时也可以将key-value对写为key-null,缓存有效时间可以设置短一些,如30秒(设置太长会导致正常的情况也没法使用)。这样可以防止攻击用户反复用同一个id暴力攻击</li>
|
||
<li>采用布隆过滤器,将所有可能存在的数据哈希到一个足够大的bitmap中,一个一定不存在的数据会被这个bitmap拦截掉,从而避免了对底层存储系统的查询压力</li>
|
||
</ol>
|
||
<p><strong>缓存击穿</strong> 缓存中没有但数据库中有的数据(一般是缓存时间到期),这时由于并发用户特别多,同时读缓存没有读到数据,又同时去数据库取数据,引起数据库压力瞬间增大,造成过大压力。和缓存雪崩不同的是,缓存击穿指并发查同一条数据,缓存雪崩是不同数据都过期了,很多数据都查不到从而查数据库。</p>
|
||
<p>解决方案:</p>
|
||
<ol>
|
||
<li>设置热点数据永不过期</li>
|
||
<li>加互斥锁</li>
|
||
</ol>
|
||
<h3 id="4-Redis的数据结构"><a href="#4-Redis的数据结构" class="headerlink" title="4.Redis的数据结构"></a>4.Redis的数据结构</h3><p>Redis支持五种数据类型:string(字符串),hash(哈希),list(列表),set(无序集合)及zset(有序集合)</p>
|
||
<p><img src="/pictures/image-20230914154911197.png" alt="image-20230914154911197"></p>
|
||
<p><strong>PDF</strong></p>
|
||
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/2023最新Java面试题全集.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>面试</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>面试</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>使用Robot类编写自动化脚本</title>
|
||
<url>/posts/30127.html</url>
|
||
<content><![CDATA[<h2 id="一-概述"><a href="#一-概述" class="headerlink" title="一.概述"></a>一.概述</h2><p> Java中Robot类位于java.awt.Robot,该类用于为测试自动化,自运行演示程序和其他需要控制鼠标和键盘的应用程序生成本机系统输入事件,Robot类的主要目的是便于Java平台实现自动测试</p>
|
||
<h2 id="二-基本API"><a href="#二-基本API" class="headerlink" title="二.基本API"></a>二.基本API</h2><table>
|
||
<thead>
|
||
<tr>
|
||
<th>方法名</th>
|
||
<th>使用说明</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>delay(n)</td>
|
||
<td>延迟电脑操作n毫秒,类似于Thread.sleep()</td>
|
||
</tr>
|
||
<tr>
|
||
<td>keyPress()</td>
|
||
<td>模拟手动按下电脑键盘上的某个键</td>
|
||
</tr>
|
||
<tr>
|
||
<td>keyRelease()</td>
|
||
<td>模拟手动松开电脑键盘上的某个键(与keyPress()对应,按下一个键必须松开这个键)</td>
|
||
</tr>
|
||
<tr>
|
||
<td>mouseMove(x,y)</td>
|
||
<td>将鼠标移动到指定的x,y位置</td>
|
||
</tr>
|
||
<tr>
|
||
<td>mousePress()</td>
|
||
<td>按下鼠标上的某个键</td>
|
||
</tr>
|
||
<tr>
|
||
<td>mouseRelease()</td>
|
||
<td>松开鼠标上的某个键</td>
|
||
</tr>
|
||
<tr>
|
||
<td>getPixelColor(x,y)</td>
|
||
<td>获取指定坐标处的像素颜色</td>
|
||
</tr>
|
||
<tr>
|
||
<td>mouseWheel(int wheelAmt)</td>
|
||
<td>鼠标滚动(参数小于0,表示向上滚动;参数大于0,表示向下滚动)</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<h2 id="三-基本使用"><a href="#三-基本使用" class="headerlink" title="三.基本使用"></a>三.基本使用</h2><h3 id="1-模拟按键"><a href="#1-模拟按键" class="headerlink" title="1.模拟按键"></a>1.模拟按键</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> java.awt.*;</span><br><span class="line"><span class="keyword">import</span> java.awt.event.KeyEvent;</span><br><span class="line"><span class="keyword">import</span> java.util.Random;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Test</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> AWTException {</span><br><span class="line"> <span class="type">Robot</span> <span class="variable">robot</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Robot</span>();</span><br><span class="line"> <span class="comment">//延时函数,延时5秒</span></span><br><span class="line"> robot.delay(<span class="number">5000</span>);</span><br><span class="line"> <span class="comment">//模拟按一下K键</span></span><br><span class="line"> robot.keyPress(KeyEvent.VK_K);</span><br><span class="line"> <span class="comment">//产生一个随机的时间(0.2 ~ 0.4秒之间)</span></span><br><span class="line"> <span class="type">Random</span> <span class="variable">random</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Random</span>();</span><br><span class="line"> <span class="type">double</span> <span class="variable">randomValue</span> <span class="operator">=</span> random.nextDouble() * <span class="number">0.2</span> + <span class="number">0.2</span>;</span><br><span class="line"> robot.delay((<span class="type">int</span>)randomValue * <span class="number">1000</span>);</span><br><span class="line"> <span class="comment">//释放k键</span></span><br><span class="line"> robot.keyRelease(KeyEvent.VK_K);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-模拟鼠标"><a href="#2-模拟鼠标" class="headerlink" title="2.模拟鼠标"></a>2.模拟鼠标</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> java.awt.*;</span><br><span class="line"><span class="keyword">import</span> java.awt.event.InputEvent;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Test</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> AWTException {</span><br><span class="line"> <span class="type">Robot</span> <span class="variable">robot</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Robot</span>();</span><br><span class="line"> <span class="comment">//鼠标的移动</span></span><br><span class="line"> robot.mouseMove(<span class="number">800</span>, <span class="number">200</span>);</span><br><span class="line"> <span class="comment">//按下左键</span></span><br><span class="line"> robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);</span><br><span class="line"> <span class="comment">//弹起左键</span></span><br><span class="line"> robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);</span><br><span class="line"> <span class="comment">//鼠标滚轮(大于1 向上滚动)</span></span><br><span class="line"> robot.mouseWheel(<span class="number">1</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-获取颜色"><a href="#3-获取颜色" class="headerlink" title="3.获取颜色"></a>3.获取颜色</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> java.awt.*;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Test</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> AWTException {</span><br><span class="line"> <span class="type">Robot</span> <span class="variable">robot</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Robot</span>();</span><br><span class="line"> <span class="type">Color</span> <span class="variable">color</span> <span class="operator">=</span> robot.getPixelColor(<span class="number">520</span>, <span class="number">70</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>脚本</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>Java生成二维码</title>
|
||
<url>/posts/62439.html</url>
|
||
<content><![CDATA[<div class="note success flat"><p>SpringBoot + zxing 生成二维码</p>
|
||
<p>SpringBoot + qrcode生成二维码</p>
|
||
<p>原视频地址: <a href="https://www.bilibili.com/video/BV1Kw41197kh/?share_source=copy_web&vd_source=aee5e475191b69e6c781059ab6662584">Java生成二维码教程 | 两小时学会Java生成二维码</a></p>
|
||
<p>源码地址: <a href="https://github.com/JasonsGong/two-dimensional-code">JasonsGong/two-dimensional-code: 使用java生成二维码 (github.com)</a></p>
|
||
</div>
|
||
|
||
<h2 id="一-谷歌zxing开源库生成二维码"><a href="#一-谷歌zxing开源库生成二维码" class="headerlink" title="一.谷歌zxing开源库生成二维码"></a>一.谷歌zxing开源库生成二维码</h2><h3 id="1-创建一个sprinBoot项目"><a href="#1-创建一个sprinBoot项目" class="headerlink" title="1.创建一个sprinBoot项目"></a>1.创建一个sprinBoot项目</h3><p><img src="/pictures/image-20230828215513289.png" alt="image-20230828215513289"></p>
|
||
<h3 id="2-引入相关的依赖"><a href="#2-引入相关的依赖" class="headerlink" title="2.引入相关的依赖"></a>2.引入相关的依赖</h3><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependencies</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-web<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-test<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">scope</span>></span>test<span class="tag"></<span class="name">scope</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-thymeleaf<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.google.zxing<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>core<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>3.1.0<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.google.zxing<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>javase<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>3.1.0<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>commons-lang<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>commons-lang<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.6<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.projectlombok<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>lombok<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">optional</span>></span>true<span class="tag"></<span class="name">optional</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependencies</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-在templates目录下新建index-html文件"><a href="#3-在templates目录下新建index-html文件" class="headerlink" title="3.在templates目录下新建index.html文件"></a>3.在templates目录下新建index.html文件</h3><figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>Title<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-编写controller跳转到该页面,完成后重启项目,访问localhost-8080-测试"><a href="#4-编写controller跳转到该页面,完成后重启项目,访问localhost-8080-测试" class="headerlink" title="4.编写controller跳转到该页面,完成后重启项目,访问localhost:8080 测试"></a>4.编写controller跳转到该页面,完成后重启项目,访问localhost:8080 测试</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Controller</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">CodeController</span> {</span><br><span class="line"></span><br><span class="line"> <span class="meta">@GetMapping("/")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">index</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"index"</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="5-打开index-html,编写前端页面"><a href="#5-打开index-html,编写前端页面" class="headerlink" title="5.打开index.html,编写前端页面"></a>5.打开index.html,编写前端页面</h3><figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>二维码<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"><span class="tag"><<span class="name">h1</span>></span>谷歌zxing开源库生成黑白二维码<span class="tag"></<span class="name">h1</span>></span></span><br><span class="line"><span class="tag"><<span class="name">hr</span>></span></span><br><span class="line">请输入文本内容:<span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"text"</span> <span class="attr">id</span>=<span class="string">"url"</span>></span><span class="tag"><<span class="name">button</span> <span class="attr">onclick</span>=<span class="string">"generateQRCode()"</span>></span>生成二维码<span class="tag"></<span class="name">button</span>></span><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"><span class="tag"><<span class="name">img</span> <span class="attr">id</span>=<span class="string">"qrCodeImg"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">function</span> <span class="title function_">generateQRCode</span>(<span class="params"></span>){</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//获取url</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> url = <span class="variable language_">document</span>.<span class="title function_">getElementById</span>(<span class="string">"url"</span>).<span class="property">value</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//设置img标签的src属性</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> qrCodeImg = <span class="variable language_">document</span>.<span class="title function_">getElementById</span>(<span class="string">"qrCodeImg"</span>)</span></span><br><span class="line"><span class="language-javascript"> qrCodeImg.<span class="property">src</span> = <span class="string">"/generate?url="</span>+ url</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>由于后端部分没有编写,这时我们访问项目的时候会返回404</p>
|
||
<p><img src="/pictures/image-20230828223201038.png" alt="image-20230828223201038"></p>
|
||
<h3 id="6-后端代码的编写"><a href="#6-后端代码的编写" class="headerlink" title="6.后端代码的编写"></a>6.后端代码的编写</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.mine.code.controller;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.google.zxing.BarcodeFormat;</span><br><span class="line"><span class="keyword">import</span> com.google.zxing.EncodeHintType;</span><br><span class="line"><span class="keyword">import</span> com.google.zxing.MultiFormatWriter;</span><br><span class="line"><span class="keyword">import</span> com.google.zxing.WriterException;</span><br><span class="line"><span class="keyword">import</span> com.google.zxing.aztec.encoder.AztecCode;</span><br><span class="line"><span class="keyword">import</span> com.google.zxing.common.BitMatrix;</span><br><span class="line"><span class="keyword">import</span> com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;</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.stereotype.Controller;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.GetMapping;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RequestParam;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.ResponseBody;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.imageio.ImageIO;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.ServletOutputStream;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletResponse;</span><br><span class="line"><span class="keyword">import</span> java.awt.image.BufferedImage;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</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">@website</span> https://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/28</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">@Controller</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">CodeController</span> {</span><br><span class="line"></span><br><span class="line"> <span class="meta">@GetMapping("/")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">index</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"index"</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="meta">@GetMapping("/generate")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">generate</span><span class="params">(<span class="meta">@RequestParam("url")</span> String url, HttpServletResponse response)</span> {</span><br><span class="line"> log.info(<span class="string">"文本内容:{}"</span>, url);</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">//创建一个map集合,存储二维码的相关属性</span></span><br><span class="line"> <span class="type">Map</span> <span class="variable">map</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> <span class="comment">//EncodeHintType 编码的提示类型</span></span><br><span class="line"> <span class="comment">//设置二维码的误差校正级别 可选值有 L(7%) M(15%) Q(25%) H(30%)</span></span><br><span class="line"> <span class="comment">//选择L级别的容错率,相当于允许二维码在整体的颜色区域中,最多有7%的坏像素点;择H级别的容错率,相当于允许二维码在整体的颜色区域中,最多有30%的坏像素点</span></span><br><span class="line"> map.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);</span><br><span class="line"> <span class="comment">//设置二维码的字符集</span></span><br><span class="line"> map.put(EncodeHintType.CHARACTER_SET, <span class="string">"utf-8"</span>);</span><br><span class="line"> <span class="comment">//设置二维码四周的留白 1表示1像素</span></span><br><span class="line"> map.put(EncodeHintType.MARGIN, <span class="number">1</span>);</span><br><span class="line"> <span class="comment">//创建zxing的核心对象MultiFormatWriter (多格式写入器)</span></span><br><span class="line"> <span class="comment">//通过MultiFormatWriter对象来生成二维码</span></span><br><span class="line"> <span class="type">MultiFormatWriter</span> <span class="variable">writer</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">MultiFormatWriter</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">//BarcodeFormat(码格式) QR_CODE :常见的二维码格式之一,广泛应用于商品包装、扫码支付</span></span><br><span class="line"> <span class="comment">//AZTEC_CODE:高密度,可靠性很高 容错率更低 储存个人信息、证件信息、账户密码</span></span><br><span class="line"> <span class="comment">//PDF417 可以存储大量的信息 数据密度高 应用于航空机票、配送标签、法律文件</span></span><br><span class="line"> <span class="comment">//DATA_MATRIX: 小巧的二维码格式 编码格式类似于QR_CODE 但是优于QR_CODE 适合嵌入简单的产品标签 医疗图像 检测数据</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">//位矩阵对象 (位矩阵对象对象的内部实际上是一个二位数组,二维数组中每一个元素是boolean类型 true代表黑色 false代表白色)</span></span><br><span class="line"> <span class="type">BitMatrix</span> <span class="variable">bitMatrix</span> <span class="operator">=</span> writer.encode(url, BarcodeFormat.QR_CODE, <span class="number">300</span>, <span class="number">300</span>, map);</span><br><span class="line"> <span class="comment">//获取矩阵的宽度和高度</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">width</span> <span class="operator">=</span> bitMatrix.getWidth();</span><br><span class="line"> <span class="type">int</span> <span class="variable">height</span> <span class="operator">=</span> bitMatrix.getHeight();</span><br><span class="line"> <span class="comment">//生成二维码图片</span></span><br><span class="line"> <span class="type">BufferedImage</span> <span class="variable">image</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">BufferedImage</span>(width, height, BufferedImage.TYPE_INT_BGR);</span><br><span class="line"> <span class="comment">//遍历位矩阵对象</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">x</span> <span class="operator">=</span> <span class="number">0</span>; x < width; x++) {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">y</span> <span class="operator">=</span> <span class="number">0</span>; y < height; y++) {</span><br><span class="line"> <span class="comment">//设置每一块的颜色值</span></span><br><span class="line"> <span class="comment">//0xFF000000表示黑色 0xFFFFFFFF表示白色</span></span><br><span class="line"> image.setRGB(x, y, bitMatrix.get(x, y) ? <span class="number">0xFF000000</span> : <span class="number">0xFFFFFFFF</span>);</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="type">ServletOutputStream</span> <span class="variable">out</span> <span class="operator">=</span> response.getOutputStream();</span><br><span class="line"> ImageIO.write(image,<span class="string">"png"</span>,out);</span><br><span class="line"> out.flush();</span><br><span class="line"> out.close();</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="7-测试生成二维码"><a href="#7-测试生成二维码" class="headerlink" title="7.测试生成二维码"></a>7.测试生成二维码</h3><p><img src="/pictures/image-20230828233052417.png" alt="image-20230828233052417"></p>
|
||
<p><strong>完整的项目结构</strong></p>
|
||
<p><img src="/pictures/image-20230828233917645.png" alt="image-20230828233917645"></p>
|
||
<h3 id="8-生成一个带Logo的黑白二维码"><a href="#8-生成一个带Logo的黑白二维码" class="headerlink" title="8.生成一个带Logo的黑白二维码"></a>8.生成一个带Logo的黑白二维码</h3><p><strong>1.编写qrcode.html页面和跳转到该页面的controller</strong></p>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>生成带logo的黑白二维码<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"><span class="tag"><<span class="name">form</span> <span class="attr">action</span>=<span class="string">"/generateWithLogo"</span> <span class="attr">method</span>=<span class="string">"post"</span> <span class="attr">enctype</span>=<span class="string">"multipart/form-data"</span>></span></span><br><span class="line"> 请输入文本内容:<span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"text"</span> <span class="attr">name</span>=<span class="string">"url"</span>></span><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> 请选择logo图片:<span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"file"</span> <span class="attr">name</span>=<span class="string">"logo"</span>></span><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"submit"</span> <span class="attr">value</span>=<span class="string">"生成二维码"</span>></span></span><br><span class="line"><span class="tag"></<span class="name">form</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><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">@GetMapping("/logo")</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">toLogo</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"qrcode"</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>2.编写后端生成二维码逻辑</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><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">@PostMapping("/generateWithLogo")</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">generateWithLogo</span><span class="params">(<span class="meta">@RequestParam("url")</span> String url, HttpServletResponse response, HttpServletRequest request)</span> {</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">Map</span> <span class="variable">map</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> map.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);</span><br><span class="line"> map.put(EncodeHintType.CHARACTER_SET, <span class="string">"utf-8"</span>);</span><br><span class="line"> map.put(EncodeHintType.MARGIN, <span class="number">1</span>);</span><br><span class="line"> <span class="type">MultiFormatWriter</span> <span class="variable">writer</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">MultiFormatWriter</span>();</span><br><span class="line"> <span class="type">BitMatrix</span> <span class="variable">bitMatrix</span> <span class="operator">=</span> writer.encode(url, BarcodeFormat.QR_CODE, <span class="number">300</span>, <span class="number">300</span>, map);</span><br><span class="line"> <span class="type">int</span> <span class="variable">width</span> <span class="operator">=</span> bitMatrix.getWidth();</span><br><span class="line"> <span class="type">int</span> <span class="variable">height</span> <span class="operator">=</span> bitMatrix.getHeight();</span><br><span class="line"> <span class="type">BufferedImage</span> <span class="variable">image</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">BufferedImage</span>(width, height, BufferedImage.TYPE_INT_BGR);</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">x</span> <span class="operator">=</span> <span class="number">0</span>; x < width; x++) {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">y</span> <span class="operator">=</span> <span class="number">0</span>; y < height; y++) {</span><br><span class="line"> image.setRGB(x, y, bitMatrix.get(x, y) ? <span class="number">0xFF000000</span> : <span class="number">0xFFFFFFFF</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//给二维码添加logo</span></span><br><span class="line"> <span class="comment">//1.获取logo</span></span><br><span class="line"> <span class="type">Part</span> <span class="variable">logoPart</span> <span class="operator">=</span> request.getPart(<span class="string">"logo"</span>);</span><br><span class="line"> <span class="type">InputStream</span> <span class="variable">inputStream</span> <span class="operator">=</span> logoPart.getInputStream();</span><br><span class="line"> <span class="type">BufferedImage</span> <span class="variable">logoImage</span> <span class="operator">=</span> ImageIO.read(inputStream);</span><br><span class="line"> <span class="comment">//2.对获取的logo图片进行缩放</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">logoWidth</span> <span class="operator">=</span> logoImage.getWidth(<span class="literal">null</span>);</span><br><span class="line"> <span class="type">int</span> <span class="variable">logoHeight</span> <span class="operator">=</span> logoImage.getHeight(<span class="literal">null</span>);</span><br><span class="line"> <span class="keyword">if</span> (logoWidth > <span class="number">60</span>){</span><br><span class="line"> logoWidth = <span class="number">60</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (logoHeight > <span class="number">60</span>){</span><br><span class="line"> logoHeight = <span class="number">60</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//使用平滑缩放算法对原始的logo图像进行缩放到一个全新的图像</span></span><br><span class="line"> <span class="type">Image</span> <span class="variable">scaledLogo</span> <span class="operator">=</span> logoImage.getScaledInstance(logoWidth, logoHeight, Image.SCALE_SMOOTH);</span><br><span class="line"> <span class="comment">//3.将缩放的图片画在黑白的二维码上</span></span><br><span class="line"> <span class="comment">//获取一个画笔</span></span><br><span class="line"> <span class="type">Graphics2D</span> <span class="variable">graphics2D</span> <span class="operator">=</span> image.createGraphics();</span><br><span class="line"> <span class="comment">//计算从哪里开始画 300指的是二维码的宽度和高度</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">x</span> <span class="operator">=</span> (<span class="number">300</span> - logoWidth) /<span class="number">2</span>;</span><br><span class="line"> <span class="type">int</span> <span class="variable">y</span> <span class="operator">=</span> (<span class="number">300</span> - logoHeight) /<span class="number">2</span>;</span><br><span class="line"> <span class="comment">//画上去</span></span><br><span class="line"> graphics2D.drawImage(scaledLogo,x,y,<span class="literal">null</span>);</span><br><span class="line"> <span class="comment">//实现logo的圆角效果</span></span><br><span class="line"> <span class="type">Shape</span> <span class="variable">shape</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">RoundRectangle2D</span>.Float(x, y, logoWidth, logoHeight, <span class="number">10</span>, <span class="number">10</span>);</span><br><span class="line"> <span class="comment">//使用一个宽度为4像素的基本笔触</span></span><br><span class="line"> graphics2D.setStroke(<span class="keyword">new</span> <span class="title class_">BasicStroke</span>(<span class="number">4f</span>));</span><br><span class="line"> <span class="comment">//给logo画圆角矩形</span></span><br><span class="line"> graphics2D.draw(shape);</span><br><span class="line"> <span class="comment">//释放画笔</span></span><br><span class="line"> graphics2D.dispose();</span><br><span class="line"> <span class="comment">//将二维码响应到浏览器</span></span><br><span class="line"> ImageIO.write(image, <span class="string">"png"</span>, response.getOutputStream());</span><br><span class="line"> <span class="comment">//关闭流</span></span><br><span class="line"> inputStream.close();</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>访问 <a href="http://localhost:8080/logo">http://localhost:8080/logo</a> 测试</p>
|
||
<p><strong>实现的效果</strong></p>
|
||
<p><img src="/pictures/image-20230829160901904.png" alt="image-20230829160901904"></p>
|
||
<p><img src="/pictures/image-20230829160938795.png" alt="image-20230829160938795"></p>
|
||
<h2 id="二-github开源项目qrcode生成二维码"><a href="#二-github开源项目qrcode生成二维码" class="headerlink" title="二.github开源项目qrcode生成二维码"></a>二.github开源项目qrcode生成二维码</h2><h3 id="1-引入依赖文件"><a href="#1-引入依赖文件" class="headerlink" title="1.引入依赖文件"></a>1.引入依赖文件</h3><p>这里就不在重新创建工程了,直接在上面工程的基础上操作</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.github.liuyueyi.media<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>qrcode-plugin<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.5.2<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-生成黑白二维码"><a href="#2-生成黑白二维码" class="headerlink" title="2.生成黑白二维码"></a>2.生成黑白二维码</h3><p><strong>1.创建github-qrcode.html文件</strong></p>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>qrcode生成黑白二维码<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"><span class="tag"><<span class="name">h1</span>></span>使用github上的开源项目qrcode生成二维码<span class="tag"></<span class="name">h1</span>></span></span><br><span class="line"><span class="tag"><<span class="name">hr</span>></span></span><br><span class="line"><span class="tag"><<span class="name">form</span> <span class="attr">action</span>=<span class="string">"/generateWithQrCode"</span> <span class="attr">method</span>=<span class="string">"post"</span> <span class="attr">enctype</span>=<span class="string">"multipart/form-data"</span>></span></span><br><span class="line"> 请输入文本内容:<span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"text"</span> <span class="attr">name</span>=<span class="string">"url"</span>></span><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> 请选择logo图片:<span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"file"</span> <span class="attr">name</span>=<span class="string">"logo"</span>></span><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"submit"</span> <span class="attr">value</span>=<span class="string">"生成二维码"</span>></span></span><br><span class="line"><span class="tag"></<span class="name">form</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>2.编写controller处理请求</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.mine.code.controller;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeDeWrapper;</span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeGenWrapper;</span><br><span class="line"><span class="keyword">import</span> com.google.zxing.WriterException;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Controller;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.GetMapping;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.PostMapping;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RequestParam;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.imageio.ImageIO;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletRequest;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletResponse;</span><br><span class="line"><span class="keyword">import</span> java.awt.image.BufferedImage;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/29</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 使用qrcode生成二维码</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Controller</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">GithubQrCodeController</span> {</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 编写请求跳转到使用qrcode生成二维码的页面</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@GetMapping("/qrcode")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">toQrCode</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"github-qrcode"</span>;</span><br><span class="line"> }</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"> * 使用qrcode生成黑白二维码</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@PostMapping("/generateWithQrCode")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">generateWithQrCode</span><span class="params">(<span class="meta">@RequestParam("url")</span> String url, HttpServletResponse response, HttpServletRequest request)</span>{</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">//生成二维码</span></span><br><span class="line"> <span class="type">BufferedImage</span> <span class="variable">image</span> <span class="operator">=</span> QrCodeGenWrapper.of(url).asBufferedImage();</span><br><span class="line"> <span class="comment">//将生成的二维码响应到浏览器</span></span><br><span class="line"> ImageIO.write(image,<span class="string">"png"</span>,response.getOutputStream());</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>3.访问测试</strong></p>
|
||
<p><img src="/pictures/image-20230829223442421.png" alt="image-20230829223442421"></p>
|
||
<h3 id="3-生成带有logo的黑白二维码"><a href="#3-生成带有logo的黑白二维码" class="headerlink" title="3.生成带有logo的黑白二维码"></a>3.生成带有logo的黑白二维码</h3><p>前端页面延续使用上面的github-qrcode.html</p>
|
||
<p><strong>1.后端代码的编写</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.mine.code.controller;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeDeWrapper;</span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeGenWrapper;</span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeOptions;</span><br><span class="line"><span class="keyword">import</span> com.google.zxing.WriterException;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Controller;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.GetMapping;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.PostMapping;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RequestParam;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.imageio.ImageIO;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletRequest;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletResponse;</span><br><span class="line"><span class="keyword">import</span> java.awt.image.BufferedImage;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.io.InputStream;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/29</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 使用qrcode生成二维码</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Controller</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">GithubQrCodeController</span> {</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 编写请求跳转到使用qrcode生成二维码的页面</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@GetMapping("/qrcode")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">toQrCode</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"github-qrcode"</span>;</span><br><span class="line"> }</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"> * 使用qrcode生成黑白二维码</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@PostMapping("/generateWithQrCode")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">generateWithQrCode</span><span class="params">(<span class="meta">@RequestParam("url")</span> String url, HttpServletResponse response, HttpServletRequest request)</span>{</span><br><span class="line"> <span class="keyword">try</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">//BufferedImage image = QrCodeGenWrapper.of(url).asBufferedImage();</span></span><br><span class="line"> <span class="comment">//生成带logo的黑白二维码</span></span><br><span class="line"> <span class="type">InputStream</span> <span class="variable">inputStream</span> <span class="operator">=</span> request.getPart(<span class="string">"logo"</span>).getInputStream();</span><br><span class="line"> <span class="type">BufferedImage</span> <span class="variable">image</span> <span class="operator">=</span> QrCodeGenWrapper.of(url)</span><br><span class="line"> .setLogo(inputStream)<span class="comment">//logo图片的输入流</span></span><br><span class="line"> .setLogoRate(<span class="number">7</span>)<span class="comment">//设置logo图片和二维码之间的比例,7表示logo的宽度等于二维码的1/7</span></span><br><span class="line"> .setLogoStyle(QrCodeOptions.LogoStyle.ROUND)<span class="comment">//设置logo图片的样式,将logo的边框形状设置成圆形</span></span><br><span class="line"> .asBufferedImage();</span><br><span class="line"> <span class="comment">//将生成的二维码响应到浏览器</span></span><br><span class="line"> ImageIO.write(image,<span class="string">"png"</span>,response.getOutputStream());</span><br><span class="line"> <span class="comment">//关闭流</span></span><br><span class="line"> inputStream.close();</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>实现的效果</strong></p>
|
||
<p><img src="/pictures/image-20230829224339809.png" alt="image-20230829224339809"></p>
|
||
<h3 id="4-生成彩色的二维码"><a href="#4-生成彩色的二维码" class="headerlink" title="4.生成彩色的二维码"></a>4.生成彩色的二维码</h3><p>前端页面延续使用上面的github-qrcode.html</p>
|
||
<p><strong>1.后端代码的编写</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.mine.code.controller;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeDeWrapper;</span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeGenWrapper;</span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeOptions;</span><br><span class="line"><span class="keyword">import</span> com.google.zxing.WriterException;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Controller;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.GetMapping;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.PostMapping;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RequestParam;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.imageio.ImageIO;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletRequest;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletResponse;</span><br><span class="line"><span class="keyword">import</span> java.awt.*;</span><br><span class="line"><span class="keyword">import</span> java.awt.image.BufferedImage;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.io.InputStream;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/29</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 使用qrcode生成二维码</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Controller</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">GithubQrCodeController</span> {</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 编写请求跳转到使用qrcode生成二维码的页面</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@GetMapping("/qrcode")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">toQrCode</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"github-qrcode"</span>;</span><br><span class="line"> }</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"> * 使用qrcode生成黑白二维码</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@PostMapping("/generateWithQrCode")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">generateWithQrCode</span><span class="params">(<span class="meta">@RequestParam("url")</span> String url, HttpServletResponse response, HttpServletRequest request)</span>{</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">//生成彩色的二维码</span></span><br><span class="line"> <span class="type">BufferedImage</span> <span class="variable">image</span> <span class="operator">=</span> QrCodeGenWrapper.of(url).setDrawPreColor(Color.GREEN).asBufferedImage();</span><br><span class="line"> <span class="comment">//将生成的二维码响应到浏览器</span></span><br><span class="line"> ImageIO.write(image,<span class="string">"png"</span>,response.getOutputStream());</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>实现的效果</strong></p>
|
||
<p><img src="/pictures/image-20230829225017032.png" alt="image-20230829225017032"></p>
|
||
<h3 id="5-生成带有背景图的二维码"><a href="#5-生成带有背景图的二维码" class="headerlink" title="5.生成带有背景图的二维码"></a>5.生成带有背景图的二维码</h3><p>前端页面延续使用上面的github-qrcode.html</p>
|
||
<p><strong>1.后端代码的编写</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.mine.code.controller;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeDeWrapper;</span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeGenWrapper;</span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeOptions;</span><br><span class="line"><span class="keyword">import</span> com.google.zxing.WriterException;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Controller;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.GetMapping;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.PostMapping;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RequestParam;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.imageio.ImageIO;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletRequest;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletResponse;</span><br><span class="line"><span class="keyword">import</span> java.awt.*;</span><br><span class="line"><span class="keyword">import</span> java.awt.image.BufferedImage;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.io.InputStream;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/29</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 使用qrcode生成二维码</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Controller</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">GithubQrCodeController</span> {</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 编写请求跳转到使用qrcode生成二维码的页面</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@GetMapping("/qrcode")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">toQrCode</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"github-qrcode"</span>;</span><br><span class="line"> }</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"> * 使用qrcode生成黑白二维码</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@PostMapping("/generateWithQrCode")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">generateWithQrCode</span><span class="params">(<span class="meta">@RequestParam("url")</span> String url, HttpServletResponse response, HttpServletRequest request)</span>{</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">//生成带有背景图的二维码</span></span><br><span class="line"> <span class="type">InputStream</span> <span class="variable">inputStream</span> <span class="operator">=</span> request.getPart(<span class="string">"logo"</span>).getInputStream();</span><br><span class="line"> <span class="type">BufferedImage</span> <span class="variable">image</span> <span class="operator">=</span> QrCodeGenWrapper.of(url)</span><br><span class="line"> .setBgImg(inputStream)</span><br><span class="line"> .setBgOpacity(<span class="number">0.5F</span>)<span class="comment">//设置透明度</span></span><br><span class="line"> .asBufferedImage();</span><br><span class="line"> <span class="comment">//将生成的二维码响应到浏览器</span></span><br><span class="line"> ImageIO.write(image,<span class="string">"png"</span>,response.getOutputStream());</span><br><span class="line"> <span class="comment">//关闭流</span></span><br><span class="line"> inputStream.close();</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>实现的效果</strong></p>
|
||
<p><img src="/pictures/image-20230829225740156.png" alt="image-20230829225740156"></p>
|
||
<h3 id="6-生成特殊形状的二维码"><a href="#6-生成特殊形状的二维码" class="headerlink" title="6.生成特殊形状的二维码"></a>6.生成特殊形状的二维码</h3><p>前端页面延续使用上面的github-qrcode.html</p>
|
||
<p><strong>1.后端代码的编写</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.mine.code.controller;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeDeWrapper;</span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeGenWrapper;</span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeOptions;</span><br><span class="line"><span class="keyword">import</span> com.google.zxing.WriterException;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Controller;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.GetMapping;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.PostMapping;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RequestParam;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.imageio.ImageIO;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletRequest;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletResponse;</span><br><span class="line"><span class="keyword">import</span> java.awt.*;</span><br><span class="line"><span class="keyword">import</span> java.awt.image.BufferedImage;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.io.InputStream;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/29</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 使用qrcode生成二维码</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Controller</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">GithubQrCodeController</span> {</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 编写请求跳转到使用qrcode生成二维码的页面</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@GetMapping("/qrcode")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">toQrCode</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"github-qrcode"</span>;</span><br><span class="line"> }</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"> * 使用qrcode生成黑白二维码</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@PostMapping("/generateWithQrCode")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">generateWithQrCode</span><span class="params">(<span class="meta">@RequestParam("url")</span> String url, HttpServletResponse response, HttpServletRequest request)</span>{</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">//生成特殊形状的二维码</span></span><br><span class="line"> <span class="type">BufferedImage</span> <span class="variable">image</span> <span class="operator">=</span> QrCodeGenWrapper.of(url)</span><br><span class="line"> .setDrawEnableScale(<span class="literal">true</span>)<span class="comment">//启用二维码绘制时的缩放功能</span></span><br><span class="line"> .setDrawStyle(QrCodeOptions.DrawStyle.DIAMOND)<span class="comment">//绘制钻石形状的二维码</span></span><br><span class="line"> .asBufferedImage();</span><br><span class="line"> <span class="comment">//将生成的二维码响应到浏览器</span></span><br><span class="line"> ImageIO.write(image,<span class="string">"png"</span>,response.getOutputStream());</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>实现的效果</strong></p>
|
||
<p><img src="/pictures/image-20230829230236500.png" alt="image-20230829230236500"></p>
|
||
<h3 id="7-生成图片填充二维码"><a href="#7-生成图片填充二维码" class="headerlink" title="7.生成图片填充二维码"></a>7.生成图片填充二维码</h3><p>前端页面延续使用上面的github-qrcode.html</p>
|
||
<p><strong>1.后端代码的编写</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.mine.code.controller;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeDeWrapper;</span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeGenWrapper;</span><br><span class="line"><span class="keyword">import</span> com.github.hui.quick.plugin.qrcode.wrapper.QrCodeOptions;</span><br><span class="line"><span class="keyword">import</span> com.google.zxing.WriterException;</span><br><span class="line"><span class="keyword">import</span> com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Controller;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.GetMapping;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.PostMapping;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RequestParam;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.imageio.ImageIO;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletRequest;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletResponse;</span><br><span class="line"><span class="keyword">import</span> java.awt.*;</span><br><span class="line"><span class="keyword">import</span> java.awt.image.BufferedImage;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.io.InputStream;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/29</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 使用qrcode生成二维码</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Controller</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">GithubQrCodeController</span> {</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 编写请求跳转到使用qrcode生成二维码的页面</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@GetMapping("/qrcode")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">toQrCode</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"github-qrcode"</span>;</span><br><span class="line"> }</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"> * 使用qrcode生成黑白二维码</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@PostMapping("/generateWithQrCode")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">generateWithQrCode</span><span class="params">(<span class="meta">@RequestParam("url")</span> String url, HttpServletResponse response, HttpServletRequest request)</span> {</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">//生成图片填充二维码</span></span><br><span class="line"> <span class="type">InputStream</span> <span class="variable">inputStream</span> <span class="operator">=</span> request.getPart(<span class="string">"logo"</span>).getInputStream();</span><br><span class="line"> <span class="type">BufferedImage</span> <span class="variable">image</span> <span class="operator">=</span> QrCodeGenWrapper.of(url)</span><br><span class="line"> .setErrorCorrection(ErrorCorrectionLevel.H)<span class="comment">//设置二维码的纠正级别</span></span><br><span class="line"> .setDrawStyle(QrCodeOptions.DrawStyle.IMAGE)<span class="comment">//绘制二维码的时候采用图片填充</span></span><br><span class="line"> .addImg(<span class="number">1</span>, <span class="number">1</span>, inputStream)<span class="comment">//添加图片</span></span><br><span class="line"> .asBufferedImage();</span><br><span class="line"> <span class="comment">//将生成的二维码响应到浏览器</span></span><br><span class="line"> ImageIO.write(image, <span class="string">"png"</span>, response.getOutputStream());</span><br><span class="line"> <span class="comment">//关闭流</span></span><br><span class="line"> inputStream.close();</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>实现的效果</strong></p>
|
||
<p>二维码中的每一个像素点都是上传的图片,生成的速度很慢</p>
|
||
<p><img src="/pictures/image-20230829230843477.png" alt="image-20230829230843477"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>二维码</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>MySql进阶教程</title>
|
||
<url>/posts/39654.html</url>
|
||
<content><![CDATA[<p><strong>全部的PDF笔记:</strong> <a href="https://qingling.icu/posts/50465.html">https://qingling.icu/posts/50465.html</a></p>
|
||
<p><strong>原视频地址:</strong> <a href="https://www.bilibili.com/video/BV1Kr4y1i7ru/?share_source=copy_web&vd_source=aee5e475191b69e6c781059ab6662584">黑马程序员 MySQL数据库入门到精通,从mysql安装到mysql高级、mysql优化全囊括</a></p>
|
||
<h1 id="一-Mysql入门"><a href="#一-Mysql入门" class="headerlink" title="一.Mysql入门"></a>一.Mysql入门</h1><h2 id="1-SQL"><a href="#1-SQL" class="headerlink" title="1.SQL"></a>1.SQL</h2><p>全称 Structured Query Language,结构化查询语言。操作关系型数据库的编程语言,定义了一套操作关系型数据库统一标准 。</p>
|
||
<h3 id="1-1-SQL通用语法"><a href="#1-1-SQL通用语法" class="headerlink" title="1.1 SQL通用语法"></a>1.1 SQL通用语法</h3><p><img src="/pictures/image-20230926220120609.png" alt="image-20230926220120609"></p>
|
||
<h3 id="1-2-SQL分类"><a href="#1-2-SQL分类" class="headerlink" title="1.2 SQL分类"></a>1.2 SQL分类</h3><p><img src="/pictures/image-20230926215941275.png" alt="image-20230926215941275"></p>
|
||
<h3 id="1-3-DDL-数据定义语言"><a href="#1-3-DDL-数据定义语言" class="headerlink" title="1.3 DDL-数据定义语言"></a>1.3 DDL-数据定义语言</h3><p><strong>连接本地mysql的命令</strong></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">mysql -u root -p</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>常用的DDL操作</strong></p>
|
||
<figure class="highlight sql"><table><tr><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="keyword">show</span> databases ;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询当前的数据库</span></span><br><span class="line"><span class="keyword">select</span> database();</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 创建数据库</span></span><br><span class="line"><span class="keyword">create</span> database if <span class="keyword">not</span> <span class="keyword">exists</span> itcast;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除数据库</span></span><br><span class="line"><span class="keyword">drop</span> database if <span class="keyword">exists</span> itcast;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 使用数据库</span></span><br><span class="line">use itcast;</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><br><span class="line"><span class="comment">-- 创建用户表</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> tb_user(id <span class="type">int</span> comment <span class="string">'编号'</span>, name <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'姓名'</span>, age <span class="type">int</span> comment <span class="string">'年龄'</span>,gender <span class="type">varchar</span>(<span class="number">1</span>) comment <span class="string">'性别'</span> ) comment <span class="string">'用户表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 显示创建表的结构</span></span><br><span class="line"><span class="keyword">desc</span> tb_user;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 显示创建表的语句</span></span><br><span class="line"><span class="keyword">show</span> <span class="keyword">create</span> <span class="keyword">table</span> tb_user;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除表</span></span><br><span class="line"><span class="keyword">drop</span> <span class="keyword">table</span> emp;</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="keyword">create</span> <span class="keyword">table</span> emp(</span><br><span class="line"> id <span class="type">int</span> comment <span class="string">'编号'</span>,</span><br><span class="line"> workno <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'工号'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> gender <span class="type">char</span>(<span class="number">1</span>) comment <span class="string">'性别'</span>,</span><br><span class="line"> age tinyint unsigned comment <span class="string">'年龄'</span>,</span><br><span class="line"> idcard <span class="type">char</span>(<span class="number">18</span>) comment <span class="string">'身份证号'</span>,</span><br><span class="line"> entrydate <span class="type">date</span> comment <span class="string">'入职时间'</span></span><br><span class="line">) comment <span class="string">'员工表'</span>;</span><br><span class="line"><span class="comment">-- 查看表结构</span></span><br><span class="line"><span class="keyword">desc</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改表结构(向emp表中添加昵称字段)</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp <span class="keyword">add</span> nickname <span class="type">varchar</span>(<span class="number">20</span>) comment <span class="string">'昵称'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改相应字段的数据类型(把age的数据类型从int改回tinyint)</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp modify age tinyint;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改字段名和字段的类型(把nicknem字段改为username,并修改数据类型)</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp change nickname username <span class="type">varchar</span>(<span class="number">30</span>) comment <span class="string">'用户名'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除字段(删除username字段)</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp <span class="keyword">drop</span> username;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改表名(将表名字从emo修改为employee)</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp rename <span class="keyword">to</span> employee;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除表</span></span><br><span class="line"><span class="keyword">drop</span> <span class="keyword">table</span> if <span class="keyword">exists</span> employee;</span><br><span class="line"><span class="comment">-- 删除指定表,并重新创建该表(相当于删除表中的全部数据)</span></span><br><span class="line"><span class="keyword">truncate</span> <span class="keyword">table</span> employee;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>Mysql的数据类型</strong></p>
|
||
<p>数值数据类型</p>
|
||
<p><img src="/pictures/image-20230926224723586.png" alt="image-20230926224723586"></p>
|
||
<p> 字符串数据类型</p>
|
||
<p> <img src="/pictures/image-20230926224755542.png" alt="image-20230926224755542"></p>
|
||
<p>日期时间类型</p>
|
||
<p> <img src="/pictures/image-20230926224539052.png" alt="image-20230926224539052"></p>
|
||
<h3 id="1-4-DML-数据操作语言"><a href="#1-4-DML-数据操作语言" class="headerlink" title="1.4 DML-数据操作语言"></a>1.4 DML-数据操作语言</h3><figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- ------------------------------------------------DML-增删改操作---------------------------------------------------</span></span><br><span class="line"><span class="comment">-- 添加数据</span></span><br><span class="line"><span class="keyword">select</span> database();</span><br><span class="line"><span class="keyword">show</span> tables;</span><br><span class="line"><span class="comment">-- 该指定的字段添加数据</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> employee(id, workno, name, gender, age, idcard, entrydate) <span class="keyword">value</span> (<span class="number">1</span>, <span class="string">'1'</span>, <span class="string">'小华'</span>, <span class="string">'男'</span>, <span class="number">20</span>, <span class="string">'123456789123456789'</span>, <span class="string">'2001-01-01'</span>);</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> employee;</span><br><span class="line"><span class="comment">-- 给全部的字段添加数据</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> employee <span class="keyword">value</span> (<span class="number">2</span>, <span class="string">'2'</span>, <span class="string">'小刚'</span>, <span class="string">'男'</span>, <span class="number">23</span>, <span class="string">'123456784124456789'</span>, <span class="string">'2008-01-01'</span>);</span><br><span class="line"><span class="comment">-- 批量添加数据</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> employee</span><br><span class="line"><span class="keyword">values</span> (<span class="number">3</span>, <span class="string">'3'</span>, <span class="string">'小李'</span>, <span class="string">'男'</span>, <span class="number">23</span>, <span class="string">'123456784124456789'</span>, <span class="string">'2008-01-01'</span>),</span><br><span class="line"> (<span class="number">4</span>, <span class="string">'4'</span>, <span class="string">'小黄'</span>, <span class="string">'男'</span>, <span class="number">23</span>, <span class="string">'123456784124456789'</span>, <span class="string">'2008-01-01'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改数据(不带条件修改所有)</span></span><br><span class="line"><span class="keyword">update</span> employee <span class="keyword">set</span> name <span class="operator">=</span> <span class="string">'张三'</span> <span class="keyword">where</span> id <span class="operator">=</span> <span class="number">1</span>;</span><br><span class="line"><span class="keyword">update</span> employee <span class="keyword">set</span> name <span class="operator">=</span> <span class="string">'李四'</span>, gender<span class="operator">=</span> <span class="string">'女'</span> <span class="keyword">where</span> id <span class="operator">=</span> <span class="number">1</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除数据(删除id为4的数据,不带添加删除所有)</span></span><br><span class="line"><span class="keyword">delete</span> <span class="keyword">from</span> employee <span class="keyword">where</span> id <span class="operator">=</span> <span class="number">4</span>;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="1-5-DQL-数据查询语言"><a href="#1-5-DQL-数据查询语言" class="headerlink" title="1.5 DQL-数据查询语言"></a>1.5 DQL-数据查询语言</h3><p><img src="/pictures/image-20230930222149036.png" alt="image-20230930222149036"></p>
|
||
<ul>
|
||
<li>基本查询(不带任何条件)</li>
|
||
<li>条件查询(WHERE)</li>
|
||
<li>聚合函数(count、max、min、avg、sum)</li>
|
||
<li>分组查询(group by)</li>
|
||
<li>排序查询(order by)</li>
|
||
<li>分页查询(limit</li>
|
||
</ul>
|
||
<p><strong>测试数据准备</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 数据准备</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> emp(</span><br><span class="line"> id <span class="type">int</span> comment <span class="string">'编号'</span>,</span><br><span class="line"> workno <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'工号'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> gender <span class="type">char</span>(<span class="number">1</span>) comment <span class="string">'性别'</span>,</span><br><span class="line"> age tinyint unsigned comment <span class="string">'年龄'</span>,</span><br><span class="line"> idcard <span class="type">char</span>(<span class="number">18</span>) comment <span class="string">'身份证号'</span>,</span><br><span class="line"> workaddress <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'工作地址'</span>,</span><br><span class="line"> entrydate <span class="type">date</span> comment <span class="string">'入职时间'</span></span><br><span class="line">) comment <span class="string">'员工表'</span>;</span><br><span class="line"><span class="comment">-- 插入数据</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> emp(id, workno, name, gender, age, idcard, workaddress,entrydate)</span><br><span class="line"><span class="keyword">values</span> (<span class="number">1</span>,<span class="string">'1'</span>,<span class="string">'柳岩'</span>,<span class="string">'女'</span>,<span class="number">20</span>,<span class="string">'12345678912345678'</span>,<span class="string">'北京'</span>,<span class="string">'2001-01-01'</span>),</span><br><span class="line"> (<span class="number">2</span>,<span class="string">'2'</span>,<span class="string">'张无忌'</span>,<span class="string">'男'</span>,<span class="number">18</span>,<span class="string">'123456789012345670'</span>,<span class="string">'北京'</span>,<span class="string">'2005-09-01'</span>),</span><br><span class="line"> (<span class="number">3</span>,<span class="string">'3'</span>,<span class="string">'韦一笑'</span>,<span class="string">'男'</span>,<span class="number">38</span>,<span class="string">'12345678972345670'</span>,<span class="string">'上海'</span>,<span class="string">'2005-08-01'</span>),</span><br><span class="line"> (<span class="number">4</span>,<span class="string">'4'</span>,<span class="string">'赵敏'</span>,<span class="string">'女'</span>,<span class="number">18</span>,<span class="string">'12345675712345670'</span>,<span class="string">'北京'</span>,<span class="string">'2009-12-01'</span>),</span><br><span class="line"> (<span class="number">5</span>,<span class="string">'5'</span>,<span class="string">'小昭'</span>,<span class="string">'女'</span>,<span class="number">16</span>,<span class="string">'123456769012345678'</span>,<span class="string">'上海'</span>,<span class="string">'2007-07-01'</span>),</span><br><span class="line"> (<span class="number">6</span>,<span class="string">'6'</span>,<span class="string">'杨逍'</span>,<span class="string">'男'</span>,<span class="number">28</span>,<span class="string">'1234567893123456X'</span>,<span class="string">'北京'</span>,<span class="string">'2006-01-01'</span>),</span><br><span class="line"> (<span class="number">7</span>,<span class="string">'7'</span>,<span class="string">'范瑶'</span>,<span class="string">'男'</span>,<span class="number">40</span>,<span class="string">'123456789212345670'</span>,<span class="string">'北京'</span>,<span class="string">'2005-05-01'</span>),</span><br><span class="line"> (<span class="number">8</span>,<span class="string">'8'</span>,<span class="string">'黛绮丝'</span>,<span class="string">'女'</span>,<span class="number">38</span>,<span class="string">'123456157123645670'</span>,<span class="string">'天津'</span>,<span class="string">'2015-05-01'</span>),</span><br><span class="line"> (<span class="number">9</span>,<span class="string">'9'</span>,<span class="string">'范凉凉'</span>,<span class="string">'女'</span>,<span class="number">45</span>,<span class="string">'123156789012345678'</span>,<span class="string">'北京'</span>,<span class="string">'2010-04-01'</span>),</span><br><span class="line"> (<span class="number">10</span>,<span class="string">'10'</span>,<span class="string">'陈友谅'</span>,<span class="string">'男'</span>,<span class="number">53</span>,<span class="string">'123456789012345670'</span>,<span class="string">'上海'</span>,<span class="string">'2011-01-01'</span>),</span><br><span class="line"> (<span class="number">11</span>,<span class="string">'11'</span>,<span class="string">'张士诚'</span>,<span class="string">'男'</span>,<span class="number">55</span>,<span class="string">'12356789712345670'</span>,<span class="string">'江苏'</span>,<span class="string">'2015-05-01'</span>),</span><br><span class="line"> (<span class="number">12</span>,<span class="string">'12'</span>,<span class="string">'常遇春'</span>,<span class="string">'男'</span>,<span class="number">32</span>,<span class="string">'123446757152345670'</span>,<span class="string">'北京'</span>,<span class="string">'2004-02-01'</span>),</span><br><span class="line"> (<span class="number">13</span>,<span class="string">'13'</span>,<span class="string">'张三丰'</span>,<span class="string">'男'</span>,<span class="number">88</span>,<span class="string">'123656789012345678'</span>,<span class="string">'江苏'</span>,<span class="string">'2020-11-01'</span>),</span><br><span class="line"> (<span class="number">14</span>,<span class="string">'14'</span>,<span class="string">'灭绝'</span>,<span class="string">'女'</span>,<span class="number">65</span>,<span class="string">'123456719012345670'</span>,<span class="string">'西安'</span>,<span class="string">'2019-05-01'</span>),</span><br><span class="line"> (<span class="number">15</span>,<span class="string">'15'</span>,<span class="string">'胡青年'</span>,<span class="string">'男'</span>,<span class="number">70</span>,<span class="string">'12345674971234567X'</span>,<span class="string">'西安'</span>,<span class="string">'2018-04-01'</span>),</span><br><span class="line"> (<span class="number">16</span>,<span class="string">'16'</span>,<span class="string">'周芷若'</span>,<span class="string">'女'</span>,<span class="number">18</span>,<span class="keyword">null</span>,<span class="string">'北京'</span>,<span class="string">'2012-06-01'</span>);</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-5-1-基础查询"><a href="#1-5-1-基础查询" class="headerlink" title="1.5.1 基础查询"></a>1.5.1 基础查询</h4><figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 查看插入的数据</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询指定字段 name workno age 返回</span></span><br><span class="line"><span class="keyword">select</span> name, workno, age</span><br><span class="line"><span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询所有字段返回</span></span><br><span class="line"><span class="keyword">select</span> id,</span><br><span class="line"> workno,</span><br><span class="line"> name,</span><br><span class="line"> gender,</span><br><span class="line"> age,</span><br><span class="line"> idcard,</span><br><span class="line"> workaddress,</span><br><span class="line"> entrydate</span><br><span class="line"><span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- distinct去重关键字</span></span><br><span class="line"><span class="comment">-- 查询所有员工的工作地址(不要重复的地址)</span></span><br><span class="line"><span class="keyword">select</span> <span class="keyword">distinct</span> workaddress <span class="string">'工作地址'</span></span><br><span class="line"><span class="keyword">from</span> emp;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-5-2-条件查询"><a href="#1-5-2-条件查询" class="headerlink" title="1.5.2 条件查询"></a>1.5.2 条件查询</h4><p>语法: <code>SELECT 字段列表 FROM 表名 WHERE 条件列表 ;</code></p>
|
||
<p><img src="/pictures/image-20231001154822524.png" alt="image-20231001154822524"></p>
|
||
<p><img src="/pictures/image-20231001154903121.png" alt="image-20231001154903121"></p>
|
||
<p><strong>举例</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 条件查询</span></span><br><span class="line"><span class="comment">-- 查询年龄等于 88 的员工</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator">=</span> <span class="number">88</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄小于20的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator"><</span> <span class="number">20</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄小于等于20的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator"><=</span> <span class="number">20</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询没有身份证号的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> idcard <span class="keyword">is</span> <span class="keyword">null</span> ;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄不等于88的员工信息(<>也表示不等于)</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator">!=</span> <span class="number">88</span>;</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator"><></span> <span class="number">88</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄在15~20(包含)之间的员工信息(三种实现方式)</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator">>=</span> <span class="number">15</span> <span class="operator">&&</span> age <span class="operator"><=</span> <span class="number">20</span>;</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator">>=</span> <span class="number">15</span> <span class="keyword">and</span> age <span class="operator"><=</span> <span class="number">20</span>;</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="keyword">between</span> <span class="number">15</span> <span class="keyword">and</span> <span class="number">20</span>; #包含了<span class="number">15</span>和<span class="number">20</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询性别为女 且年龄小于25岁的员工</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> gender <span class="operator">=</span> <span class="string">'女'</span> <span class="keyword">and</span> age <span class="operator"><</span> <span class="number">25</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄等于18 或 20 或 48 的员工</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator">=</span> <span class="number">18</span> <span class="keyword">or</span> age <span class="operator">=</span> <span class="number">20</span> <span class="keyword">or</span> age <span class="operator">=</span> <span class="number">48</span>;</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="keyword">in</span> (<span class="number">18</span>,<span class="number">20</span>,<span class="number">48</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询姓名为两个字的员工(模糊匹配(_匹配单个字符, %匹配任意个字符))</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> name <span class="keyword">like</span> <span class="string">'__'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询身份证号最后一位是X的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> idcard <span class="keyword">like</span> <span class="string">'%X'</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-5-3-聚合函数"><a href="#1-5-3-聚合函数" class="headerlink" title="1.5.3 聚合函数"></a>1.5.3 聚合函数</h4><p>语法: <code>SELECT 聚合函数(字段列表) FROM 表名 ;</code></p>
|
||
<blockquote>
|
||
<p>注意 : NULL值是不参与所有聚合函数运算的</p>
|
||
</blockquote>
|
||
<p><img src="/pictures/image-20231001160812611.png" alt="image-20231001160812611"></p>
|
||
<figure class="highlight sql"><table><tr><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="keyword">select</span> <span class="built_in">count</span>(<span class="operator">*</span>) <span class="keyword">from</span> emp;</span><br><span class="line"><span class="keyword">select</span> <span class="built_in">count</span>(idcard) <span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 统计该企业员工的平均年龄</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">avg</span>(age) <span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 统计该企业员工的最大年龄</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">max</span>(age) <span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 统计该企业员工的最小年龄</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">min</span>(age) <span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 统计西安地区员工的年龄之和</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">sum</span>(age) <span class="keyword">from</span> emp <span class="keyword">where</span> workaddress <span class="operator">=</span> <span class="string">'西安'</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-5-4-分组查询"><a href="#1-5-4-分组查询" class="headerlink" title="1.5.4 分组查询"></a>1.5.4 分组查询</h4><p>语法: <code>SELECT 字段列表 FROM 表名 [ WHERE 条件 ] GROUP BY 分组字段名 [ HAVING 分组 后过滤条件 ];</code></p>
|
||
<p><strong>where与having区别</strong></p>
|
||
<ul>
|
||
<li>执行时机不同:where是分组之前进行过滤,不满足where条件,不参与分组;而having是分组之后对结果进行过滤</li>
|
||
<li>判断条件不同:where不能对聚合函数进行判断,而having可以</li>
|
||
</ul>
|
||
<blockquote>
|
||
<p>注意事项:<br>• 分组之后,查询的字段一般为聚合函数和分组字段,查询其他字段无任何意义。<br>• 执行顺序: where > 聚合函数 > having 。<br>• 支持多字段分组, 具体语法为 : group by columnA,columnB</p>
|
||
</blockquote>
|
||
<p><img src="/pictures/image-20231001163315161.png" alt="image-20231001163315161"></p>
|
||
<figure class="highlight sql"><table><tr><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="keyword">select</span> gender, <span class="built_in">count</span>(<span class="operator">*</span>) <span class="keyword">from</span> emp <span class="keyword">group</span> <span class="keyword">by</span> gender;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 根据性别进行分组,统计男性员工和女性员工的平均年龄</span></span><br><span class="line"><span class="keyword">select</span> gender, <span class="built_in">avg</span>(age) <span class="keyword">from</span> emp <span class="keyword">group</span> <span class="keyword">by</span> gender;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄小于45岁的员工,并根据工作地址分组,获取员工数量大于等于3的工作地址(可以使用别名也可以不使用别名)</span></span><br><span class="line"><span class="keyword">select</span> workaddress,<span class="built_in">count</span>(<span class="operator">*</span>) address_count <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator"><</span> <span class="number">45</span> <span class="keyword">group</span> <span class="keyword">by</span> workaddress <span class="keyword">having</span> address_count <span class="operator">>=</span> <span class="number">3</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-5-5-排序查询"><a href="#1-5-5-排序查询" class="headerlink" title="1.5.5 排序查询"></a>1.5.5 排序查询</h4><p>语法: <code>SELECT 字段列表 FROM 表名 ORDER BY 字段1 排序方式1 , 字段2 排序方式2 ;</code></p>
|
||
<blockquote>
|
||
<p>注意事项:<br>• 如果是升序, 可以不指定排序方式ASC,因为升序ASC是默认值 ;<br>• 如果是多字段排序,当第一个字段值相同时,才会根据第二个字段进行排序 ;</p>
|
||
</blockquote>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 排序查询</span></span><br><span class="line"><span class="comment">-- 根据年龄对公司的员工进行升序排序(asc可以省略)</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">order</span> <span class="keyword">by</span> age ;</span><br><span class="line"><span class="comment">-- 降序排序</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">order</span> <span class="keyword">by</span> age <span class="keyword">desc</span> ;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 根据员工的入职时间降序排序</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">order</span> <span class="keyword">by</span> entrydate <span class="keyword">desc</span> ;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 根据员工的年龄升序排序,年龄相同,再按照入职时间进行降序排序</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">order</span> <span class="keyword">by</span> age <span class="keyword">asc</span> ,entrydate <span class="keyword">desc</span> ;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-5-6-分页查询"><a href="#1-5-6-分页查询" class="headerlink" title="1.5.6 分页查询"></a>1.5.6 分页查询</h4><p>语法: <code>SELECT 字段列表 FROM 表名 LIMIT 起始索引, 查询记录数 ;</code></p>
|
||
<blockquote>
|
||
<p>注意事项:<br>• 起始索引从0开始,起始索引 = (查询页码 - 1)* 每页显示记录数。<br>• 分页查询是数据库的方言,不同的数据库有不同的实现,MySQL中是LIMIT。<br>• 如果查询的是第一页数据,起始索引可以省略,直接简写为 limit 10。</p>
|
||
</blockquote>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 分页查询</span></span><br><span class="line"><span class="comment">-- 查询第一页的员工数据,每页显示10条记录</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp limit <span class="number">0</span>,<span class="number">10</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询第二页数据,每页展示十条数据(起始索引 = (查询页码 - 1)* 每页显示记录数)</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp limit <span class="number">10</span>,<span class="number">10</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-5-7-DQL语句案例"><a href="#1-5-7-DQL语句案例" class="headerlink" title="1.5.7 DQL语句案例"></a>1.5.7 DQL语句案例</h4><figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- DQL语句案例</span></span><br><span class="line"><span class="comment">-- 查询年龄在20,21,22,23岁的女性员工的信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> gender <span class="operator">=</span> <span class="string">'女'</span> <span class="keyword">and</span> age <span class="keyword">in</span> (<span class="number">20</span>,<span class="number">21</span>,<span class="number">22</span>,<span class="number">23</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询性别为男,并且年龄再20~40岁(含)以内的姓名为三个字的员工</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> gender <span class="operator">=</span> <span class="string">'男'</span> <span class="keyword">and</span> (age <span class="keyword">between</span> <span class="number">20</span> <span class="keyword">and</span> <span class="number">40</span>) <span class="keyword">and</span> name <span class="keyword">like</span> <span class="string">'___'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 统计员工表中,年龄小于60岁的,男性员工和女性员工的人数</span></span><br><span class="line"><span class="keyword">select</span> gender,<span class="built_in">count</span>(<span class="operator">*</span>) <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator"><</span> <span class="number">60</span> <span class="keyword">group</span> <span class="keyword">by</span> gender;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询所有年龄小于等于35岁员工的姓名和年龄,并对查询结果按年龄升序排序,如果年龄相同按照入职时间降序排序</span></span><br><span class="line"><span class="keyword">select</span> name,age <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator"><=</span> <span class="number">35</span> <span class="keyword">order</span> <span class="keyword">by</span> age <span class="keyword">asc</span> ,entrydate <span class="keyword">desc</span> ;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询性别为男,且年龄在20·40岁(含)以内的前五个员工信息,并对查询结果按年龄升序排序,如果年龄相同按照入职时间升序排序</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> gender <span class="operator">=</span> <span class="string">'男'</span> <span class="keyword">and</span> age <span class="keyword">between</span> <span class="number">20</span> <span class="keyword">and</span> <span class="number">40</span> <span class="keyword">order</span> <span class="keyword">by</span> age,entrydate limit <span class="number">5</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-5-8-执行顺序"><a href="#1-5-8-执行顺序" class="headerlink" title="1.5.8 执行顺序"></a>1.5.8 执行顺序</h4><p><img src="/pictures/image-20231001171425562.png" alt="image-20231001171425562"></p>
|
||
<p><img src="/pictures/image-20231001172032063.png" alt="image-20231001172032063"></p>
|
||
<p><strong>总结</strong></p>
|
||
<p> <img src="/pictures/image-20231001172211635.png" alt="image-20231001172211635"></p>
|
||
<h3 id="1-6-DCL-数据控制语言"><a href="#1-6-DCL-数据控制语言" class="headerlink" title="1.6 DCL-数据控制语言"></a>1.6 DCL-数据控制语言</h3><h4 id="1-6-1-管理用户"><a href="#1-6-1-管理用户" class="headerlink" title="1.6.1 管理用户"></a>1.6.1 管理用户</h4><p>查询用户: <code>select * from mysql.user;</code></p>
|
||
<p>创建用户:<code>CREATE USER '用户名'@'主机名' IDENTIFIED BY '密码';</code></p>
|
||
<p>修改用户密码: <code>ALTER USER '用户名'@'主机名' IDENTIFIED WITH mysql_native_password BY '新密码' ;</code></p>
|
||
<p>删除用户:<code>DROP USER '用户名'@'主机名' ;</code></p>
|
||
<p><img src="/pictures/image-20231001172731731.png" alt="image-20231001172731731"></p>
|
||
<blockquote>
|
||
<p>注意事项:<br>• 在MySQL中需要通过用户名@主机名的方式,来唯一标识一个用户</p>
|
||
<p>• 主机名可以使用 % 通配</p>
|
||
<p>• 这类SQL开发人员操作的比较少,主要是DBA( Database Administrator 数据库管理员)使用</p>
|
||
</blockquote>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 切换到系统中自带的mysql数据库</span></span><br><span class="line">use mysql;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询所有的用户</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> mysql.user;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 创建用户itcast, 只能够在当前主机localhost访问, 密码123456;</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">user</span> <span class="string">'itcast'</span>@<span class="string">'localhost'</span> identified <span class="keyword">by</span> <span class="string">'123456'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 创建用户heima, 可以在任意主机访问该数据库, 密码123456;</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">user</span> <span class="string">'heima'</span>@<span class="string">'%'</span> identified <span class="keyword">by</span> <span class="string">'123456'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改用户heima的访问密码为1234;</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">user</span> <span class="string">'heima'</span>@<span class="string">'%'</span> identified <span class="keyword">with</span> mysql_native_password <span class="keyword">by</span> <span class="string">'1234'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除 itcast@localhost 用户</span></span><br><span class="line"><span class="keyword">drop</span> <span class="keyword">user</span> <span class="string">'itcast'</span>@<span class="string">'localhost'</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-6-2-权限控制"><a href="#1-6-2-权限控制" class="headerlink" title="1.6.2 权限控制"></a>1.6.2 权限控制</h4><p>查询权限: <code>SHOW GRANTS FOR '用户名'@'主机名' ;</code></p>
|
||
<p>授予权限: <code>GRANT 权限列表 ON 数据库名.表名 TO '用户名'@'主机名';</code></p>
|
||
<p>撤销权限: <code>REVOKE 权限列表 ON 数据库名.表名 FROM '用户名'@'主机名';</code></p>
|
||
<blockquote>
|
||
<p>注意事项:<br>• 多个权限之间,使用逗号分隔<br>• 授权时, 数据库名和表名可以使用 * 进行通配,代表所有</p>
|
||
</blockquote>
|
||
<p><img src="/pictures/image-20231001174406029.png" alt="image-20231001174406029"></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 权限控制</span></span><br><span class="line"><span class="comment">-- 查询权限(查询heima用户的所有权限)</span></span><br><span class="line"><span class="keyword">show</span> grants <span class="keyword">for</span> <span class="string">'heima'</span>@<span class="string">'%'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 授予权限(授予heima用户对数据库itcast的所有权限)</span></span><br><span class="line"><span class="keyword">grant</span> <span class="keyword">all</span> <span class="keyword">on</span> itcast.<span class="operator">*</span> <span class="keyword">to</span> <span class="string">'heima'</span>@<span class="string">'%'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 授予用户所有数据库所有表的所有权限(相当于超级管理员)</span></span><br><span class="line"><span class="keyword">grant</span> <span class="keyword">all</span> <span class="keyword">on</span> <span class="operator">*</span>.<span class="operator">*</span> <span class="keyword">to</span> <span class="string">'heima'</span>@<span class="string">'%'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 撤销权限(撤销heima用户在itcast数据库上的所有权限)</span></span><br><span class="line"><span class="keyword">revoke</span> <span class="keyword">all</span> <span class="keyword">on</span> itcast.<span class="operator">*</span> <span class="keyword">from</span> <span class="string">'heima'</span>@<span class="string">'%'</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>总结</strong></p>
|
||
<p> <img src="/pictures/image-20231001213059144.png" alt="image-20231001213059144"></p>
|
||
<p><strong>全部的SQL</strong></p>
|
||
<figure class="highlight sql"><table><tr><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="keyword">show</span> databases;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询当前的数据库</span></span><br><span class="line"><span class="keyword">select</span> database();</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 创建数据库</span></span><br><span class="line"><span class="keyword">create</span> database if <span class="keyword">not</span> <span class="keyword">exists</span> itcast;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除数据库</span></span><br><span class="line"><span class="keyword">drop</span> database if <span class="keyword">exists</span> itcast;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 使用数据库</span></span><br><span class="line">use itcast;</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><br><span class="line"><span class="comment">-- 创建用户表</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> tb_user</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> comment <span class="string">'编号'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> age <span class="type">int</span> comment <span class="string">'年龄'</span>,</span><br><span class="line"> gender <span class="type">varchar</span>(<span class="number">1</span>) comment <span class="string">'性别'</span></span><br><span class="line">) comment <span class="string">'用户表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 显示创建表的结构</span></span><br><span class="line"><span class="keyword">desc</span> tb_user;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 显示创建表的语句</span></span><br><span class="line"><span class="keyword">show</span> <span class="keyword">create</span> <span class="keyword">table</span> tb_user;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除表</span></span><br><span class="line"><span class="keyword">drop</span> <span class="keyword">table</span> emp;</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="keyword">create</span> <span class="keyword">table</span> emp</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> comment <span class="string">'编号'</span>,</span><br><span class="line"> workno <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'工号'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> gender <span class="type">char</span>(<span class="number">1</span>) comment <span class="string">'性别'</span>,</span><br><span class="line"> age tinyint unsigned comment <span class="string">'年龄'</span>,</span><br><span class="line"> idcard <span class="type">char</span>(<span class="number">18</span>) comment <span class="string">'身份证号'</span>,</span><br><span class="line"> entrydate <span class="type">date</span> comment <span class="string">'入职时间'</span></span><br><span class="line">) comment <span class="string">'员工表'</span>;</span><br><span class="line"><span class="comment">-- 查看表结构</span></span><br><span class="line"><span class="keyword">desc</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改表结构(向emp表中添加昵称字段)</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp</span><br><span class="line"> <span class="keyword">add</span> nickname <span class="type">varchar</span>(<span class="number">20</span>) comment <span class="string">'昵称'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改相应字段的数据类型(把age的数据类型从int改回tinyint)</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp</span><br><span class="line"> modify age tinyint;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改字段名和字段的类型(把nickname字段改为username,并修改数据类型)</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp</span><br><span class="line"> change nickname username <span class="type">varchar</span>(<span class="number">30</span>) comment <span class="string">'用户名'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除字段(删除username字段)</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp</span><br><span class="line"> <span class="keyword">drop</span> username;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改表名(将表名字从emo修改为employee)</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp rename <span class="keyword">to</span> employee;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除表</span></span><br><span class="line"><span class="keyword">drop</span> <span class="keyword">table</span> if <span class="keyword">exists</span> employee;</span><br><span class="line"><span class="comment">-- 删除指定表,并重新创建该表(相当于删除表中的全部数据)</span></span><br><span class="line"><span class="keyword">truncate</span> <span class="keyword">table</span> employee;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">-- ------------------------------------------------DML-增删改操作---------------------------------------------------</span></span><br><span class="line"><span class="comment">-- 添加数据</span></span><br><span class="line"><span class="keyword">select</span> database();</span><br><span class="line"><span class="keyword">show</span> tables;</span><br><span class="line"><span class="comment">-- 该指定的字段添加数据</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> employee(id, workno, name, gender, age, idcard, entrydate) <span class="keyword">value</span> (<span class="number">1</span>, <span class="string">'1'</span>, <span class="string">'小华'</span>, <span class="string">'男'</span>, <span class="number">20</span>, <span class="string">'123456789123456789'</span>, <span class="string">'2001-01-01'</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> employee;</span><br><span class="line"><span class="comment">-- 给全部的字段添加数据</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> employee <span class="keyword">value</span> (<span class="number">2</span>, <span class="string">'2'</span>, <span class="string">'小刚'</span>, <span class="string">'男'</span>, <span class="number">23</span>, <span class="string">'123456784124456789'</span>, <span class="string">'2008-01-01'</span>);</span><br><span class="line"><span class="comment">-- 批量添加数据</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> employee</span><br><span class="line"><span class="keyword">values</span> (<span class="number">3</span>, <span class="string">'3'</span>, <span class="string">'小李'</span>, <span class="string">'男'</span>, <span class="number">23</span>, <span class="string">'123456784124456789'</span>, <span class="string">'2008-01-01'</span>),</span><br><span class="line"> (<span class="number">4</span>, <span class="string">'4'</span>, <span class="string">'小黄'</span>, <span class="string">'男'</span>, <span class="number">23</span>, <span class="string">'123456784124456789'</span>, <span class="string">'2008-01-01'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改数据(不带条件修改所有)</span></span><br><span class="line"><span class="keyword">update</span> employee</span><br><span class="line"><span class="keyword">set</span> name <span class="operator">=</span> <span class="string">'张三'</span></span><br><span class="line"><span class="keyword">where</span> id <span class="operator">=</span> <span class="number">1</span>;</span><br><span class="line"><span class="keyword">update</span> employee</span><br><span class="line"><span class="keyword">set</span> name <span class="operator">=</span> <span class="string">'李四'</span>,</span><br><span class="line"> gender<span class="operator">=</span> <span class="string">'女'</span></span><br><span class="line"><span class="keyword">where</span> id <span class="operator">=</span> <span class="number">1</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除数据(删除id为4的数据,不带添加删除所有)</span></span><br><span class="line"><span class="keyword">delete</span></span><br><span class="line"><span class="keyword">from</span> employee</span><br><span class="line"><span class="keyword">where</span> id <span class="operator">=</span> <span class="number">4</span>;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">-- --------------------------------------------------------DQL数据查询语言--------------------------------------------------</span></span><br><span class="line"><span class="comment">-- 数据准备</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> emp</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> comment <span class="string">'编号'</span>,</span><br><span class="line"> workno <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'工号'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> gender <span class="type">char</span>(<span class="number">1</span>) comment <span class="string">'性别'</span>,</span><br><span class="line"> age tinyint unsigned comment <span class="string">'年龄'</span>,</span><br><span class="line"> idcard <span class="type">char</span>(<span class="number">18</span>) comment <span class="string">'身份证号'</span>,</span><br><span class="line"> workaddress <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'工作地址'</span>,</span><br><span class="line"> entrydate <span class="type">date</span> comment <span class="string">'入职时间'</span></span><br><span class="line">) comment <span class="string">'员工表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 插入数据</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> emp(id, workno, name, gender, age, idcard, workaddress, entrydate)</span><br><span class="line"><span class="keyword">values</span> (<span class="number">1</span>, <span class="string">'1'</span>, <span class="string">'柳岩'</span>, <span class="string">'女'</span>, <span class="number">20</span>, <span class="string">'12345678912345678'</span>, <span class="string">'北京'</span>, <span class="string">'2001-01-01'</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'2'</span>, <span class="string">'张无忌'</span>, <span class="string">'男'</span>, <span class="number">18</span>, <span class="string">'123456789012345670'</span>, <span class="string">'北京'</span>, <span class="string">'2005-09-01'</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'3'</span>, <span class="string">'韦一笑'</span>, <span class="string">'男'</span>, <span class="number">38</span>, <span class="string">'12345678972345670'</span>, <span class="string">'上海'</span>, <span class="string">'2005-08-01'</span>),</span><br><span class="line"> (<span class="number">4</span>, <span class="string">'4'</span>, <span class="string">'赵敏'</span>, <span class="string">'女'</span>, <span class="number">18</span>, <span class="string">'12345675712345670'</span>, <span class="string">'北京'</span>, <span class="string">'2009-12-01'</span>),</span><br><span class="line"> (<span class="number">5</span>, <span class="string">'5'</span>, <span class="string">'小昭'</span>, <span class="string">'女'</span>, <span class="number">16</span>, <span class="string">'123456769012345678'</span>, <span class="string">'上海'</span>, <span class="string">'2007-07-01'</span>),</span><br><span class="line"> (<span class="number">6</span>, <span class="string">'6'</span>, <span class="string">'杨逍'</span>, <span class="string">'男'</span>, <span class="number">28</span>, <span class="string">'1234567893123456X'</span>, <span class="string">'北京'</span>, <span class="string">'2006-01-01'</span>),</span><br><span class="line"> (<span class="number">7</span>, <span class="string">'7'</span>, <span class="string">'范瑶'</span>, <span class="string">'男'</span>, <span class="number">40</span>, <span class="string">'123456789212345670'</span>, <span class="string">'北京'</span>, <span class="string">'2005-05-01'</span>),</span><br><span class="line"> (<span class="number">8</span>, <span class="string">'8'</span>, <span class="string">'黛绮丝'</span>, <span class="string">'女'</span>, <span class="number">38</span>, <span class="string">'123456157123645670'</span>, <span class="string">'天津'</span>, <span class="string">'2015-05-01'</span>),</span><br><span class="line"> (<span class="number">9</span>, <span class="string">'9'</span>, <span class="string">'范凉凉'</span>, <span class="string">'女'</span>, <span class="number">45</span>, <span class="string">'123156789012345678'</span>, <span class="string">'北京'</span>, <span class="string">'2010-04-01'</span>),</span><br><span class="line"> (<span class="number">10</span>, <span class="string">'10'</span>, <span class="string">'陈友谅'</span>, <span class="string">'男'</span>, <span class="number">53</span>, <span class="string">'123456789012345670'</span>, <span class="string">'上海'</span>, <span class="string">'2011-01-01'</span>),</span><br><span class="line"> (<span class="number">11</span>, <span class="string">'11'</span>, <span class="string">'张士诚'</span>, <span class="string">'男'</span>, <span class="number">55</span>, <span class="string">'12356789712345670'</span>, <span class="string">'江苏'</span>, <span class="string">'2015-05-01'</span>),</span><br><span class="line"> (<span class="number">12</span>, <span class="string">'12'</span>, <span class="string">'常遇春'</span>, <span class="string">'男'</span>, <span class="number">32</span>, <span class="string">'123446757152345670'</span>, <span class="string">'北京'</span>, <span class="string">'2004-02-01'</span>),</span><br><span class="line"> (<span class="number">13</span>, <span class="string">'13'</span>, <span class="string">'张三丰'</span>, <span class="string">'男'</span>, <span class="number">88</span>, <span class="string">'123656789012345678'</span>, <span class="string">'江苏'</span>, <span class="string">'2020-11-01'</span>),</span><br><span class="line"> (<span class="number">14</span>, <span class="string">'14'</span>, <span class="string">'灭绝'</span>, <span class="string">'女'</span>, <span class="number">65</span>, <span class="string">'123456719012345670'</span>, <span class="string">'西安'</span>, <span class="string">'2019-05-01'</span>),</span><br><span class="line"> (<span class="number">15</span>, <span class="string">'15'</span>, <span class="string">'胡青年'</span>, <span class="string">'男'</span>, <span class="number">70</span>, <span class="string">'12345674971234567X'</span>, <span class="string">'西安'</span>, <span class="string">'2018-04-01'</span>),</span><br><span class="line"> (<span class="number">16</span>, <span class="string">'16'</span>, <span class="string">'周芷若'</span>, <span class="string">'女'</span>, <span class="number">18</span>, <span class="keyword">null</span>, <span class="string">'北京'</span>, <span class="string">'2012-06-01'</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="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询指定字段 name workno age 返回</span></span><br><span class="line"><span class="keyword">select</span> name, workno, age</span><br><span class="line"><span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询所有字段返回</span></span><br><span class="line"><span class="keyword">select</span> id,</span><br><span class="line"> workno,</span><br><span class="line"> name,</span><br><span class="line"> gender,</span><br><span class="line"> age,</span><br><span class="line"> idcard,</span><br><span class="line"> workaddress,</span><br><span class="line"> entrydate</span><br><span class="line"><span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- distinct去重关键字</span></span><br><span class="line"><span class="comment">-- 查询所有员工的工作地址(不要重复的地址)</span></span><br><span class="line"><span class="keyword">select</span> <span class="keyword">distinct</span> workaddress <span class="string">'工作地址'</span></span><br><span class="line"><span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></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">-- 查询年龄等于 88 的员工</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator">=</span> <span class="number">88</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄小于20的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator"><</span> <span class="number">20</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄小于等于20的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator"><=</span> <span class="number">20</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询没有身份证号的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> idcard <span class="keyword">is</span> <span class="keyword">null</span> ;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄不等于88的员工信息(<>也表示不等于)</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator">!=</span> <span class="number">88</span>;</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator"><></span> <span class="number">88</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄在15~20(包含)之间的员工信息(三种实现方式)</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator">>=</span> <span class="number">15</span> <span class="operator">&&</span> age <span class="operator"><=</span> <span class="number">20</span>;</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator">>=</span> <span class="number">15</span> <span class="keyword">and</span> age <span class="operator"><=</span> <span class="number">20</span>;</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="keyword">between</span> <span class="number">15</span> <span class="keyword">and</span> <span class="number">20</span>; #包含了<span class="number">15</span>和<span class="number">20</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询性别为女 且年龄小于25岁的员工</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> gender <span class="operator">=</span> <span class="string">'女'</span> <span class="keyword">and</span> age <span class="operator"><</span> <span class="number">25</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄等于18 或 20 或 48 的员工</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator">=</span> <span class="number">18</span> <span class="keyword">or</span> age <span class="operator">=</span> <span class="number">20</span> <span class="keyword">or</span> age <span class="operator">=</span> <span class="number">48</span>;</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="keyword">in</span> (<span class="number">18</span>,<span class="number">20</span>,<span class="number">48</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询姓名为两个字的员工(模糊匹配(_匹配单个字符, %匹配任意个字符))</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> name <span class="keyword">like</span> <span class="string">'__'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询身份证号最后一位是X的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> idcard <span class="keyword">like</span> <span class="string">'%X'</span>;</span><br><span class="line"></span><br><span class="line"></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="keyword">select</span> <span class="built_in">count</span>(<span class="operator">*</span>) <span class="keyword">from</span> emp;</span><br><span class="line"><span class="keyword">select</span> <span class="built_in">count</span>(idcard) <span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 统计该企业员工的平均年龄</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">avg</span>(age) <span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 统计该企业员工的最大年龄</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">max</span>(age) <span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 统计该企业员工的最小年龄</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">min</span>(age) <span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 统计西安地区员工的年龄之和</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">sum</span>(age) <span class="keyword">from</span> emp <span class="keyword">where</span> workaddress <span class="operator">=</span> <span class="string">'西安'</span>;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></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="keyword">select</span> gender, <span class="built_in">count</span>(<span class="operator">*</span>) <span class="keyword">from</span> emp <span class="keyword">group</span> <span class="keyword">by</span> gender;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 根据性别进行分组,统计男性员工和女性员工的平均年龄</span></span><br><span class="line"><span class="keyword">select</span> gender, <span class="built_in">avg</span>(age) <span class="keyword">from</span> emp <span class="keyword">group</span> <span class="keyword">by</span> gender;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄小于45岁的员工,并根据工作地址分组,获取员工数量大于等于3的工作地址(可以使用别名也可以不使用别名)</span></span><br><span class="line"><span class="keyword">select</span> workaddress,<span class="built_in">count</span>(<span class="operator">*</span>) address_count <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator"><</span> <span class="number">45</span> <span class="keyword">group</span> <span class="keyword">by</span> workaddress <span class="keyword">having</span> address_count <span class="operator">>=</span> <span class="number">3</span>;</span><br><span class="line"></span><br><span class="line"></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">-- 根据年龄对公司的员工进行升序排序(asc可以省略)</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">order</span> <span class="keyword">by</span> age ;</span><br><span class="line"><span class="comment">-- 降序排序</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">order</span> <span class="keyword">by</span> age <span class="keyword">desc</span> ;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 根据员工的入职时间降序排序</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">order</span> <span class="keyword">by</span> entrydate <span class="keyword">desc</span> ;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 根据员工的年龄升序排序,年龄相同,再按照入职时间进行降序排序</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">order</span> <span class="keyword">by</span> age <span class="keyword">asc</span> ,entrydate <span class="keyword">desc</span> ;</span><br><span class="line"></span><br><span class="line"></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">-- 查询第一页的员工数据,每页显示10条记录</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp limit <span class="number">0</span>,<span class="number">10</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询第二页数据,每页展示十条数据(起始索引 = (查询页码 - 1)* 每页显示记录数)</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp limit <span class="number">10</span>,<span class="number">10</span>;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">-- DQL语句案例</span></span><br><span class="line"><span class="comment">-- 查询年龄在20,21,22,23岁的女性员工的信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> gender <span class="operator">=</span> <span class="string">'女'</span> <span class="keyword">and</span> age <span class="keyword">in</span> (<span class="number">20</span>,<span class="number">21</span>,<span class="number">22</span>,<span class="number">23</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询性别为男,并且年龄再20~40岁(含)以内的姓名为三个字的员工</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> gender <span class="operator">=</span> <span class="string">'男'</span> <span class="keyword">and</span> (age <span class="keyword">between</span> <span class="number">20</span> <span class="keyword">and</span> <span class="number">40</span>) <span class="keyword">and</span> name <span class="keyword">like</span> <span class="string">'___'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 统计员工表中,年龄小于60岁的,男性员工和女性员工的人数</span></span><br><span class="line"><span class="keyword">select</span> gender,<span class="built_in">count</span>(<span class="operator">*</span>) <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator"><</span> <span class="number">60</span> <span class="keyword">group</span> <span class="keyword">by</span> gender;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询所有年龄小于等于35岁员工的姓名和年龄,并对查询结果按年龄升序排序,如果年龄相同按照入职时间降序排序</span></span><br><span class="line"><span class="keyword">select</span> name,age <span class="keyword">from</span> emp <span class="keyword">where</span> age <span class="operator"><=</span> <span class="number">35</span> <span class="keyword">order</span> <span class="keyword">by</span> age <span class="keyword">asc</span> ,entrydate <span class="keyword">desc</span> ;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询性别为男,且年龄在20·40岁(含)以内的前五个员工信息,并对查询结果按年龄升序排序,如果年龄相同按照入职时间升序排序</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> gender <span class="operator">=</span> <span class="string">'男'</span> <span class="keyword">and</span> age <span class="keyword">between</span> <span class="number">20</span> <span class="keyword">and</span> <span class="number">40</span> <span class="keyword">order</span> <span class="keyword">by</span> age,entrydate limit <span class="number">5</span>;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">-- ---------------------------------------------------DCL--------------------------------------------------</span></span><br><span class="line"><span class="comment">-- 用户管理</span></span><br><span class="line"><span class="comment">-- mysql数据库</span></span><br><span class="line">use mysql;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询所有的用户</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> mysql.user;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 创建用户itcast, 只能够在当前主机localhost访问, 密码123456;</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">user</span> <span class="string">'itcast'</span>@<span class="string">'localhost'</span> identified <span class="keyword">by</span> <span class="string">'123456'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 创建用户heima, 可以在任意主机访问该数据库, 密码123456;</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">user</span> <span class="string">'heima'</span>@<span class="string">'%'</span> identified <span class="keyword">by</span> <span class="string">'123456'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改用户heima的访问密码为1234;</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">user</span> <span class="string">'heima'</span>@<span class="string">'%'</span> identified <span class="keyword">with</span> mysql_native_password <span class="keyword">by</span> <span class="string">'1234'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除 itcast@localhost 用户</span></span><br><span class="line"><span class="keyword">drop</span> <span class="keyword">user</span> <span class="string">'itcast'</span>@<span class="string">'localhost'</span>;</span><br><span class="line"></span><br><span class="line"></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">-- 查询权限(查询heima用户的所有权限)</span></span><br><span class="line"><span class="keyword">show</span> grants <span class="keyword">for</span> <span class="string">'heima'</span>@<span class="string">'%'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 授予权限(授予heima用户对数据库itcast的所有权限)</span></span><br><span class="line"><span class="keyword">grant</span> <span class="keyword">all</span> <span class="keyword">on</span> itcast.<span class="operator">*</span> <span class="keyword">to</span> <span class="string">'heima'</span>@<span class="string">'%'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 授予用户所有数据库所有表的所有权限</span></span><br><span class="line"><span class="keyword">grant</span> <span class="keyword">all</span> <span class="keyword">on</span> <span class="operator">*</span>.<span class="operator">*</span> <span class="keyword">to</span> <span class="string">'heima'</span>@<span class="string">'%'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 撤销权限(撤销heima用户在itcast数据库上的所有权限)</span></span><br><span class="line"><span class="keyword">revoke</span> <span class="keyword">all</span> <span class="keyword">on</span> itcast.<span class="operator">*</span> <span class="keyword">from</span> <span class="string">'heima'</span>@<span class="string">'%'</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<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><img src="/pictures/image-20231001213558221.png" alt="image-20231001213558221"></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- concat函数(字符串拼接)</span></span><br><span class="line"><span class="keyword">select</span> concat(<span class="string">'hello '</span>,<span class="string">'word'</span>); # hello word</span><br><span class="line"></span><br><span class="line"><span class="comment">-- lower(全部转化成小写)</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">lower</span>(<span class="string">'Hello'</span>); # hello</span><br><span class="line"></span><br><span class="line"><span class="comment">-- upper(全部转化成大写)</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">upper</span>(<span class="string">'Hello'</span>); # HELLO</span><br><span class="line"></span><br><span class="line"><span class="comment">-- lpad(左侧填充)</span></span><br><span class="line"><span class="keyword">select</span> lpad(<span class="string">'01'</span>,<span class="number">5</span>,<span class="string">'-'</span>); # <span class="comment">---01</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- rpad(右侧填充)</span></span><br><span class="line"><span class="keyword">select</span> rpad(<span class="string">'01'</span>,<span class="number">5</span>,<span class="string">'-'</span>) ;# <span class="number">01</span><span class="comment">---</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- trim 去除头部和尾部的空格</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">trim</span>(<span class="string">' Hello Mysql '</span>);# Hello Mysql</span><br><span class="line"></span><br><span class="line"><span class="comment">-- substring 字符串截取</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">substring</span>(<span class="string">'Hello Mysql'</span>,<span class="number">1</span>,<span class="number">5</span>);# Hello</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>案例</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 由于业务需求变更,企业员工的工号,统一为5位数,目前不足5位数的全部在前面补0 比如:1号员工的工号应该为00001</span></span><br><span class="line"><span class="keyword">update</span> emp <span class="keyword">set</span> workno <span class="operator">=</span> lpad(workno,<span class="number">5</span>,<span class="string">'0'</span>);</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><img src="/pictures/image-20231001215546554.png" alt="image-20231001215546554"></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 数值函数</span></span><br><span class="line"><span class="comment">-- ceil 向上取整</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">ceil</span>(<span class="number">1.5</span>); # <span class="number">2</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- floor 向下取整</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">floor</span>(<span class="number">1.1</span>); # <span class="number">1</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- mod 求模运算</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">mod</span>(<span class="number">7</span>,<span class="number">4</span>); # <span class="number">3</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- rand 随机数(0~1)</span></span><br><span class="line"><span class="keyword">select</span> rand();</span><br><span class="line"></span><br><span class="line"><span class="comment">-- round 四舍五入</span></span><br><span class="line"><span class="keyword">select</span> round(<span class="number">2.345</span>,<span class="number">2</span>); # <span class="number">2.35</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>案例</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 通过数据库函数生成一个的随机的六位验证码</span></span><br><span class="line"><span class="comment">-- 思路是通过rand()*100生成xxxxxx.xxx的小数,然后通过round四舍五入掉小数位,然后可能存在小于六位数的情况,我们</span></span><br><span class="line"><span class="comment">-- 通过lpd函数补齐六位</span></span><br><span class="line"><span class="keyword">select</span> lpad(round(rand()<span class="operator">*</span><span class="number">1000000</span>,<span class="number">0</span>),<span class="number">6</span>,<span class="string">'0'</span>);</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-3-日期函数"><a href="#2-3-日期函数" class="headerlink" title="2.3 日期函数"></a>2.3 日期函数</h3><p><img src="/pictures/image-20231002114046980.png" alt="image-20231002114046980"></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 日期函数</span></span><br><span class="line"><span class="comment">-- curdate:当前日期</span></span><br><span class="line"><span class="keyword">select</span> curdate();</span><br><span class="line"></span><br><span class="line"><span class="comment">-- curtime:当前时间</span></span><br><span class="line"><span class="keyword">select</span> curtime();</span><br><span class="line"></span><br><span class="line"><span class="comment">-- now:当前日期和时间</span></span><br><span class="line"><span class="keyword">select</span> now();</span><br><span class="line"></span><br><span class="line"><span class="comment">-- YEAR , MONTH , DAY:当前年、月、日</span></span><br><span class="line"><span class="keyword">select</span> <span class="keyword">year</span>(now());</span><br><span class="line"><span class="keyword">select</span> <span class="keyword">month</span>(now());</span><br><span class="line"><span class="keyword">select</span> <span class="keyword">day</span>(now());</span><br><span class="line"></span><br><span class="line"><span class="comment">-- date_add:增加指定的时间间隔</span></span><br><span class="line"><span class="keyword">select</span> date_add(now(),<span class="type">INTERVAL</span> <span class="number">70</span> <span class="keyword">DAY</span> ); # 当前的时间往后推<span class="number">70</span>天</span><br><span class="line"><span class="keyword">select</span> date_add(now(),<span class="type">INTERVAL</span> <span class="number">2</span> <span class="keyword">MONTH</span> ); #向后推<span class="number">2</span>个月</span><br><span class="line"></span><br><span class="line"><span class="comment">-- datediff:获取两个日期相差的天数</span></span><br><span class="line"><span class="keyword">select</span> datediff(<span class="string">'2021-12-01'</span>,<span class="string">'2021-10-01'</span>); # 查询两个时间之间的差值,第一个时间减去第二个时间</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>案例</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 查询所有员工的入职天数,并根据入职天数倒叙排序</span></span><br><span class="line"><span class="keyword">select</span> name,datediff(curdate(),entrydate) <span class="string">'entrydays'</span> <span class="keyword">from</span> emp <span class="keyword">order</span> <span class="keyword">by</span> entrydays <span class="keyword">desc</span> ;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-4-流程函数"><a href="#2-4-流程函数" class="headerlink" title="2.4 流程函数"></a>2.4 流程函数</h3><p><img src="/pictures/image-20231004124942068.png" alt="image-20231004124942068"></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 流程控制函数</span></span><br><span class="line"><span class="comment">-- if 相当java中的三元运算符</span></span><br><span class="line"><span class="keyword">select</span> if(<span class="literal">true</span>, <span class="string">'OK'</span>, <span class="string">'ERROR'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- ifnull 第一个字符串不为空就返回第一个,第一个为空就返回第二个</span></span><br><span class="line"><span class="keyword">select</span> ifnull(<span class="string">'OK'</span>, <span class="string">'DEFAULT'</span>);</span><br><span class="line"><span class="keyword">select</span> ifnull(<span class="keyword">null</span>, <span class="string">'DEFAULT'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- case when then else end</span></span><br><span class="line"><span class="comment">-- 需求: 查询emp表的员工姓名和工作地址 (北京/上海 ----> 一线城市 , 其他 ----> 二线城市)</span></span><br><span class="line"><span class="keyword">select</span> name,</span><br><span class="line"> (<span class="keyword">case</span> workaddress</span><br><span class="line"> <span class="keyword">when</span> <span class="string">'北京'</span> <span class="keyword">then</span> <span class="string">'一线城市'</span></span><br><span class="line"> <span class="keyword">when</span> <span class="string">'上海'</span> <span class="keyword">then</span> <span class="string">'一线城市'</span></span><br><span class="line"> <span class="keyword">else</span></span><br><span class="line"> <span class="string">'二线城市'</span> <span class="keyword">end</span>) <span class="keyword">as</span> <span class="string">'工作地址'</span></span><br><span class="line"><span class="keyword">from</span> emp;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>案例</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 案例:统计班级各个学员的成绩,展示规则如下:</span></span><br><span class="line"><span class="comment">-- >= 85 展示优秀</span></span><br><span class="line"><span class="comment">-- >= 60 展示及格</span></span><br><span class="line"><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="keyword">create</span> <span class="keyword">table</span> score</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> comment <span class="string">'ID'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">20</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> math <span class="type">int</span> comment <span class="string">'数学'</span>,</span><br><span class="line"> english <span class="type">int</span> comment <span class="string">'英语'</span>,</span><br><span class="line"> chinese <span class="type">int</span> comment <span class="string">'语文'</span></span><br><span class="line">) comment <span class="string">'学员成绩表'</span>;</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> score(id, name, math, english, chinese)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'Tom'</span>, <span class="number">67</span>, <span class="number">88</span>, <span class="number">95</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'Rose'</span>, <span class="number">23</span>, <span class="number">66</span>, <span class="number">90</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'Jack'</span>, <span class="number">56</span>, <span class="number">98</span>, <span class="number">76</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> score;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 案例sql实现</span></span><br><span class="line"><span class="keyword">select</span> id,</span><br><span class="line"> name,</span><br><span class="line"> (<span class="keyword">case</span> <span class="keyword">when</span> math <span class="operator">>=</span> <span class="number">85</span> <span class="keyword">then</span> <span class="string">'优秀'</span> <span class="keyword">when</span> math <span class="operator">>=</span> <span class="number">60</span> <span class="keyword">then</span> <span class="string">'及格'</span> <span class="keyword">else</span> <span class="string">'不及格'</span> <span class="keyword">end</span>)</span><br><span class="line"> <span class="string">'数学'</span>,</span><br><span class="line"> (<span class="keyword">case</span></span><br><span class="line"> <span class="keyword">when</span> english <span class="operator">>=</span> <span class="number">85</span> <span class="keyword">then</span> <span class="string">'优秀'</span></span><br><span class="line"> <span class="keyword">when</span> english <span class="operator">>=</span> <span class="number">60</span> <span class="keyword">then</span> <span class="string">'及格'</span></span><br><span class="line"> <span class="keyword">else</span> <span class="string">'不及格'</span></span><br><span class="line"> <span class="keyword">end</span>) <span class="string">'英语'</span>,</span><br><span class="line"> (<span class="keyword">case</span></span><br><span class="line"> <span class="keyword">when</span> chinese <span class="operator">>=</span> <span class="number">85</span> <span class="keyword">then</span> <span class="string">'优秀'</span></span><br><span class="line"> <span class="keyword">when</span> chinese <span class="operator">>=</span> <span class="number">60</span> <span class="keyword">then</span> <span class="string">'及格'</span></span><br><span class="line"> <span class="keyword">else</span> <span class="string">'不及格'</span></span><br><span class="line"> <span class="keyword">end</span>) <span class="string">'语文'</span></span><br><span class="line"><span class="keyword">from</span> score;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>函数相关的全部sql</strong></p>
|
||
<figure class="highlight sql"><table><tr><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">-- concat函数(字符串拼接)</span></span><br><span class="line"><span class="keyword">select</span> concat(<span class="string">'hello '</span>, <span class="string">'word'</span>);</span><br><span class="line"># hello word</span><br><span class="line"></span><br><span class="line"><span class="comment">-- lower(全部转化成小写)</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">lower</span>(<span class="string">'Hello'</span>);</span><br><span class="line"># hello</span><br><span class="line"></span><br><span class="line"><span class="comment">-- upper(全部转化成大写)</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">upper</span>(<span class="string">'Hello'</span>);</span><br><span class="line"># HELLO</span><br><span class="line"></span><br><span class="line"><span class="comment">-- lpad(左侧填充)</span></span><br><span class="line"><span class="keyword">select</span> lpad(<span class="string">'01'</span>, <span class="number">5</span>, <span class="string">'-'</span>);</span><br><span class="line"># <span class="comment">---01</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- rpad(右侧填充)</span></span><br><span class="line"><span class="keyword">select</span> rpad(<span class="string">'01'</span>, <span class="number">5</span>, <span class="string">'-'</span>);</span><br><span class="line"># <span class="number">01</span><span class="comment">---</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- trim 去除头部和尾部的空格</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">trim</span>(<span class="string">' Hello Mysql '</span>);</span><br><span class="line"># Hello Mysql</span><br><span class="line"></span><br><span class="line"><span class="comment">-- substring 字符串截取</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">substring</span>(<span class="string">'Hello Mysql'</span>, <span class="number">1</span>, <span class="number">5</span>);</span><br><span class="line"># Hello</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 由于业务需求变更,企业员工的工号,统一为5位数,目前不足5位数的全部在前面补0 比如:1号员工的工号应该为00001</span></span><br><span class="line"><span class="keyword">update</span> emp</span><br><span class="line"><span class="keyword">set</span> workno <span class="operator">=</span> lpad(workno, <span class="number">5</span>, <span class="string">'0'</span>);</span><br><span class="line"></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">-- ceil 向上取整</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">ceil</span>(<span class="number">1.5</span>);</span><br><span class="line"># <span class="number">2</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- floor 向下取整</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">floor</span>(<span class="number">1.1</span>);</span><br><span class="line"># <span class="number">1</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- mod 求模运算</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">mod</span>(<span class="number">7</span>, <span class="number">4</span>);</span><br><span class="line"># <span class="number">3</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- rand 随机数(0~1)</span></span><br><span class="line"><span class="keyword">select</span> rand();</span><br><span class="line"></span><br><span class="line"><span class="comment">-- round 四舍五入</span></span><br><span class="line"><span class="keyword">select</span> round(<span class="number">2.345</span>, <span class="number">2</span>);</span><br><span class="line"># <span class="number">2.35</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- 通过数据库函数生成一个的随机的六位验证码</span></span><br><span class="line"><span class="keyword">select</span> lpad(round(rand() <span class="operator">*</span> <span class="number">1000000</span>, <span class="number">0</span>), <span class="number">6</span>, <span class="string">'0'</span>);</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">-- curdate:当前日期</span></span><br><span class="line"><span class="keyword">select</span> curdate();</span><br><span class="line"></span><br><span class="line"><span class="comment">-- curtime:当前时间</span></span><br><span class="line"><span class="keyword">select</span> curtime();</span><br><span class="line"></span><br><span class="line"><span class="comment">-- now:当前日期和时间</span></span><br><span class="line"><span class="keyword">select</span> now();</span><br><span class="line"></span><br><span class="line"><span class="comment">-- YEAR , MONTH , DAY:当前年、月、日</span></span><br><span class="line"><span class="keyword">select</span> <span class="keyword">year</span>(now());</span><br><span class="line"><span class="keyword">select</span> <span class="keyword">month</span>(now());</span><br><span class="line"><span class="keyword">select</span> <span class="keyword">day</span>(now());</span><br><span class="line"></span><br><span class="line"><span class="comment">-- date_add:增加指定的时间间隔</span></span><br><span class="line"><span class="keyword">select</span> date_add(now(), <span class="type">INTERVAL</span> <span class="number">70</span> <span class="keyword">DAY</span>); # 当前的时间往后推<span class="number">70</span>天</span><br><span class="line"><span class="keyword">select</span> date_add(now(), <span class="type">INTERVAL</span> <span class="number">2</span> <span class="keyword">MONTH</span>);</span><br><span class="line">#向后推<span class="number">2</span>个月</span><br><span class="line"></span><br><span class="line"><span class="comment">-- datediff:获取两个日期相差的天数</span></span><br><span class="line"><span class="keyword">select</span> datediff(<span class="string">'2021-12-01'</span>, <span class="string">'2021-10-01'</span>);</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">select</span> name, datediff(curdate(), entrydate) <span class="string">'entrydays'</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">order</span> <span class="keyword">by</span> entrydays <span class="keyword">desc</span>;</span><br><span class="line"></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">-- if 相当java中的三元运算符</span></span><br><span class="line"><span class="keyword">select</span> if(<span class="literal">true</span>, <span class="string">'OK'</span>, <span class="string">'ERROR'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- ifnull 第一个字符串不为空就返回第一个,第一个为空就返回第二个</span></span><br><span class="line"><span class="keyword">select</span> ifnull(<span class="string">'OK'</span>, <span class="string">'DEFAULT'</span>);</span><br><span class="line"><span class="keyword">select</span> ifnull(<span class="keyword">null</span>, <span class="string">'DEFAULT'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- case when then else end</span></span><br><span class="line"><span class="comment">-- 需求: 查询emp表的员工姓名和工作地址 (北京/上海 ----> 一线城市 , 其他 ----> 二线城市)</span></span><br><span class="line"><span class="keyword">select</span> name,</span><br><span class="line"> (<span class="keyword">case</span> workaddress</span><br><span class="line"> <span class="keyword">when</span> <span class="string">'北京'</span> <span class="keyword">then</span> <span class="string">'一线城市'</span></span><br><span class="line"> <span class="keyword">when</span> <span class="string">'上海'</span> <span class="keyword">then</span> <span class="string">'一线城市'</span></span><br><span class="line"> <span class="keyword">else</span></span><br><span class="line"> <span class="string">'二线城市'</span> <span class="keyword">end</span>) <span class="keyword">as</span> <span class="string">'工作地址'</span></span><br><span class="line"><span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 案例:统计班级各个学员的成绩,展示规则如下:</span></span><br><span class="line"><span class="comment">-- >= 85 展示优秀</span></span><br><span class="line"><span class="comment">-- >= 60 展示及格</span></span><br><span class="line"><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="keyword">create</span> <span class="keyword">table</span> score</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> comment <span class="string">'ID'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">20</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> math <span class="type">int</span> comment <span class="string">'数学'</span>,</span><br><span class="line"> english <span class="type">int</span> comment <span class="string">'英语'</span>,</span><br><span class="line"> chinese <span class="type">int</span> comment <span class="string">'语文'</span></span><br><span class="line">) comment <span class="string">'学员成绩表'</span>;</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> score(id, name, math, english, chinese)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'Tom'</span>, <span class="number">67</span>, <span class="number">88</span>, <span class="number">95</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'Rose'</span>, <span class="number">23</span>, <span class="number">66</span>, <span class="number">90</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'Jack'</span>, <span class="number">56</span>, <span class="number">98</span>, <span class="number">76</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> score;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 案例sql实现</span></span><br><span class="line"><span class="keyword">select</span> id,</span><br><span class="line"> name,</span><br><span class="line"> (<span class="keyword">case</span> <span class="keyword">when</span> math <span class="operator">>=</span> <span class="number">85</span> <span class="keyword">then</span> <span class="string">'优秀'</span> <span class="keyword">when</span> math <span class="operator">>=</span> <span class="number">60</span> <span class="keyword">then</span> <span class="string">'及格'</span> <span class="keyword">else</span> <span class="string">'不及格'</span> <span class="keyword">end</span>)</span><br><span class="line"> <span class="string">'数学'</span>,</span><br><span class="line"> (<span class="keyword">case</span></span><br><span class="line"> <span class="keyword">when</span> english <span class="operator">>=</span> <span class="number">85</span> <span class="keyword">then</span> <span class="string">'优秀'</span></span><br><span class="line"> <span class="keyword">when</span> english <span class="operator">>=</span> <span class="number">60</span> <span class="keyword">then</span> <span class="string">'及格'</span></span><br><span class="line"> <span class="keyword">else</span> <span class="string">'不及格'</span></span><br><span class="line"> <span class="keyword">end</span>) <span class="string">'英语'</span>,</span><br><span class="line"> (<span class="keyword">case</span></span><br><span class="line"> <span class="keyword">when</span> chinese <span class="operator">>=</span> <span class="number">85</span> <span class="keyword">then</span> <span class="string">'优秀'</span></span><br><span class="line"> <span class="keyword">when</span> chinese <span class="operator">>=</span> <span class="number">60</span> <span class="keyword">then</span> <span class="string">'及格'</span></span><br><span class="line"> <span class="keyword">else</span> <span class="string">'不及格'</span></span><br><span class="line"> <span class="keyword">end</span>) <span class="string">'语文'</span></span><br><span class="line"><span class="keyword">from</span> score;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="3-约束"><a href="#3-约束" class="headerlink" title="3.约束"></a>3.约束</h2><h3 id="3-1-概述"><a href="#3-1-概述" class="headerlink" title="3.1 概述"></a>3.1 概述</h3><p><strong>概念</strong>:约束是作用于表中字段上的规则,用于限制存储在表中的数据。</p>
|
||
<p><strong>目的</strong>:保证数据库中数据的正确、有效性和完整性。</p>
|
||
<p><strong>分类</strong> :</p>
|
||
<p><img src="/pictures/image-20231004130826351.png" alt="image-20231004130826351"></p>
|
||
<h3 id="3-2-约束演示"><a href="#3-2-约束演示" class="headerlink" title="3.2 约束演示"></a>3.2 约束演示</h3><p><strong>案例需求: 根据需求,完成表结构的创建,需求如下:</strong></p>
|
||
<p><img src="/pictures/image-20231004160744943.png" alt="image-20231004160744943"></p>
|
||
<p>对应的建表语句为:</p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> tb_user(</span><br><span class="line"> id <span class="type">int</span> AUTO_INCREMENT <span class="keyword">PRIMARY</span> KEY COMMENT <span class="string">'ID唯一标识'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) <span class="keyword">NOT</span> <span class="keyword">NULL</span> <span class="keyword">UNIQUE</span> COMMENT <span class="string">'姓名'</span>,</span><br><span class="line"> age <span class="type">int</span> <span class="keyword">check</span> (age <span class="operator">></span> <span class="number">0</span> <span class="operator">&&</span> age <span class="operator"><=</span> <span class="number">120</span>) COMMENT <span class="string">'年龄'</span>,</span><br><span class="line"> status <span class="type">char</span>(<span class="number">1</span>) <span class="keyword">default</span> <span class="string">'1'</span> COMMENT <span class="string">'状态'</span>,</span><br><span class="line"> gender <span class="type">char</span>(<span class="number">1</span>) COMMENT <span class="string">'性别'</span></span><br><span class="line">);</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-3-外键约束"><a href="#3-3-外键约束" class="headerlink" title="3.3 外键约束"></a>3.3 外键约束</h3><h4 id="3-3-1-介绍"><a href="#3-3-1-介绍" class="headerlink" title="3.3.1 介绍"></a>3.3.1 介绍</h4><p><img src="/pictures/image-20231004162616775.png" alt="image-20231004162616775"></p>
|
||
<h4 id="3-3-2-语法"><a href="#3-3-2-语法" class="headerlink" title="3.3.2 语法"></a>3.3.2 语法</h4><p><strong>建立外键</strong>: <code>ALTER TABLE 表名 ADD CONSTRAINT 外键名称 FOREIGN KEY (外键字段名) REFERENCES 主表 (主表列名) ;</code></p>
|
||
<p><strong>删除外键</strong>: <code>ALTER TABLE 表名 DROP FOREIGN KEY 外键名称;</code></p>
|
||
<p><img src="/pictures/image-20231004163021062.png" alt="image-20231004163021062"></p>
|
||
<p>举例</p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 外键约束</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> dept</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'ID'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'部门名称'</span></span><br><span class="line">) comment <span class="string">'部门表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> dept (id, name)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'研发部'</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'市场部'</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'财务部'</span>),</span><br><span class="line"> (<span class="number">4</span>, <span class="string">'销售部'</span>),</span><br><span class="line"> (<span class="number">5</span>, <span class="string">'总经办'</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> employee</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'ID'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'姓名'</span>,</span><br><span class="line"> age <span class="type">int</span> comment <span class="string">'年龄'</span>,</span><br><span class="line"> job <span class="type">varchar</span>(<span class="number">20</span>) comment <span class="string">'职位'</span>,</span><br><span class="line"> salary <span class="type">int</span> comment <span class="string">'薪资'</span>,</span><br><span class="line"> entrydate <span class="type">date</span> comment <span class="string">'入职时间'</span>,</span><br><span class="line"> managerid <span class="type">int</span> comment <span class="string">'直属领导ID'</span>,</span><br><span class="line"> dept_id <span class="type">int</span> comment <span class="string">'部门ID'</span></span><br><span class="line">) comment <span class="string">'员工表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> employee (id, name, age, job, salary, entrydate, managerid, dept_id)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'金庸'</span>, <span class="number">66</span>, <span class="string">'总裁'</span>, <span class="number">20000</span>, <span class="string">'2000-01-01'</span>, <span class="keyword">null</span>, <span class="number">5</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'张无忌'</span>, <span class="number">20</span>, <span class="string">'项目经理'</span>, <span class="number">12500</span>, <span class="string">'2005-12-05'</span>, <span class="number">1</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'杨逍'</span>, <span class="number">33</span>, <span class="string">'开发'</span>, <span class="number">8400</span>, <span class="string">'2000-11-03'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">4</span>, <span class="string">'韦一笑'</span>, <span class="number">48</span>, <span class="string">'开发'</span>, <span class="number">11000</span>, <span class="string">'2002-02-05'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">5</span>, <span class="string">'常遇春'</span>, <span class="number">43</span>, <span class="string">'开发'</span>, <span class="number">10500</span>, <span class="string">'2004-09-07'</span>, <span class="number">3</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">6</span>, <span class="string">'小昭'</span>, <span class="number">19</span>, <span class="string">'程序员鼓励师'</span>, <span class="number">6600</span>, <span class="string">'2004-10-12'</span>, <span class="number">2</span>, <span class="number">1</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> dept;</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> employee;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 添加外键 员工表employee的部门id字段关联到部门表的id字段以建立外键约束</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> employee</span><br><span class="line"> <span class="keyword">add</span> <span class="keyword">constraint</span> fk_emp_dept <span class="keyword">foreign</span> key (dept_id) <span class="keyword">references</span> dept (id);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除外键</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> employee <span class="keyword">drop</span> <span class="keyword">foreign</span> key fk_emp_dept;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-3-3-删除-更新行为"><a href="#3-3-3-删除-更新行为" class="headerlink" title="3.3.3 删除/更新行为"></a>3.3.3 删除/更新行为</h4><p>详细介绍见PDF文件 <a href="https://qingling.icu/posts/50465.html">https://qingling.icu/posts/50465.html</a></p>
|
||
<p><strong>添加了外键之后,再删除父表数据时产生的约束行为,我们就称为删除/更新行为。具体的删除/更新行为有以下几种:</strong></p>
|
||
<p><img src="/pictures/image-20231004164211535.png" alt="image-20231004164211535"></p>
|
||
<p>具体语法为:</p>
|
||
<p><code>ALTER TABLE 表名 ADD CONSTRAINT 外键名称 FOREIGN KEY (外键字段) REFERENCES 主表名 (主表字段名) ON UPDATE CASCADE ON DELETE CASCADE;</code></p>
|
||
<p><strong>约束相关的sql</strong></p>
|
||
<figure class="highlight sql"><table><tr><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">-- name 不为空,并且唯一</span></span><br><span class="line"><span class="comment">-- age 大于零,并且小于等于120(8.0以上的数据库才支持)age int check (age > 0 && age <= 120) COMMENT '年龄'</span></span><br><span class="line"><span class="comment">-- status 如果没有指定该值,默认为1</span></span><br><span class="line"><span class="comment">-- gender 无约束</span></span><br><span class="line"><span class="keyword">drop</span> <span class="keyword">table</span> if <span class="keyword">exists</span> <span class="keyword">user</span>;</span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> <span class="keyword">user</span></span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> AUTO_INCREMENT <span class="keyword">PRIMARY</span> KEY COMMENT <span class="string">'ID唯一标识'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) <span class="keyword">NOT</span> <span class="keyword">NULL</span> <span class="keyword">UNIQUE</span> COMMENT <span class="string">'姓名'</span>,</span><br><span class="line"> age <span class="type">int</span> COMMENT <span class="string">'年龄'</span>,</span><br><span class="line"> status <span class="type">char</span>(<span class="number">1</span>) <span class="keyword">default</span> <span class="string">'1'</span> COMMENT <span class="string">'状态'</span>,</span><br><span class="line"> gender <span class="type">char</span>(<span class="number">1</span>) COMMENT <span class="string">'性别'</span></span><br><span class="line">);</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> <span class="keyword">user</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 插入数据</span></span><br><span class="line"><span class="comment">-- name的值不能重复,status的值没有填写的话,将使用的是默认的值</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> <span class="keyword">user</span>(name, age, status, gender)</span><br><span class="line"><span class="keyword">values</span> (<span class="string">'Tom1'</span>, <span class="number">19</span>, <span class="string">'1'</span>, <span class="string">'男'</span>),</span><br><span class="line"> (<span class="string">'Tom2'</span>, <span class="number">29</span>, <span class="string">'1'</span>, <span class="string">'男'</span>),</span><br><span class="line"> (<span class="string">'Tom3'</span>, <span class="number">14</span>, <span class="string">'1'</span>, <span class="string">'男'</span>);</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">create</span> <span class="keyword">table</span> dept</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'ID'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'部门名称'</span></span><br><span class="line">) comment <span class="string">'部门表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> dept (id, name)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'研发部'</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'市场部'</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'财务部'</span>),</span><br><span class="line"> (<span class="number">4</span>, <span class="string">'销售部'</span>),</span><br><span class="line"> (<span class="number">5</span>, <span class="string">'总经办'</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> employee</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'ID'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'姓名'</span>,</span><br><span class="line"> age <span class="type">int</span> comment <span class="string">'年龄'</span>,</span><br><span class="line"> job <span class="type">varchar</span>(<span class="number">20</span>) comment <span class="string">'职位'</span>,</span><br><span class="line"> salary <span class="type">int</span> comment <span class="string">'薪资'</span>,</span><br><span class="line"> entrydate <span class="type">date</span> comment <span class="string">'入职时间'</span>,</span><br><span class="line"> managerid <span class="type">int</span> comment <span class="string">'直属领导ID'</span>,</span><br><span class="line"> dept_id <span class="type">int</span> comment <span class="string">'部门ID'</span></span><br><span class="line">) comment <span class="string">'员工表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> employee (id, name, age, job, salary, entrydate, managerid, dept_id)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'金庸'</span>, <span class="number">66</span>, <span class="string">'总裁'</span>, <span class="number">20000</span>, <span class="string">'2000-01-01'</span>, <span class="keyword">null</span>, <span class="number">5</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'张无忌'</span>, <span class="number">20</span>, <span class="string">'项目经理'</span>, <span class="number">12500</span>, <span class="string">'2005-12-05'</span>, <span class="number">1</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'杨逍'</span>, <span class="number">33</span>, <span class="string">'开发'</span>, <span class="number">8400</span>, <span class="string">'2000-11-03'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">4</span>, <span class="string">'韦一笑'</span>, <span class="number">48</span>, <span class="string">'开发'</span>, <span class="number">11000</span>, <span class="string">'2002-02-05'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">5</span>, <span class="string">'常遇春'</span>, <span class="number">43</span>, <span class="string">'开发'</span>, <span class="number">10500</span>, <span class="string">'2004-09-07'</span>, <span class="number">3</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">6</span>, <span class="string">'小昭'</span>, <span class="number">19</span>, <span class="string">'程序员鼓励师'</span>, <span class="number">6600</span>, <span class="string">'2004-10-12'</span>, <span class="number">2</span>, <span class="number">1</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> dept;</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> employee;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 添加外键 员工表employee的部门id字段关联到部门表的id字段以建立外键约束</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> employee</span><br><span class="line"> <span class="keyword">add</span> <span class="keyword">constraint</span> fk_emp_dept <span class="keyword">foreign</span> key (dept_id) <span class="keyword">references</span> dept (id);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除外键</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> employee <span class="keyword">drop</span> <span class="keyword">foreign</span> key fk_emp_dept;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="4-多表查询"><a href="#4-多表查询" class="headerlink" title="4.多表查询"></a>4.多表查询</h2><h3 id="4-1-多表关系"><a href="#4-1-多表关系" class="headerlink" title="4.1 多表关系"></a>4.1 多表关系</h3><p><strong>一对多</strong></p>
|
||
<p><img src="/pictures/image-20231004165257714.png" alt="image-20231004165257714"></p>
|
||
<p><strong>多对多</strong></p>
|
||
<p><img src="/pictures/image-20231004165425089.png" alt="image-20231004165425089"></p>
|
||
<p><strong>一对一</strong></p>
|
||
<p><img src="/pictures/image-20231004170148951.png" alt="image-20231004170148951"></p>
|
||
<figure class="highlight sql"><table><tr><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="keyword">create</span> <span class="keyword">table</span> student</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment <span class="keyword">primary</span> key comment <span class="string">'主键ID'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> <span class="keyword">no</span> <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'学号'</span></span><br><span class="line">) comment <span class="string">'学生表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> student</span><br><span class="line"><span class="keyword">values</span> (<span class="keyword">null</span>, <span class="string">'黛绮丝'</span>, <span class="string">'2000100101'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'谢逊'</span>,</span><br><span class="line"> <span class="string">'2000100102'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'殷天正'</span>, <span class="string">'2000100103'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'韦一笑'</span>, <span class="string">'2000100104'</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> course</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment <span class="keyword">primary</span> key comment <span class="string">'主键ID'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'课程名称'</span></span><br><span class="line">) comment <span class="string">'课程表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> course</span><br><span class="line"><span class="keyword">values</span> (<span class="keyword">null</span>, <span class="string">'Java'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'PHP'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'MySQL'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'Hadoop'</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> student_course</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'主键'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> studentid <span class="type">int</span> <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'学生ID'</span>,</span><br><span class="line"> courseid <span class="type">int</span> <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'课程ID'</span>,</span><br><span class="line"> <span class="keyword">constraint</span> fk_courseid <span class="keyword">foreign</span> key (courseid) <span class="keyword">references</span> course (id),</span><br><span class="line"> <span class="keyword">constraint</span> fk_studentid <span class="keyword">foreign</span> key (studentid) <span class="keyword">references</span> student (id)</span><br><span class="line">) comment <span class="string">'学生课程中间表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> student_course</span><br><span class="line"><span class="keyword">values</span> (<span class="keyword">null</span>, <span class="number">1</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="number">1</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="number">1</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="number">2</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="number">2</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="number">3</span>, <span class="number">4</span>);</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">create</span> <span class="keyword">table</span> tb_user</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment <span class="keyword">primary</span> key comment <span class="string">'主键ID'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> age <span class="type">int</span> comment <span class="string">'年龄'</span>,</span><br><span class="line"> gender <span class="type">char</span>(<span class="number">1</span>) comment <span class="string">'1: 男 , 2: 女'</span>,</span><br><span class="line"> phone <span class="type">char</span>(<span class="number">11</span>) comment <span class="string">'手机号'</span></span><br><span class="line">) comment <span class="string">'用户基本信息表'</span>;</span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> tb_user_edu</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment <span class="keyword">primary</span> key comment <span class="string">'主键ID'</span>,</span><br><span class="line"> degree <span class="type">varchar</span>(<span class="number">20</span>) comment <span class="string">'学历'</span>,</span><br><span class="line"> major <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'专业'</span>,</span><br><span class="line"> primaryschool <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'小学'</span>,</span><br><span class="line"> middleschool <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'中学'</span>,</span><br><span class="line"> university <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'大学'</span>,</span><br><span class="line"> userid <span class="type">int</span> <span class="keyword">unique</span> comment <span class="string">'用户ID'</span>,</span><br><span class="line"> <span class="keyword">constraint</span> fk_userid <span class="keyword">foreign</span> key (userid) <span class="keyword">references</span> tb_user (id)</span><br><span class="line">) comment <span class="string">'用户教育信息表'</span>;</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> tb_user(id, name, age, gender, phone)</span><br><span class="line"><span class="keyword">values</span> (<span class="keyword">null</span>, <span class="string">'黄渤'</span>, <span class="number">45</span>, <span class="string">'1'</span>, <span class="string">'18800001111'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'冰冰'</span>, <span class="number">35</span>, <span class="string">'2'</span>, <span class="string">'18800002222'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'码云'</span>, <span class="number">55</span>, <span class="string">'1'</span>, <span class="string">'18800008888'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'李彦宏'</span>, <span class="number">50</span>, <span class="string">'1'</span>, <span class="string">'18800009999'</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> tb_user_edu(id, degree, major, primaryschool, middleschool,</span><br><span class="line"> university, userid)</span><br><span class="line"><span class="keyword">values</span> (<span class="keyword">null</span>, <span class="string">'本科'</span>, <span class="string">'舞蹈'</span>, <span class="string">'静安区第一小学'</span>, <span class="string">'静安区第一中学'</span>, <span class="string">'北京舞蹈学院'</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'硕士'</span>, <span class="string">'表演'</span>, <span class="string">'朝阳区第一小学'</span>, <span class="string">'朝阳区第一中学'</span>, <span class="string">'北京电影学院'</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'本科'</span>, <span class="string">'英语'</span>, <span class="string">'杭州市第一小学'</span>, <span class="string">'杭州市第一中学'</span>, <span class="string">'杭州师范大学'</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'本科'</span>, <span class="string">'应用数学'</span>, <span class="string">'阳泉第一小学'</span>, <span class="string">'阳泉区第一中学'</span>, <span class="string">'清华大学'</span>, <span class="number">4</span>);</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-2-多表查询概述"><a href="#4-2-多表查询概述" class="headerlink" title="4.2 多表查询概述"></a>4.2 多表查询概述</h3><h4 id="4-2-1-数据准备"><a href="#4-2-1-数据准备" class="headerlink" title="4.2.1 数据准备"></a>4.2.1 数据准备</h4><figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 数据准备</span></span><br><span class="line"><span class="comment">-- 创建dept表,并插入数据</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> dept</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'ID'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'部门名称'</span></span><br><span class="line">) comment <span class="string">'部门表'</span>;</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> dept (id, name)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'研发部'</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'市场部'</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'财务部'</span>),</span><br><span class="line"> (<span class="number">4</span>,</span><br><span class="line"> <span class="string">'销售部'</span>),</span><br><span class="line"> (<span class="number">5</span>, <span class="string">'总经办'</span>),</span><br><span class="line"> (<span class="number">6</span>, <span class="string">'人事部'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 创建emp表,并插入数据</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> emp</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'ID'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'姓名'</span>,</span><br><span class="line"> age <span class="type">int</span> comment <span class="string">'年龄'</span>,</span><br><span class="line"> job <span class="type">varchar</span>(<span class="number">20</span>) comment <span class="string">'职位'</span>,</span><br><span class="line"> salary <span class="type">int</span> comment <span class="string">'薪资'</span>,</span><br><span class="line"> entrydate <span class="type">date</span> comment <span class="string">'入职时间'</span>,</span><br><span class="line"> managerid <span class="type">int</span> comment <span class="string">'直属领导ID'</span>,</span><br><span class="line"> dept_id <span class="type">int</span> comment <span class="string">'部门ID'</span></span><br><span class="line">) comment <span class="string">'员工表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 添加外键</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp</span><br><span class="line"> <span class="keyword">add</span> <span class="keyword">constraint</span> fk_emp_dept_id <span class="keyword">foreign</span> key (dept_id) <span class="keyword">references</span></span><br><span class="line"> dept (id);</span><br><span class="line"></span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> emp (id, name, age, job, salary, entrydate, managerid, dept_id)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'金庸'</span>, <span class="number">66</span>, <span class="string">'总裁'</span>, <span class="number">20000</span>, <span class="string">'2000-01-01'</span>, <span class="keyword">null</span>, <span class="number">5</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'张无忌'</span>, <span class="number">20</span>, <span class="string">'项目经理'</span>, <span class="number">12500</span>, <span class="string">'2005-12-05'</span>, <span class="number">1</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'杨逍'</span>, <span class="number">33</span>, <span class="string">'开发'</span>, <span class="number">8400</span>, <span class="string">'2000-11-03'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">4</span>, <span class="string">'韦一笑'</span>, <span class="number">48</span>, <span class="string">'开发'</span>, <span class="number">11000</span>, <span class="string">'2002-02-05'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">5</span>, <span class="string">'常遇春'</span>, <span class="number">43</span>, <span class="string">'开发'</span>, <span class="number">10500</span>, <span class="string">'2004-09-07'</span>, <span class="number">3</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">6</span>, <span class="string">'小昭'</span>, <span class="number">19</span>, <span class="string">'程序员鼓励师'</span>, <span class="number">6600</span>, <span class="string">'2004-10-12'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">7</span>, <span class="string">'灭绝'</span>, <span class="number">60</span>, <span class="string">'财务总监'</span>, <span class="number">8500</span>, <span class="string">'2002-09-12'</span>, <span class="number">1</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="number">8</span>, <span class="string">'周芷若'</span>, <span class="number">19</span>, <span class="string">'会计'</span>, <span class="number">4800</span>, <span class="string">'2006-06-02'</span>, <span class="number">7</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="number">9</span>, <span class="string">'丁敏君'</span>, <span class="number">23</span>, <span class="string">'出纳'</span>, <span class="number">5250</span>, <span class="string">'2009-05-13'</span>, <span class="number">7</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="number">10</span>, <span class="string">'赵敏'</span>, <span class="number">20</span>, <span class="string">'市场部总监'</span>, <span class="number">12500</span>, <span class="string">'2004-10-12'</span>, <span class="number">1</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="number">11</span>, <span class="string">'鹿杖客'</span>, <span class="number">56</span>, <span class="string">'职员'</span>, <span class="number">3750</span>, <span class="string">'2006-10-03'</span>, <span class="number">10</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="number">12</span>, <span class="string">'鹤笔翁'</span>, <span class="number">19</span>, <span class="string">'职员'</span>, <span class="number">3750</span>, <span class="string">'2007-05-09'</span>, <span class="number">10</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="number">13</span>, <span class="string">'方东白'</span>, <span class="number">19</span>, <span class="string">'职员'</span>, <span class="number">5500</span>, <span class="string">'2009-02-12'</span>, <span class="number">10</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="number">14</span>, <span class="string">'张三丰'</span>, <span class="number">88</span>, <span class="string">'销售总监'</span>, <span class="number">14000</span>, <span class="string">'2004-10-12'</span>, <span class="number">1</span>, <span class="number">4</span>),</span><br><span class="line"> (<span class="number">15</span>, <span class="string">'俞莲舟'</span>, <span class="number">38</span>, <span class="string">'销售'</span>, <span class="number">4600</span>, <span class="string">'2004-10-12'</span>, <span class="number">14</span>, <span class="number">4</span>),</span><br><span class="line"> (<span class="number">16</span>, <span class="string">'宋远桥'</span>, <span class="number">40</span>, <span class="string">'销售'</span>, <span class="number">4600</span>, <span class="string">'2004-10-12'</span>, <span class="number">14</span>, <span class="number">4</span>),</span><br><span class="line"> (<span class="number">17</span>, <span class="string">'陈友谅'</span>, <span class="number">42</span>, <span class="keyword">null</span>, <span class="number">2000</span>, <span class="string">'2011-10-12'</span>, <span class="number">1</span>, <span class="keyword">null</span>);</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="4-2-2-概述"><a href="#4-2-2-概述" class="headerlink" title="4.2.2 概述"></a>4.2.2 概述</h4><p><img src="/pictures/image-20231004200243641.png" alt="image-20231004200243641"></p>
|
||
<h4 id="4-2-3-分类"><a href="#4-2-3-分类" class="headerlink" title="4.2.3 分类"></a>4.2.3 分类</h4><p><img src="/pictures/image-20231004200624090.png" alt="image-20231004200624090"></p>
|
||
<h3 id="4-3-内连接"><a href="#4-3-内连接" class="headerlink" title="4.3 内连接"></a>4.3 内连接</h3><p><img src="/pictures/image-20231004200731770.png" alt="image-20231004200731770"></p>
|
||
<figure class="highlight sql"><table><tr><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">-- 表结构: emp , dept</span></span><br><span class="line"><span class="comment">-- 连接条件: emp.dept_id = dept.id</span></span><br><span class="line"><span class="keyword">select</span> e.name, d.name <span class="keyword">from</span> emp e, dept d <span class="keyword">where</span> e.dept_id <span class="operator">=</span> d.id;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询每一个员工的姓名 , 及关联的部门的名称 (显式内连接实现) --- INNER JOIN ...ON ...</span></span><br><span class="line"><span class="comment">-- 表结构: emp , dept</span></span><br><span class="line"><span class="comment">-- 连接条件: emp.dept_id = dept.id</span></span><br><span class="line"><span class="keyword">select</span> e.name ,d.name <span class="keyword">from</span> emp e <span class="keyword">inner</span> <span class="keyword">join</span> dept d <span class="keyword">on</span> e.dept_id <span class="operator">=</span> d.id;</span><br></pre></td></tr></table></figure>
|
||
|
||
<blockquote>
|
||
<p>一旦为表起了别名,就不能再使用表名来指定对应的字段了,此时只能够使用别名来指定字段。</p>
|
||
</blockquote>
|
||
<h3 id="4-4-外连接"><a href="#4-4-外连接" class="headerlink" title="4.4 外连接"></a>4.4 外连接</h3><p><img src="/pictures/image-20231004201445881.png" alt="image-20231004201445881"></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 外连接</span></span><br><span class="line"><span class="comment">-- 查询emp表的所有数据, 和对应的部门信息</span></span><br><span class="line"><span class="comment">-- 由于需求中提到,要查询emp的所有数据,所以是不能内连接查询的,需要考虑使用外连接查询。</span></span><br><span class="line"><span class="comment">-- 表结构: emp, dept</span></span><br><span class="line"><span class="comment">-- 连接条件: emp.dept_id = dept.id</span></span><br><span class="line"><span class="keyword">select</span> e.name,d.name <span class="keyword">from</span> emp e <span class="keyword">left</span> <span class="keyword">join</span> dept d <span class="keyword">on</span> e.dept_id <span class="operator">=</span> d.id;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询dept表的所有数据, 和对应的员工信息(右外连接)</span></span><br><span class="line"><span class="comment">-- 由于需求中提到,要查询dept表的所有数据,所以是不能内连接查询的,需要考虑使用外连接查询</span></span><br><span class="line"><span class="comment">-- 表结构: emp, dept</span></span><br><span class="line"><span class="comment">-- 连接条件: emp.dept_id = dept.id</span></span><br><span class="line"><span class="keyword">select</span> e.name,d.name <span class="keyword">from</span> emp e <span class="keyword">right</span> <span class="keyword">join</span> dept d <span class="keyword">on</span> e.dept_id <span class="operator">=</span> d.id;</span><br></pre></td></tr></table></figure>
|
||
|
||
<blockquote>
|
||
<p>注意事项:左外连接和右外连接是可以相互替换的,只需要调整在连接查询时SQL中,表结构的先后顺序就可以了。而我们在日常开发使用时,更偏向于左外连接。</p>
|
||
</blockquote>
|
||
<h3 id="4-5-自连接"><a href="#4-5-自连接" class="headerlink" title="4.5 自连接"></a>4.5 自连接</h3><p><img src="/pictures/image-20231004202219787.png" alt="image-20231004202219787"></p>
|
||
<figure class="highlight sql"><table><tr><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">-- 表结构: emp</span></span><br><span class="line"><span class="comment">-- 技巧:查询的时候看作是两张表</span></span><br><span class="line"><span class="keyword">select</span> e1.name <span class="string">'员工'</span> ,e2.name <span class="string">'领导'</span> <span class="keyword">from</span> emp e1,emp e2 <span class="keyword">where</span> e1.managerid <span class="operator">=</span> e2.id;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询所有员工 emp 及其领导的名字 emp , 如果员工没有领导, 也需要查询出来</span></span><br><span class="line"><span class="comment">-- 表结构: emp a , emp b</span></span><br><span class="line"><span class="keyword">select</span> e1.name <span class="string">'员工'</span> ,e2.name <span class="string">'领导'</span> <span class="keyword">from</span> emp e1 <span class="keyword">left</span> <span class="keyword">join</span> emp e2 <span class="keyword">on</span> e1.managerid <span class="operator">=</span> e2.id;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-6-联合查询"><a href="#4-6-联合查询" class="headerlink" title="4.6 联合查询"></a>4.6 联合查询</h3><p><img src="/pictures/image-20231004203207924.png" alt="image-20231004203207924"></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 联合查询</span></span><br><span class="line"><span class="comment">-- 将薪资低于 5000 的员工 , 和 年龄大于 50 岁的员工全部查询出来.</span></span><br><span class="line"><span class="comment">-- 当前对于这个需求,我们可以直接使用多条件查询,使用逻辑运算符 or 连接即可,也可以通过union/union all来联合查询</span></span><br><span class="line"><span class="comment">-- 相当于把下面的两条sql的结果拼接在一起(去掉all就可以实现去重)</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e <span class="keyword">where</span> e.salary <span class="operator"><</span> <span class="number">5000</span></span><br><span class="line"><span class="keyword">union</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e <span class="keyword">where</span> e.age <span class="operator">></span> <span class="number">50</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20231004203724124.png" alt="image-20231004203724124"></p>
|
||
<blockquote>
|
||
<p>union all查询出来的结果,仅仅进行简单的合并,并未去重</p>
|
||
<p>union 联合查询,会对查询出来的结果进行去重处理</p>
|
||
</blockquote>
|
||
<h3 id="4-7-子查询"><a href="#4-7-子查询" class="headerlink" title="4.7 子查询"></a>4.7 子查询</h3><p><img src="/pictures/image-20231004204033345.png" alt="image-20231004204033345"></p>
|
||
<p><strong>标量子查询</strong></p>
|
||
<p>子查询返回的结果是单个值(数字、字符串、日期等),最简单的形式,这种子查询称为标量子查询。常用的操作符:= <> > >= < <=</p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 标量子查询</span></span><br><span class="line"><span class="comment">-- 1.查询 "销售部" 的所有员工信息</span></span><br><span class="line"><span class="comment">-- 1.1 查询销售部的部门id</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e <span class="keyword">where</span> e.dept_id <span class="operator">=</span> (<span class="keyword">select</span> id <span class="keyword">from</span> dept d <span class="keyword">where</span> d.name <span class="operator">=</span> <span class="string">'销售部'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询在 "方东白" 入职之后的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e1 <span class="keyword">where</span> e1.entrydate <span class="operator">></span> (<span class="keyword">select</span> e2.entrydate <span class="keyword">from</span> emp e2 <span class="keyword">where</span> e2.name <span class="operator">=</span> <span class="string">'方东白'</span>);</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>列子查询</strong></p>
|
||
<p>子查询返回的结果是一列(可以是多行),这种子查询称为列子查询。常用的操作符:IN 、NOT IN 、 ANY 、SOME 、 ALL</p>
|
||
<p><img src="/pictures/image-20231004205225188.png" alt="image-20231004205225188"></p>
|
||
<figure class="highlight sql"><table><tr><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="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e <span class="keyword">where</span> e.dept_id <span class="keyword">in</span> (<span class="keyword">select</span> id <span class="keyword">from</span> dept <span class="keyword">where</span> dept.name <span class="operator">=</span> <span class="string">'销售部'</span> <span class="keyword">or</span> dept.name <span class="operator">=</span> <span class="string">'市场部'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询比财务部所有人工资都高的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e <span class="keyword">where</span> e.salary <span class="operator">></span> <span class="keyword">all</span> (<span class="keyword">select</span> e2.salary <span class="keyword">from</span> emp e2 <span class="keyword">where</span> e2.dept_id <span class="operator">=</span> (<span class="keyword">select</span> id <span class="keyword">from</span> dept <span class="keyword">where</span> dept.name <span class="operator">=</span> <span class="string">'财务部'</span>));</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询比研发部其中任意一人工资高的员工信息(使用any或者some均可)</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e <span class="keyword">where</span> e.salary <span class="operator">></span> <span class="keyword">any</span> (<span class="keyword">select</span> e2.salary <span class="keyword">from</span> emp e2 <span class="keyword">where</span> e2.dept_id <span class="operator">=</span> (<span class="keyword">select</span> id <span class="keyword">from</span> dept <span class="keyword">where</span> dept.name <span class="operator">=</span> <span class="string">'研发部'</span>));</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>行子查询</strong></p>
|
||
<p>子查询返回的结果是一行(可以是多列),这种子查询称为行子查询。常用的操作符:= 、<> 、IN 、NOT IN</p>
|
||
<figure class="highlight sql"><table><tr><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="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e2 <span class="keyword">where</span> (e2.salary,e2.managerid) <span class="operator">=</span> (<span class="keyword">select</span> e.salary,e.managerid <span class="keyword">from</span> emp e <span class="keyword">where</span> e.name <span class="operator">=</span> <span class="string">'张无忌'</span>);</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>表子查询</strong></p>
|
||
<p>子查询返回的结果是多行多列,这种子查询称为表子查询。常用的操作符:IN</p>
|
||
<figure class="highlight sql"><table><tr><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="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e2 <span class="keyword">where</span> (e2.job,e2.salary) <span class="keyword">in</span> (<span class="keyword">select</span> e.job, e.salary <span class="keyword">from</span> emp e <span class="keyword">where</span> e.name <span class="operator">=</span> <span class="string">'鹿杖客'</span> <span class="keyword">or</span> name <span class="operator">=</span> <span class="string">'宋远桥'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询入职日期是 "2006-01-01" 之后的员工信息 , 及其部门信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> (<span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> entrydate <span class="operator">></span> <span class="string">'2006-01-01'</span>) e <span class="keyword">left</span> <span class="keyword">join</span> dept d <span class="keyword">on</span> e.dept_id <span class="operator">=</span> d.id;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>多表查询相关的sql语句</strong></p>
|
||
<figure class="highlight sql"><table><tr><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">create</span> <span class="keyword">table</span> student</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment <span class="keyword">primary</span> key comment <span class="string">'主键ID'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> <span class="keyword">no</span> <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'学号'</span></span><br><span class="line">) comment <span class="string">'学生表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> student</span><br><span class="line"><span class="keyword">values</span> (<span class="keyword">null</span>, <span class="string">'黛绮丝'</span>, <span class="string">'2000100101'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'谢逊'</span>,</span><br><span class="line"> <span class="string">'2000100102'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'殷天正'</span>, <span class="string">'2000100103'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'韦一笑'</span>, <span class="string">'2000100104'</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> course</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment <span class="keyword">primary</span> key comment <span class="string">'主键ID'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'课程名称'</span></span><br><span class="line">) comment <span class="string">'课程表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> course</span><br><span class="line"><span class="keyword">values</span> (<span class="keyword">null</span>, <span class="string">'Java'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'PHP'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'MySQL'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'Hadoop'</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> student_course</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'主键'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> studentid <span class="type">int</span> <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'学生ID'</span>,</span><br><span class="line"> courseid <span class="type">int</span> <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'课程ID'</span>,</span><br><span class="line"> <span class="keyword">constraint</span> fk_courseid <span class="keyword">foreign</span> key (courseid) <span class="keyword">references</span> course (id),</span><br><span class="line"> <span class="keyword">constraint</span> fk_studentid <span class="keyword">foreign</span> key (studentid) <span class="keyword">references</span> student (id)</span><br><span class="line">) comment <span class="string">'学生课程中间表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> student_course</span><br><span class="line"><span class="keyword">values</span> (<span class="keyword">null</span>, <span class="number">1</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="number">1</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="number">1</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="number">2</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="number">2</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="number">3</span>, <span class="number">4</span>);</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">create</span> <span class="keyword">table</span> tb_user</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment <span class="keyword">primary</span> key comment <span class="string">'主键ID'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> age <span class="type">int</span> comment <span class="string">'年龄'</span>,</span><br><span class="line"> gender <span class="type">char</span>(<span class="number">1</span>) comment <span class="string">'1: 男 , 2: 女'</span>,</span><br><span class="line"> phone <span class="type">char</span>(<span class="number">11</span>) comment <span class="string">'手机号'</span></span><br><span class="line">) comment <span class="string">'用户基本信息表'</span>;</span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> tb_user_edu</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment <span class="keyword">primary</span> key comment <span class="string">'主键ID'</span>,</span><br><span class="line"> degree <span class="type">varchar</span>(<span class="number">20</span>) comment <span class="string">'学历'</span>,</span><br><span class="line"> major <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'专业'</span>,</span><br><span class="line"> primaryschool <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'小学'</span>,</span><br><span class="line"> middleschool <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'中学'</span>,</span><br><span class="line"> university <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'大学'</span>,</span><br><span class="line"> userid <span class="type">int</span> <span class="keyword">unique</span> comment <span class="string">'用户ID'</span>,</span><br><span class="line"> <span class="keyword">constraint</span> fk_userid <span class="keyword">foreign</span> key (userid) <span class="keyword">references</span> tb_user (id)</span><br><span class="line">) comment <span class="string">'用户教育信息表'</span>;</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> tb_user(id, name, age, gender, phone)</span><br><span class="line"><span class="keyword">values</span> (<span class="keyword">null</span>, <span class="string">'黄渤'</span>, <span class="number">45</span>, <span class="string">'1'</span>, <span class="string">'18800001111'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'冰冰'</span>, <span class="number">35</span>, <span class="string">'2'</span>, <span class="string">'18800002222'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'码云'</span>, <span class="number">55</span>, <span class="string">'1'</span>, <span class="string">'18800008888'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'李彦宏'</span>, <span class="number">50</span>, <span class="string">'1'</span>, <span class="string">'18800009999'</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> tb_user_edu(id, degree, major, primaryschool, middleschool,</span><br><span class="line"> university, userid)</span><br><span class="line"><span class="keyword">values</span> (<span class="keyword">null</span>, <span class="string">'本科'</span>, <span class="string">'舞蹈'</span>, <span class="string">'静安区第一小学'</span>, <span class="string">'静安区第一中学'</span>, <span class="string">'北京舞蹈学院'</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'硕士'</span>, <span class="string">'表演'</span>, <span class="string">'朝阳区第一小学'</span>, <span class="string">'朝阳区第一中学'</span>, <span class="string">'北京电影学院'</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'本科'</span>, <span class="string">'英语'</span>, <span class="string">'杭州市第一小学'</span>, <span class="string">'杭州市第一中学'</span>, <span class="string">'杭州师范大学'</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'本科'</span>, <span class="string">'应用数学'</span>, <span class="string">'阳泉第一小学'</span>, <span class="string">'阳泉区第一中学'</span>, <span class="string">'清华大学'</span>, <span class="number">4</span>);</span><br><span class="line"></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">-- 创建dept表,并插入数据</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> dept</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'ID'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'部门名称'</span></span><br><span class="line">) comment <span class="string">'部门表'</span>;</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> dept (id, name)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'研发部'</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'市场部'</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'财务部'</span>),</span><br><span class="line"> (<span class="number">4</span>,</span><br><span class="line"> <span class="string">'销售部'</span>),</span><br><span class="line"> (<span class="number">5</span>, <span class="string">'总经办'</span>),</span><br><span class="line"> (<span class="number">6</span>, <span class="string">'人事部'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 创建emp表,并插入数据</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> emp</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'ID'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'姓名'</span>,</span><br><span class="line"> age <span class="type">int</span> comment <span class="string">'年龄'</span>,</span><br><span class="line"> job <span class="type">varchar</span>(<span class="number">20</span>) comment <span class="string">'职位'</span>,</span><br><span class="line"> salary <span class="type">int</span> comment <span class="string">'薪资'</span>,</span><br><span class="line"> entrydate <span class="type">date</span> comment <span class="string">'入职时间'</span>,</span><br><span class="line"> managerid <span class="type">int</span> comment <span class="string">'直属领导ID'</span>,</span><br><span class="line"> dept_id <span class="type">int</span> comment <span class="string">'部门ID'</span></span><br><span class="line">) comment <span class="string">'员工表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 添加外键</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp</span><br><span class="line"> <span class="keyword">add</span> <span class="keyword">constraint</span> fk_emp_dept_id <span class="keyword">foreign</span> key (dept_id) <span class="keyword">references</span></span><br><span class="line"> dept (id);</span><br><span class="line"></span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> emp (id, name, age, job, salary, entrydate, managerid, dept_id)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'金庸'</span>, <span class="number">66</span>, <span class="string">'总裁'</span>, <span class="number">20000</span>, <span class="string">'2000-01-01'</span>, <span class="keyword">null</span>, <span class="number">5</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'张无忌'</span>, <span class="number">20</span>, <span class="string">'项目经理'</span>, <span class="number">12500</span>, <span class="string">'2005-12-05'</span>, <span class="number">1</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'杨逍'</span>, <span class="number">33</span>, <span class="string">'开发'</span>, <span class="number">8400</span>, <span class="string">'2000-11-03'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">4</span>, <span class="string">'韦一笑'</span>, <span class="number">48</span>, <span class="string">'开发'</span>, <span class="number">11000</span>, <span class="string">'2002-02-05'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">5</span>, <span class="string">'常遇春'</span>, <span class="number">43</span>, <span class="string">'开发'</span>, <span class="number">10500</span>, <span class="string">'2004-09-07'</span>, <span class="number">3</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">6</span>, <span class="string">'小昭'</span>, <span class="number">19</span>, <span class="string">'程序员鼓励师'</span>, <span class="number">6600</span>, <span class="string">'2004-10-12'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">7</span>, <span class="string">'灭绝'</span>, <span class="number">60</span>, <span class="string">'财务总监'</span>, <span class="number">8500</span>, <span class="string">'2002-09-12'</span>, <span class="number">1</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="number">8</span>, <span class="string">'周芷若'</span>, <span class="number">19</span>, <span class="string">'会计'</span>, <span class="number">48000</span>, <span class="string">'2006-06-02'</span>, <span class="number">7</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="number">9</span>, <span class="string">'丁敏君'</span>, <span class="number">23</span>, <span class="string">'出纳'</span>, <span class="number">5250</span>, <span class="string">'2009-05-13'</span>, <span class="number">7</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="number">10</span>, <span class="string">'赵敏'</span>, <span class="number">20</span>, <span class="string">'市场部总监'</span>, <span class="number">12500</span>, <span class="string">'2004-10-12'</span>, <span class="number">1</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="number">11</span>, <span class="string">'鹿杖客'</span>, <span class="number">56</span>, <span class="string">'职员'</span>, <span class="number">3750</span>, <span class="string">'2006-10-03'</span>, <span class="number">10</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="number">12</span>, <span class="string">'鹤笔翁'</span>, <span class="number">19</span>, <span class="string">'职员'</span>, <span class="number">3750</span>, <span class="string">'2007-05-09'</span>, <span class="number">10</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="number">13</span>, <span class="string">'方东白'</span>, <span class="number">19</span>, <span class="string">'职员'</span>, <span class="number">5500</span>, <span class="string">'2009-02-12'</span>, <span class="number">10</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="number">14</span>, <span class="string">'张三丰'</span>, <span class="number">88</span>, <span class="string">'销售总监'</span>, <span class="number">14000</span>, <span class="string">'2004-10-12'</span>, <span class="number">1</span>, <span class="number">4</span>),</span><br><span class="line"> (<span class="number">15</span>, <span class="string">'俞莲舟'</span>, <span class="number">38</span>, <span class="string">'销售'</span>, <span class="number">4600</span>, <span class="string">'2004-10-12'</span>, <span class="number">14</span>, <span class="number">4</span>),</span><br><span class="line"> (<span class="number">16</span>, <span class="string">'宋远桥'</span>, <span class="number">40</span>, <span class="string">'销售'</span>, <span class="number">4600</span>, <span class="string">'2004-10-12'</span>, <span class="number">14</span>, <span class="number">4</span>),</span><br><span class="line"> (<span class="number">17</span>, <span class="string">'陈友谅'</span>, <span class="number">42</span>, <span class="keyword">null</span>, <span class="number">2000</span>, <span class="string">'2011-10-12'</span>, <span class="number">1</span>, <span class="keyword">null</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 多表查询</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp,</span><br><span class="line"> dept</span><br><span class="line"><span class="keyword">where</span> emp.dept_id <span class="operator">=</span> dept.id;</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">-- 表结构: emp , dept</span></span><br><span class="line"><span class="comment">-- 连接条件: emp.dept_id = dept.id</span></span><br><span class="line"><span class="keyword">select</span> e.name, d.name <span class="keyword">from</span> emp e, dept d <span class="keyword">where</span> e.dept_id <span class="operator">=</span> d.id;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询每一个员工的姓名 , 及关联的部门的名称 (显式内连接实现) --- INNER JOIN ...ON ...</span></span><br><span class="line"><span class="comment">-- 表结构: emp , dept</span></span><br><span class="line"><span class="comment">-- 连接条件: emp.dept_id = dept.id</span></span><br><span class="line"><span class="keyword">select</span> e.name ,d.name <span class="keyword">from</span> emp e <span class="keyword">inner</span> <span class="keyword">join</span> dept d <span class="keyword">on</span> e.dept_id <span class="operator">=</span> d.id;</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">-- 查询emp表的所有数据, 和对应的部门信息</span></span><br><span class="line"><span class="comment">-- 由于需求中提到,要查询emp的所有数据,所以是不能内连接查询的,需要考虑使用外连接查询。</span></span><br><span class="line"><span class="comment">-- 表结构: emp, dept</span></span><br><span class="line"><span class="comment">-- 连接条件: emp.dept_id = dept.id</span></span><br><span class="line"><span class="keyword">select</span> e.name,d.name <span class="keyword">from</span> emp e <span class="keyword">left</span> <span class="keyword">join</span> dept d <span class="keyword">on</span> e.dept_id <span class="operator">=</span> d.id;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询dept表的所有数据, 和对应的员工信息(右外连接)</span></span><br><span class="line"><span class="comment">-- 由于需求中提到,要查询dept表的所有数据,所以是不能内连接查询的,需要考虑使用外连接查询</span></span><br><span class="line"><span class="comment">-- 表结构: emp, dept</span></span><br><span class="line"><span class="comment">-- 连接条件: emp.dept_id = dept.id</span></span><br><span class="line"><span class="keyword">select</span> e.name,d.name <span class="keyword">from</span> emp e <span class="keyword">right</span> <span class="keyword">join</span> dept d <span class="keyword">on</span> e.dept_id <span class="operator">=</span> d.id;</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">-- 表结构: emp</span></span><br><span class="line"><span class="comment">-- 技巧:查询的时候看作是两张表</span></span><br><span class="line"><span class="keyword">select</span> e1.name <span class="string">'员工'</span> ,e2.name <span class="string">'领导'</span> <span class="keyword">from</span> emp e1,emp e2 <span class="keyword">where</span> e1.managerid <span class="operator">=</span> e2.id;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询所有员工 emp 及其领导的名字 emp , 如果员工没有领导, 也需要查询出来</span></span><br><span class="line"><span class="comment">-- 表结构: emp a , emp b</span></span><br><span class="line"><span class="keyword">select</span> e1.name <span class="string">'员工'</span> ,e2.name <span class="string">'领导'</span> <span class="keyword">from</span> emp e1 <span class="keyword">left</span> <span class="keyword">join</span> emp e2 <span class="keyword">on</span> e1.managerid <span class="operator">=</span> e2.id;</span><br><span class="line"></span><br><span class="line"></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">-- 将薪资低于 5000 的员工 , 和 年龄大于 50 岁的员工全部查询出来.</span></span><br><span class="line"><span class="comment">-- 当前对于这个需求,我们可以直接使用多条件查询,使用逻辑运算符 or 连接即可,也可以通过union/union all来联合查询</span></span><br><span class="line"><span class="comment">-- 相当于把下面的两条sql的结果拼接在一起(去掉all就可以实现去重)</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e <span class="keyword">where</span> e.salary <span class="operator"><</span> <span class="number">5000</span></span><br><span class="line"><span class="keyword">union</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e <span class="keyword">where</span> e.age <span class="operator">></span> <span class="number">50</span>;</span><br><span class="line"></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">-- 1.查询 "销售部" 的所有员工信息</span></span><br><span class="line"><span class="comment">-- 1.1 查询销售部的部门id</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e <span class="keyword">where</span> e.dept_id <span class="operator">=</span> (<span class="keyword">select</span> id <span class="keyword">from</span> dept d <span class="keyword">where</span> d.name <span class="operator">=</span> <span class="string">'销售部'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询在 "方东白" 入职之后的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e1 <span class="keyword">where</span> e1.entrydate <span class="operator">></span> (<span class="keyword">select</span> e2.entrydate <span class="keyword">from</span> emp e2 <span class="keyword">where</span> e2.name <span class="operator">=</span> <span class="string">'方东白'</span>);</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="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e <span class="keyword">where</span> e.dept_id <span class="keyword">in</span> (<span class="keyword">select</span> id <span class="keyword">from</span> dept <span class="keyword">where</span> dept.name <span class="operator">=</span> <span class="string">'销售部'</span> <span class="keyword">or</span> dept.name <span class="operator">=</span> <span class="string">'市场部'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询比财务部所有人工资都高的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e <span class="keyword">where</span> e.salary <span class="operator">></span> <span class="keyword">all</span> (<span class="keyword">select</span> e2.salary <span class="keyword">from</span> emp e2 <span class="keyword">where</span> e2.dept_id <span class="operator">=</span> (<span class="keyword">select</span> id <span class="keyword">from</span> dept <span class="keyword">where</span> dept.name <span class="operator">=</span> <span class="string">'财务部'</span>));</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询比研发部其中任意一人工资高的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e <span class="keyword">where</span> e.salary <span class="operator">></span> <span class="keyword">any</span> (<span class="keyword">select</span> e2.salary <span class="keyword">from</span> emp e2 <span class="keyword">where</span> e2.dept_id <span class="operator">=</span> (<span class="keyword">select</span> id <span class="keyword">from</span> dept <span class="keyword">where</span> dept.name <span class="operator">=</span> <span class="string">'研发部'</span>));</span><br><span class="line"></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="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e2 <span class="keyword">where</span> (e2.salary,e2.managerid) <span class="operator">=</span> (<span class="keyword">select</span> e.salary,e.managerid <span class="keyword">from</span> emp e <span class="keyword">where</span> e.name <span class="operator">=</span> <span class="string">'张无忌'</span>);</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="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp e2 <span class="keyword">where</span> (e2.job,e2.salary) <span class="keyword">in</span> (<span class="keyword">select</span> e.job, e.salary <span class="keyword">from</span> emp e <span class="keyword">where</span> e.name <span class="operator">=</span> <span class="string">'鹿杖客'</span> <span class="keyword">or</span> name <span class="operator">=</span> <span class="string">'宋远桥'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询入职日期是 "2006-01-01" 之后的员工信息 , 及其部门信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> (<span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> entrydate <span class="operator">></span> <span class="string">'2006-01-01'</span>) e <span class="keyword">left</span> <span class="keyword">join</span> dept d <span class="keyword">on</span> e.dept_id <span class="operator">=</span> d.id;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-8-多表查询案例"><a href="#4-8-多表查询案例" class="headerlink" title="4.8 多表查询案例"></a>4.8 多表查询案例</h3><p><strong>题目</strong></p>
|
||
<p><img src="/pictures/image-20231004212719134.png" alt="image-20231004212719134"></p>
|
||
<p><strong>数据准备</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 数据准备</span></span><br><span class="line"><span class="comment">-- 创建dept表,并插入数据</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> dept</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'ID'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'部门名称'</span></span><br><span class="line">) comment <span class="string">'部门表'</span>;</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> dept (id, name)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'研发部'</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'市场部'</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'财务部'</span>),</span><br><span class="line"> (<span class="number">4</span>,</span><br><span class="line"> <span class="string">'销售部'</span>),</span><br><span class="line"> (<span class="number">5</span>, <span class="string">'总经办'</span>),</span><br><span class="line"> (<span class="number">6</span>, <span class="string">'人事部'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 创建emp表,并插入数据</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> emp</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'ID'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'姓名'</span>,</span><br><span class="line"> age <span class="type">int</span> comment <span class="string">'年龄'</span>,</span><br><span class="line"> job <span class="type">varchar</span>(<span class="number">20</span>) comment <span class="string">'职位'</span>,</span><br><span class="line"> salary <span class="type">int</span> comment <span class="string">'薪资'</span>,</span><br><span class="line"> entrydate <span class="type">date</span> comment <span class="string">'入职时间'</span>,</span><br><span class="line"> managerid <span class="type">int</span> comment <span class="string">'直属领导ID'</span>,</span><br><span class="line"> dept_id <span class="type">int</span> comment <span class="string">'部门ID'</span></span><br><span class="line">) comment <span class="string">'员工表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 添加外键</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp</span><br><span class="line"> <span class="keyword">add</span> <span class="keyword">constraint</span> fk_emp_dept_id <span class="keyword">foreign</span> key (dept_id) <span class="keyword">references</span></span><br><span class="line"> dept (id);</span><br><span class="line"></span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> emp (id, name, age, job, salary, entrydate, managerid, dept_id)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'金庸'</span>, <span class="number">66</span>, <span class="string">'总裁'</span>, <span class="number">20000</span>, <span class="string">'2000-01-01'</span>, <span class="keyword">null</span>, <span class="number">5</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'张无忌'</span>, <span class="number">20</span>, <span class="string">'项目经理'</span>, <span class="number">12500</span>, <span class="string">'2005-12-05'</span>, <span class="number">1</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'杨逍'</span>, <span class="number">33</span>, <span class="string">'开发'</span>, <span class="number">8400</span>, <span class="string">'2000-11-03'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">4</span>, <span class="string">'韦一笑'</span>, <span class="number">48</span>, <span class="string">'开发'</span>, <span class="number">11000</span>, <span class="string">'2002-02-05'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">5</span>, <span class="string">'常遇春'</span>, <span class="number">43</span>, <span class="string">'开发'</span>, <span class="number">10500</span>, <span class="string">'2004-09-07'</span>, <span class="number">3</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">6</span>, <span class="string">'小昭'</span>, <span class="number">19</span>, <span class="string">'程序员鼓励师'</span>, <span class="number">6600</span>, <span class="string">'2004-10-12'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">7</span>, <span class="string">'灭绝'</span>, <span class="number">60</span>, <span class="string">'财务总监'</span>, <span class="number">8500</span>, <span class="string">'2002-09-12'</span>, <span class="number">1</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="number">8</span>, <span class="string">'周芷若'</span>, <span class="number">19</span>, <span class="string">'会计'</span>, <span class="number">4800</span>, <span class="string">'2006-06-02'</span>, <span class="number">7</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="number">9</span>, <span class="string">'丁敏君'</span>, <span class="number">23</span>, <span class="string">'出纳'</span>, <span class="number">5250</span>, <span class="string">'2009-05-13'</span>, <span class="number">7</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="number">10</span>, <span class="string">'赵敏'</span>, <span class="number">20</span>, <span class="string">'市场部总监'</span>, <span class="number">12500</span>, <span class="string">'2004-10-12'</span>, <span class="number">1</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="number">11</span>, <span class="string">'鹿杖客'</span>, <span class="number">56</span>, <span class="string">'职员'</span>, <span class="number">3750</span>, <span class="string">'2006-10-03'</span>, <span class="number">10</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="number">12</span>, <span class="string">'鹤笔翁'</span>, <span class="number">19</span>, <span class="string">'职员'</span>, <span class="number">3750</span>, <span class="string">'2007-05-09'</span>, <span class="number">10</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="number">13</span>, <span class="string">'方东白'</span>, <span class="number">19</span>, <span class="string">'职员'</span>, <span class="number">5500</span>, <span class="string">'2009-02-12'</span>, <span class="number">10</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="number">14</span>, <span class="string">'张三丰'</span>, <span class="number">88</span>, <span class="string">'销售总监'</span>, <span class="number">14000</span>, <span class="string">'2004-10-12'</span>, <span class="number">1</span>, <span class="number">4</span>),</span><br><span class="line"> (<span class="number">15</span>, <span class="string">'俞莲舟'</span>, <span class="number">38</span>, <span class="string">'销售'</span>, <span class="number">4600</span>, <span class="string">'2004-10-12'</span>, <span class="number">14</span>, <span class="number">4</span>),</span><br><span class="line"> (<span class="number">16</span>, <span class="string">'宋远桥'</span>, <span class="number">40</span>, <span class="string">'销售'</span>, <span class="number">4600</span>, <span class="string">'2004-10-12'</span>, <span class="number">14</span>, <span class="number">4</span>),</span><br><span class="line"> (<span class="number">17</span>, <span class="string">'陈友谅'</span>, <span class="number">42</span>, <span class="keyword">null</span>, <span class="number">2000</span>, <span class="string">'2011-10-12'</span>, <span class="number">1</span>, <span class="keyword">null</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 创建salgrade并插入数据</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> salgrade</span><br><span class="line">(</span><br><span class="line"> grade <span class="type">int</span>,</span><br><span class="line"> losal <span class="type">int</span>,</span><br><span class="line"> hisal <span class="type">int</span></span><br><span class="line">) comment <span class="string">'薪资等级表'</span>;</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> salgrade</span><br><span class="line"><span class="keyword">values</span> (<span class="number">1</span>, <span class="number">0</span>, <span class="number">3000</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> salgrade</span><br><span class="line"><span class="keyword">values</span> (<span class="number">2</span>, <span class="number">3001</span>, <span class="number">5000</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> salgrade</span><br><span class="line"><span class="keyword">values</span> (<span class="number">3</span>, <span class="number">5001</span>, <span class="number">8000</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> salgrade</span><br><span class="line"><span class="keyword">values</span> (<span class="number">4</span>, <span class="number">8001</span>, <span class="number">10000</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> salgrade</span><br><span class="line"><span class="keyword">values</span> (<span class="number">5</span>, <span class="number">10001</span>, <span class="number">15000</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> salgrade</span><br><span class="line"><span class="keyword">values</span> (<span class="number">6</span>, <span class="number">15001</span>, <span class="number">20000</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> salgrade</span><br><span class="line"><span class="keyword">values</span> (<span class="number">7</span>, <span class="number">20001</span>, <span class="number">25000</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> salgrade</span><br><span class="line"><span class="keyword">values</span> (<span class="number">8</span>, <span class="number">25001</span>, <span class="number">30000</span>);</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>题解</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 题解</span></span><br><span class="line"><span class="comment">-- 1.查询员工的姓名、年龄、职位、部门信息(隐式内连接)</span></span><br><span class="line"><span class="keyword">select</span> e.name, e.age, e.job, d.name</span><br><span class="line"><span class="keyword">from</span> emp e,</span><br><span class="line"> dept d</span><br><span class="line"><span class="keyword">where</span> e.dept_id <span class="operator">=</span> d.id;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 2.查询年龄小于30岁的员工的姓名、年龄、职位、部门信息(显式内连接)</span></span><br><span class="line"><span class="keyword">select</span> e.name, e.age, e.job, d.name</span><br><span class="line"><span class="keyword">from</span> emp e</span><br><span class="line"> <span class="keyword">inner</span> <span class="keyword">join</span> dept d <span class="keyword">on</span> e.dept_id <span class="operator">=</span> d.id</span><br><span class="line"><span class="keyword">where</span> e.age <span class="operator"><</span> <span class="number">30</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 3.查询拥有员工的部门id、部门名称</span></span><br><span class="line"><span class="comment">-- 方法一</span></span><br><span class="line"><span class="keyword">select</span> <span class="keyword">distinct</span> d.id, d.name</span><br><span class="line"><span class="keyword">from</span> emp e,</span><br><span class="line"> dept d</span><br><span class="line"><span class="keyword">where</span> e.dept_id <span class="operator">=</span> d.id;</span><br><span class="line"><span class="comment">-- 方法二</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> dept</span><br><span class="line"><span class="keyword">where</span> dept.id <span class="keyword">in</span> (<span class="keyword">select</span> e.dept_id <span class="keyword">from</span> emp e);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 4.查询所有年龄大于40岁的员工,及其归属的部门名称;如果没有员工分配部门,也需要展示出来</span></span><br><span class="line"><span class="keyword">select</span> e.<span class="operator">*</span>, d.name</span><br><span class="line"><span class="keyword">from</span> emp e</span><br><span class="line"> <span class="keyword">left</span> <span class="keyword">join</span> dept d <span class="keyword">on</span> e.dept_id <span class="operator">=</span> d.id</span><br><span class="line"><span class="keyword">where</span> age <span class="operator">></span> <span class="number">40</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 5.查询所有员工的工资等级</span></span><br><span class="line"><span class="keyword">select</span> e.name <span class="string">'姓名'</span>, s.grade <span class="string">'工资等级'</span></span><br><span class="line"><span class="keyword">from</span> emp e,</span><br><span class="line"> salgrade s</span><br><span class="line"><span class="keyword">where</span> e.salary <span class="keyword">between</span> s.losal <span class="keyword">and</span> s.hisal;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 6.查询研发部所有员工的信息已经工资等级</span></span><br><span class="line"><span class="comment">-- 方法一</span></span><br><span class="line"><span class="keyword">select</span> e.<span class="operator">*</span>, s.grade</span><br><span class="line"><span class="keyword">from</span> emp e,</span><br><span class="line"> dept d,</span><br><span class="line"> salgrade s</span><br><span class="line"><span class="keyword">where</span> e.dept_id <span class="operator">=</span> d.id</span><br><span class="line"> <span class="keyword">and</span> (e.salary <span class="keyword">between</span> s.losal <span class="keyword">and</span> s.hisal)</span><br><span class="line"> <span class="keyword">and</span> d.name <span class="operator">=</span> <span class="string">'研发部'</span>;</span><br><span class="line"><span class="comment">-- 方法二</span></span><br><span class="line"><span class="keyword">select</span> e.<span class="operator">*</span>, s.grade</span><br><span class="line"><span class="keyword">from</span> (<span class="keyword">select</span> emp.<span class="operator">*</span></span><br><span class="line"> <span class="keyword">from</span> emp,</span><br><span class="line"> dept</span><br><span class="line"> <span class="keyword">where</span> emp.dept_id <span class="operator">=</span> dept.id</span><br><span class="line"> <span class="keyword">and</span> dept.name <span class="operator">=</span> <span class="string">'研发部'</span>) e,</span><br><span class="line"> salgrade s</span><br><span class="line"><span class="keyword">where</span> e.salary <span class="keyword">between</span> s.losal <span class="keyword">and</span> s.hisal;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 7.查询研发部的平均工资</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">avg</span>(e.salary)</span><br><span class="line"><span class="keyword">from</span> emp e,</span><br><span class="line"> dept d</span><br><span class="line"><span class="keyword">where</span> e.dept_id <span class="operator">=</span> d.id</span><br><span class="line"> <span class="keyword">and</span> d.name <span class="operator">=</span> <span class="string">'研发部'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 8.查询工资比灭绝高的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> salary <span class="operator">></span> (<span class="keyword">select</span> salary <span class="keyword">from</span> emp <span class="keyword">where</span> name <span class="operator">=</span> <span class="string">'灭绝'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 9.查询比平均工资高的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> salary <span class="operator">></span> (<span class="keyword">select</span> <span class="built_in">avg</span>(salary) <span class="keyword">from</span> emp);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 10.查询低于本部门平均工资的员工</span></span><br><span class="line"><span class="comment">-- 方法一</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp e2</span><br><span class="line"><span class="keyword">where</span> e2.salary <span class="operator"><</span> (<span class="keyword">select</span> <span class="built_in">avg</span>(e1.salary) <span class="keyword">from</span> emp e1 <span class="keyword">where</span> e1.dept_id <span class="operator">=</span> e2.dept_id);</span><br><span class="line"><span class="comment">-- 方法二</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp e,</span><br><span class="line"> (<span class="keyword">select</span> dept_id, <span class="built_in">avg</span>(salary) <span class="string">'salavg'</span> <span class="keyword">from</span> emp <span class="keyword">group</span> <span class="keyword">by</span> dept_id) eavg</span><br><span class="line"><span class="keyword">where</span> eavg.dept_id <span class="operator">=</span> e.dept_id</span><br><span class="line"> <span class="keyword">and</span> e.salary <span class="operator"><</span> eavg.salavg;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 11.查询所有的部门信息,并统计部门的员工人数</span></span><br><span class="line"><span class="comment">-- 方法一</span></span><br><span class="line"><span class="keyword">select</span> d.id, d.name, (<span class="keyword">select</span> <span class="built_in">count</span>(<span class="operator">*</span>) <span class="keyword">from</span> emp e <span class="keyword">where</span> e.dept_id <span class="operator">=</span> d.id) <span class="string">'人数'</span></span><br><span class="line"><span class="keyword">from</span> dept d;</span><br><span class="line"><span class="comment">-- 方法二</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> dept d,</span><br><span class="line"> (<span class="keyword">select</span> e.dept_id, <span class="built_in">count</span>(<span class="operator">*</span>) <span class="string">'人数'</span> <span class="keyword">from</span> emp e <span class="keyword">group</span> <span class="keyword">by</span> e.dept_id) ecount</span><br><span class="line"><span class="keyword">where</span> d.id <span class="operator">=</span> ecount.dept_id;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 12.查询所有学生的选课情况,展示出学生名称,学号,课程名称</span></span><br><span class="line"><span class="keyword">select</span> s.name, s.no, c.name</span><br><span class="line"><span class="keyword">from</span> course c,</span><br><span class="line"> student s,</span><br><span class="line"> student_course sc</span><br><span class="line"><span class="keyword">where</span> c.id <span class="operator">=</span> sc.courseid</span><br><span class="line"> <span class="keyword">and</span> s.id <span class="operator">=</span> sc.studentid;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>总结</strong></p>
|
||
<p> <img src="/pictures/image-20231005133456395.png" alt="image-20231005133456395"></p>
|
||
<h2 id="5-事务"><a href="#5-事务" class="headerlink" title="5.事务"></a>5.事务</h2><h3 id="5-1-事务介绍"><a href="#5-1-事务介绍" class="headerlink" title="5.1 事务介绍"></a>5.1 事务介绍</h3><p> 事务 是一组操作的集合,它是一个不可分割的工作单位,事务会把所有的操作作为一个整体一起向系统提交或撤销操作请求,即这些操作要么同时成功,要么同时失败。就比如: 张三给李四转账1000块钱,张三银行账户的钱减少1000,而李四银行账户的钱要增加1000。 这一组操作就必须在一个事务的范围内,要么都成功,要么都失败。</p>
|
||
<blockquote>
|
||
<p>注意: 默认MySQL的事务是自动提交的,也就是说,当执行完一条DML语句时,MySQL会立即隐式的提交事务。</p>
|
||
</blockquote>
|
||
<h3 id="5-2-事务操作"><a href="#5-2-事务操作" class="headerlink" title="5.2 事务操作"></a>5.2 事务操作</h3><p><strong>数据准备</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 数据准备</span></span><br><span class="line"><span class="keyword">drop</span> <span class="keyword">table</span> if <span class="keyword">exists</span> account;</span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> account</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> <span class="keyword">primary</span> key AUTO_INCREMENT comment <span class="string">'ID'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> money <span class="keyword">double</span>(<span class="number">10</span>, <span class="number">2</span>) comment <span class="string">'余额'</span></span><br><span class="line">) comment <span class="string">'账户表'</span>;</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> account(name, money)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="string">'张三'</span>, <span class="number">2000</span>),</span><br><span class="line"> (<span class="string">'李四'</span>, <span class="number">2000</span>);</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> account;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">-- 转账操作(张三转1000给李四)</span></span><br><span class="line"><span class="comment">-- 1. 查询张三余额</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> account <span class="keyword">where</span> name <span class="operator">=</span> <span class="string">'张三'</span>;</span><br><span class="line"><span class="comment">-- 2. 张三的余额减少1000</span></span><br><span class="line"><span class="keyword">update</span> account <span class="keyword">set</span> money <span class="operator">=</span> money <span class="operator">-</span> <span class="number">1000</span> <span class="keyword">where</span> name <span class="operator">=</span> <span class="string">'张三'</span>;</span><br><span class="line"><span class="comment">-- 3. 李四的余额增加1000</span></span><br><span class="line"><span class="keyword">update</span> account <span class="keyword">set</span> money <span class="operator">=</span> money <span class="operator">+</span> <span class="number">1000</span> <span class="keyword">where</span> name <span class="operator">=</span> <span class="string">'李四'</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>控制事务一</strong></p>
|
||
<p><img src="/pictures/image-20231005134601982.png" alt="image-20231005134601982"></p>
|
||
<p><strong>控制事务二</strong></p>
|
||
<p><img src="/pictures/image-20231005134750027.png" alt="image-20231005134750027"></p>
|
||
<p><img src="/pictures/image-20231005134835921.png" alt="image-20231005134835921"></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 开启事务</span></span><br><span class="line"><span class="keyword">start</span> transaction;</span><br><span class="line"><span class="comment">-- 1. 查询张三余额</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> account <span class="keyword">where</span> name <span class="operator">=</span> <span class="string">'张三'</span>;</span><br><span class="line"><span class="comment">-- 2. 张三的余额减少1000</span></span><br><span class="line"><span class="keyword">update</span> account <span class="keyword">set</span> money <span class="operator">=</span> money <span class="operator">-</span> <span class="number">1000</span> <span class="keyword">where</span> name <span class="operator">=</span> <span class="string">'张三'</span>;</span><br><span class="line"><span class="comment">-- 3. 李四的余额增加1000</span></span><br><span class="line"><span class="keyword">update</span> account <span class="keyword">set</span> money <span class="operator">=</span> money <span class="operator">+</span> <span class="number">1000</span> <span class="keyword">where</span> name <span class="operator">=</span> <span class="string">'李四'</span>;</span><br><span class="line"><span class="comment">-- 如果正常执行完毕, 则提交事务</span></span><br><span class="line"><span class="keyword">commit</span>;</span><br><span class="line"><span class="comment">-- 如果执行过程中报错, 则回滚事务</span></span><br><span class="line"><span class="comment">-- rollback;</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="5-3-事务四大特性"><a href="#5-3-事务四大特性" class="headerlink" title="5.3 事务四大特性"></a>5.3 事务四大特性</h3><p><img src="/pictures/image-20231005135637347.png" alt="image-20231005135637347"></p>
|
||
<h3 id="5-4-并发事务问题"><a href="#5-4-并发事务问题" class="headerlink" title="5.4 并发事务问题"></a>5.4 并发事务问题</h3><p><img src="/pictures/image-20231005135741486.png" alt="image-20231005135741486"></p>
|
||
<p><img src="/pictures/image-20231005135811745.png" alt="image-20231005135811745"></p>
|
||
<h3 id="5-5-事务隔离级别"><a href="#5-5-事务隔离级别" class="headerlink" title="5.5 事务隔离级别"></a>5.5 事务隔离级别</h3><p><strong>为了解决并发事务所引发的问题,在数据库中引入了事务隔离级别,主要有以下几种:</strong></p>
|
||
<p> “X” 表示不会出现</p>
|
||
<p> <img src="/pictures/image-20231005140255060.png" alt="image-20231005140255060"></p>
|
||
<p><img src="/pictures/image-20231005140322039.png" alt="image-20231005140322039"></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 查看事务隔离级别</span></span><br><span class="line"><span class="keyword">SELECT</span> @<span class="variable">@TRANSACTION_ISOLATION</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 设置事务的隔离级别</span></span><br><span class="line"><span class="keyword">SET</span> [ SESSION <span class="operator">|</span> <span class="keyword">GLOBAL</span> ] TRANSACTION ISOLATION LEVEL { READ UNCOMMITTED <span class="operator">|</span> READ COMMITTED <span class="operator">|</span> REPEATABLE READ <span class="operator">|</span> SERIALIZABLE }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>小结</strong></p>
|
||
<p> <img src="/pictures/image-20231005142056902.png" alt="image-20231005142056902"></p>
|
||
<p><strong>基础篇全部的Sql</strong></p>
|
||
<figure class="highlight sql"><table><tr><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="keyword">show</span> databases;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询当前的数据库</span></span><br><span class="line"><span class="keyword">select</span> database();</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 创建数据库</span></span><br><span class="line"><span class="keyword">create</span> database if <span class="keyword">not</span> <span class="keyword">exists</span> itcast;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除数据库</span></span><br><span class="line"><span class="keyword">drop</span> database if <span class="keyword">exists</span> itcast;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 使用数据库</span></span><br><span class="line">use itcast;</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><br><span class="line"><span class="comment">-- 创建用户表</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> tb_user</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> comment <span class="string">'编号'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> age <span class="type">int</span> comment <span class="string">'年龄'</span>,</span><br><span class="line"> gender <span class="type">varchar</span>(<span class="number">1</span>) comment <span class="string">'性别'</span></span><br><span class="line">) comment <span class="string">'用户表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 显示创建表的结构</span></span><br><span class="line"><span class="keyword">desc</span> tb_user;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 显示创建表的语句</span></span><br><span class="line"><span class="keyword">show</span> <span class="keyword">create</span> <span class="keyword">table</span> tb_user;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除表</span></span><br><span class="line"><span class="keyword">drop</span> <span class="keyword">table</span> emp;</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="keyword">create</span> <span class="keyword">table</span> emp</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> comment <span class="string">'编号'</span>,</span><br><span class="line"> workno <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'工号'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> gender <span class="type">char</span>(<span class="number">1</span>) comment <span class="string">'性别'</span>,</span><br><span class="line"> age tinyint unsigned comment <span class="string">'年龄'</span>,</span><br><span class="line"> idcard <span class="type">char</span>(<span class="number">18</span>) comment <span class="string">'身份证号'</span>,</span><br><span class="line"> entrydate <span class="type">date</span> comment <span class="string">'入职时间'</span></span><br><span class="line">) comment <span class="string">'员工表'</span>;</span><br><span class="line"><span class="comment">-- 查看表结构</span></span><br><span class="line"><span class="keyword">desc</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改表结构(向emp表中添加昵称字段)</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp</span><br><span class="line"> <span class="keyword">add</span> nickname <span class="type">varchar</span>(<span class="number">20</span>) comment <span class="string">'昵称'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改相应字段的数据类型(把age的数据类型从int改回tinyint)</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp</span><br><span class="line"> modify age tinyint;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改字段名和字段的类型(把nickname字段改为username,并修改数据类型)</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp</span><br><span class="line"> change nickname username <span class="type">varchar</span>(<span class="number">30</span>) comment <span class="string">'用户名'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除字段(删除username字段)</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp</span><br><span class="line"> <span class="keyword">drop</span> username;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改表名(将表名字从emo修改为employee)</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp rename <span class="keyword">to</span> employee;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除表</span></span><br><span class="line"><span class="keyword">drop</span> <span class="keyword">table</span> if <span class="keyword">exists</span> employee;</span><br><span class="line"><span class="comment">-- 删除指定表,并重新创建该表(相当于删除表中的全部数据)</span></span><br><span class="line"><span class="keyword">truncate</span> <span class="keyword">table</span> employee;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">-- ------------------------------------------------DML-增删改操作---------------------------------------------------</span></span><br><span class="line"><span class="comment">-- 添加数据</span></span><br><span class="line"><span class="keyword">select</span> database();</span><br><span class="line"><span class="keyword">show</span> tables;</span><br><span class="line"><span class="comment">-- 该指定的字段添加数据</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> employee(id, workno, name, gender, age, idcard, entrydate) <span class="keyword">value</span> (<span class="number">1</span>, <span class="string">'1'</span>, <span class="string">'小华'</span>, <span class="string">'男'</span>, <span class="number">20</span>, <span class="string">'123456789123456789'</span>, <span class="string">'2001-01-01'</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> employee;</span><br><span class="line"><span class="comment">-- 给全部的字段添加数据</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> employee <span class="keyword">value</span> (<span class="number">2</span>, <span class="string">'2'</span>, <span class="string">'小刚'</span>, <span class="string">'男'</span>, <span class="number">23</span>, <span class="string">'123456784124456789'</span>, <span class="string">'2008-01-01'</span>);</span><br><span class="line"><span class="comment">-- 批量添加数据</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> employee</span><br><span class="line"><span class="keyword">values</span> (<span class="number">3</span>, <span class="string">'3'</span>, <span class="string">'小李'</span>, <span class="string">'男'</span>, <span class="number">23</span>, <span class="string">'123456784124456789'</span>, <span class="string">'2008-01-01'</span>),</span><br><span class="line"> (<span class="number">4</span>, <span class="string">'4'</span>, <span class="string">'小黄'</span>, <span class="string">'男'</span>, <span class="number">23</span>, <span class="string">'123456784124456789'</span>, <span class="string">'2008-01-01'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改数据(不带条件修改所有)</span></span><br><span class="line"><span class="keyword">update</span> employee</span><br><span class="line"><span class="keyword">set</span> name <span class="operator">=</span> <span class="string">'张三'</span></span><br><span class="line"><span class="keyword">where</span> id <span class="operator">=</span> <span class="number">1</span>;</span><br><span class="line"><span class="keyword">update</span> employee</span><br><span class="line"><span class="keyword">set</span> name <span class="operator">=</span> <span class="string">'李四'</span>,</span><br><span class="line"> gender<span class="operator">=</span> <span class="string">'女'</span></span><br><span class="line"><span class="keyword">where</span> id <span class="operator">=</span> <span class="number">1</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除数据(删除id为4的数据,不带添加删除所有)</span></span><br><span class="line"><span class="keyword">delete</span></span><br><span class="line"><span class="keyword">from</span> employee</span><br><span class="line"><span class="keyword">where</span> id <span class="operator">=</span> <span class="number">4</span>;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">-- --------------------------------------------------------DQL数据查询语言--------------------------------------------------</span></span><br><span class="line"><span class="comment">-- 数据准备</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> emp</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> comment <span class="string">'编号'</span>,</span><br><span class="line"> workno <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'工号'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> gender <span class="type">char</span>(<span class="number">1</span>) comment <span class="string">'性别'</span>,</span><br><span class="line"> age tinyint unsigned comment <span class="string">'年龄'</span>,</span><br><span class="line"> idcard <span class="type">char</span>(<span class="number">18</span>) comment <span class="string">'身份证号'</span>,</span><br><span class="line"> workaddress <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'工作地址'</span>,</span><br><span class="line"> entrydate <span class="type">date</span> comment <span class="string">'入职时间'</span></span><br><span class="line">) comment <span class="string">'员工表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 插入数据</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> emp(id, workno, name, gender, age, idcard, workaddress, entrydate)</span><br><span class="line"><span class="keyword">values</span> (<span class="number">1</span>, <span class="string">'1'</span>, <span class="string">'柳岩'</span>, <span class="string">'女'</span>, <span class="number">20</span>, <span class="string">'12345678912345678'</span>, <span class="string">'北京'</span>, <span class="string">'2001-01-01'</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'2'</span>, <span class="string">'张无忌'</span>, <span class="string">'男'</span>, <span class="number">18</span>, <span class="string">'123456789012345670'</span>, <span class="string">'北京'</span>, <span class="string">'2005-09-01'</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'3'</span>, <span class="string">'韦一笑'</span>, <span class="string">'男'</span>, <span class="number">38</span>, <span class="string">'12345678972345670'</span>, <span class="string">'上海'</span>, <span class="string">'2005-08-01'</span>),</span><br><span class="line"> (<span class="number">4</span>, <span class="string">'4'</span>, <span class="string">'赵敏'</span>, <span class="string">'女'</span>, <span class="number">18</span>, <span class="string">'12345675712345670'</span>, <span class="string">'北京'</span>, <span class="string">'2009-12-01'</span>),</span><br><span class="line"> (<span class="number">5</span>, <span class="string">'5'</span>, <span class="string">'小昭'</span>, <span class="string">'女'</span>, <span class="number">16</span>, <span class="string">'123456769012345678'</span>, <span class="string">'上海'</span>, <span class="string">'2007-07-01'</span>),</span><br><span class="line"> (<span class="number">6</span>, <span class="string">'6'</span>, <span class="string">'杨逍'</span>, <span class="string">'男'</span>, <span class="number">28</span>, <span class="string">'1234567893123456X'</span>, <span class="string">'北京'</span>, <span class="string">'2006-01-01'</span>),</span><br><span class="line"> (<span class="number">7</span>, <span class="string">'7'</span>, <span class="string">'范瑶'</span>, <span class="string">'男'</span>, <span class="number">40</span>, <span class="string">'123456789212345670'</span>, <span class="string">'北京'</span>, <span class="string">'2005-05-01'</span>),</span><br><span class="line"> (<span class="number">8</span>, <span class="string">'8'</span>, <span class="string">'黛绮丝'</span>, <span class="string">'女'</span>, <span class="number">38</span>, <span class="string">'123456157123645670'</span>, <span class="string">'天津'</span>, <span class="string">'2015-05-01'</span>),</span><br><span class="line"> (<span class="number">9</span>, <span class="string">'9'</span>, <span class="string">'范凉凉'</span>, <span class="string">'女'</span>, <span class="number">45</span>, <span class="string">'123156789012345678'</span>, <span class="string">'北京'</span>, <span class="string">'2010-04-01'</span>),</span><br><span class="line"> (<span class="number">10</span>, <span class="string">'10'</span>, <span class="string">'陈友谅'</span>, <span class="string">'男'</span>, <span class="number">53</span>, <span class="string">'123456789012345670'</span>, <span class="string">'上海'</span>, <span class="string">'2011-01-01'</span>),</span><br><span class="line"> (<span class="number">11</span>, <span class="string">'11'</span>, <span class="string">'张士诚'</span>, <span class="string">'男'</span>, <span class="number">55</span>, <span class="string">'12356789712345670'</span>, <span class="string">'江苏'</span>, <span class="string">'2015-05-01'</span>),</span><br><span class="line"> (<span class="number">12</span>, <span class="string">'12'</span>, <span class="string">'常遇春'</span>, <span class="string">'男'</span>, <span class="number">32</span>, <span class="string">'123446757152345670'</span>, <span class="string">'北京'</span>, <span class="string">'2004-02-01'</span>),</span><br><span class="line"> (<span class="number">13</span>, <span class="string">'13'</span>, <span class="string">'张三丰'</span>, <span class="string">'男'</span>, <span class="number">88</span>, <span class="string">'123656789012345678'</span>, <span class="string">'江苏'</span>, <span class="string">'2020-11-01'</span>),</span><br><span class="line"> (<span class="number">14</span>, <span class="string">'14'</span>, <span class="string">'灭绝'</span>, <span class="string">'女'</span>, <span class="number">65</span>, <span class="string">'123456719012345670'</span>, <span class="string">'西安'</span>, <span class="string">'2019-05-01'</span>),</span><br><span class="line"> (<span class="number">15</span>, <span class="string">'15'</span>, <span class="string">'胡青年'</span>, <span class="string">'男'</span>, <span class="number">70</span>, <span class="string">'12345674971234567X'</span>, <span class="string">'西安'</span>, <span class="string">'2018-04-01'</span>),</span><br><span class="line"> (<span class="number">16</span>, <span class="string">'16'</span>, <span class="string">'周芷若'</span>, <span class="string">'女'</span>, <span class="number">18</span>, <span class="keyword">null</span>, <span class="string">'北京'</span>, <span class="string">'2012-06-01'</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="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询指定字段 name workno age 返回</span></span><br><span class="line"><span class="keyword">select</span> name, workno, age</span><br><span class="line"><span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询所有字段返回</span></span><br><span class="line"><span class="keyword">select</span> id,</span><br><span class="line"> workno,</span><br><span class="line"> name,</span><br><span class="line"> gender,</span><br><span class="line"> age,</span><br><span class="line"> idcard,</span><br><span class="line"> workaddress,</span><br><span class="line"> entrydate</span><br><span class="line"><span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- distinct去重关键字</span></span><br><span class="line"><span class="comment">-- 查询所有员工的工作地址(不要重复的地址)</span></span><br><span class="line"><span class="keyword">select</span> <span class="keyword">distinct</span> workaddress <span class="string">'工作地址'</span></span><br><span class="line"><span class="keyword">from</span> emp;</span><br><span class="line"></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">-- 查询年龄等于 88 的员工</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> age <span class="operator">=</span> <span class="number">88</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄小于20的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> age <span class="operator"><</span> <span class="number">20</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄小于等于20的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> age <span class="operator"><=</span> <span class="number">20</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询没有身份证号的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> idcard <span class="keyword">is</span> <span class="keyword">null</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄不等于88的员工信息(<>也表示不等于)</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> age <span class="operator">!=</span> <span class="number">88</span>;</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> age <span class="operator"><></span> <span class="number">88</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄在15~20(包含)之间的员工信息(三种实现方式)</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> age <span class="operator">>=</span> <span class="number">15</span> <span class="operator">&&</span> age <span class="operator"><=</span> <span class="number">20</span>;</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> age <span class="operator">>=</span> <span class="number">15</span></span><br><span class="line"> <span class="keyword">and</span> age <span class="operator"><=</span> <span class="number">20</span>;</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> age <span class="keyword">between</span> <span class="number">15</span> <span class="keyword">and</span> <span class="number">20</span>;</span><br><span class="line">#包含了<span class="number">15</span>和<span class="number">20</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询性别为女 且年龄小于25岁的员工</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> gender <span class="operator">=</span> <span class="string">'女'</span></span><br><span class="line"> <span class="keyword">and</span> age <span class="operator"><</span> <span class="number">25</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄等于18 或 20 或 48 的员工</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> age <span class="operator">=</span> <span class="number">18</span></span><br><span class="line"> <span class="keyword">or</span> age <span class="operator">=</span> <span class="number">20</span></span><br><span class="line"> <span class="keyword">or</span> age <span class="operator">=</span> <span class="number">48</span>;</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> age <span class="keyword">in</span> (<span class="number">18</span>, <span class="number">20</span>, <span class="number">48</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询姓名为两个字的员工(模糊匹配(_匹配单个字符, %匹配任意个字符))</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> name <span class="keyword">like</span> <span class="string">'__'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询身份证号最后一位是X的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> idcard <span class="keyword">like</span> <span class="string">'%X'</span>;</span><br><span class="line"></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="keyword">select</span> <span class="built_in">count</span>(<span class="operator">*</span>)</span><br><span class="line"><span class="keyword">from</span> emp;</span><br><span class="line"><span class="keyword">select</span> <span class="built_in">count</span>(idcard)</span><br><span class="line"><span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 统计该企业员工的平均年龄</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">avg</span>(age)</span><br><span class="line"><span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 统计该企业员工的最大年龄</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">max</span>(age)</span><br><span class="line"><span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 统计该企业员工的最小年龄</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">min</span>(age)</span><br><span class="line"><span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 统计西安地区员工的年龄之和</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">sum</span>(age)</span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> workaddress <span class="operator">=</span> <span class="string">'西安'</span>;</span><br><span class="line"></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="keyword">select</span> gender, <span class="built_in">count</span>(<span class="operator">*</span>)</span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">group</span> <span class="keyword">by</span> gender;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 根据性别进行分组,统计男性员工和女性员工的平均年龄</span></span><br><span class="line"><span class="keyword">select</span> gender, <span class="built_in">avg</span>(age)</span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">group</span> <span class="keyword">by</span> gender;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询年龄小于45岁的员工,并根据工作地址分组,获取员工数量大于等于3的工作地址(可以使用别名也可以不使用别名)</span></span><br><span class="line"><span class="keyword">select</span> workaddress, <span class="built_in">count</span>(<span class="operator">*</span>) address_count</span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> age <span class="operator"><</span> <span class="number">45</span></span><br><span class="line"><span class="keyword">group</span> <span class="keyword">by</span> workaddress</span><br><span class="line"><span class="keyword">having</span> address_count <span class="operator">>=</span> <span class="number">3</span>;</span><br><span class="line"></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">-- 根据年龄对公司的员工进行升序排序(asc可以省略)</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">order</span> <span class="keyword">by</span> age;</span><br><span class="line"><span class="comment">-- 降序排序</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">order</span> <span class="keyword">by</span> age <span class="keyword">desc</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 根据员工的入职时间降序排序</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">order</span> <span class="keyword">by</span> entrydate <span class="keyword">desc</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 根据员工的年龄升序排序,年龄相同,再按照入职时间进行降序排序</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">order</span> <span class="keyword">by</span> age <span class="keyword">asc</span>, entrydate <span class="keyword">desc</span>;</span><br><span class="line"></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">-- 查询第一页的员工数据,每页显示10条记录</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line">limit <span class="number">0</span>,<span class="number">10</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询第二页数据,每页展示十条数据(起始索引 = (查询页码 - 1)* 每页显示记录数)</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line">limit <span class="number">10</span>,<span class="number">10</span>;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">-- DQL语句案例</span></span><br><span class="line"><span class="comment">-- 查询年龄在20,21,22,23岁的女性员工的信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> gender <span class="operator">=</span> <span class="string">'女'</span></span><br><span class="line"> <span class="keyword">and</span> age <span class="keyword">in</span> (<span class="number">20</span>, <span class="number">21</span>, <span class="number">22</span>, <span class="number">23</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询性别为男,并且年龄再20~40岁(含)以内的姓名为三个字的员工</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> gender <span class="operator">=</span> <span class="string">'男'</span></span><br><span class="line"> <span class="keyword">and</span> (age <span class="keyword">between</span> <span class="number">20</span> <span class="keyword">and</span> <span class="number">40</span>)</span><br><span class="line"> <span class="keyword">and</span> name <span class="keyword">like</span> <span class="string">'___'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 统计员工表中,年龄小于60岁的,男性员工和女性员工的人数</span></span><br><span class="line"><span class="keyword">select</span> gender, <span class="built_in">count</span>(<span class="operator">*</span>)</span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> age <span class="operator"><</span> <span class="number">60</span></span><br><span class="line"><span class="keyword">group</span> <span class="keyword">by</span> gender;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询所有年龄小于等于35岁员工的姓名和年龄,并对查询结果按年龄升序排序,如果年龄相同按照入职时间降序排序</span></span><br><span class="line"><span class="keyword">select</span> name, age</span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> age <span class="operator"><=</span> <span class="number">35</span></span><br><span class="line"><span class="keyword">order</span> <span class="keyword">by</span> age <span class="keyword">asc</span>, entrydate <span class="keyword">desc</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询性别为男,且年龄在20·40岁(含)以内的前五个员工信息,并对查询结果按年龄升序排序,如果年龄相同按照入职时间升序排序</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> gender <span class="operator">=</span> <span class="string">'男'</span></span><br><span class="line"> <span class="keyword">and</span> age <span class="keyword">between</span> <span class="number">20</span> <span class="keyword">and</span> <span class="number">40</span></span><br><span class="line"><span class="keyword">order</span> <span class="keyword">by</span> age, entrydate</span><br><span class="line">limit <span class="number">5</span>;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">-- ---------------------------------------------------DCL--------------------------------------------------</span></span><br><span class="line"><span class="comment">-- 用户管理</span></span><br><span class="line"><span class="comment">-- mysql数据库</span></span><br><span class="line">use mysql;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询所有的用户</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> mysql.user;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 创建用户itcast, 只能够在当前主机localhost访问, 密码123456;</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">user</span> <span class="string">'itcast'</span>@<span class="string">'localhost'</span> identified <span class="keyword">by</span> <span class="string">'123456'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 创建用户heima, 可以在任意主机访问该数据库, 密码123456;</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">user</span> <span class="string">'heima'</span>@<span class="string">'%'</span> identified <span class="keyword">by</span> <span class="string">'123456'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改用户heima的访问密码为1234;</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">user</span> <span class="string">'heima'</span>@<span class="string">'%'</span> identified <span class="keyword">with</span> mysql_native_password <span class="keyword">by</span> <span class="string">'1234'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除 itcast@localhost 用户</span></span><br><span class="line"><span class="keyword">drop</span> <span class="keyword">user</span> <span class="string">'itcast'</span>@<span class="string">'localhost'</span>;</span><br><span class="line"></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">-- 查询权限(查询heima用户的所有权限)</span></span><br><span class="line"><span class="keyword">show</span> grants <span class="keyword">for</span> <span class="string">'heima'</span>@<span class="string">'%'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 授予权限(授予heima用户对数据库itcast的所有权限)</span></span><br><span class="line"><span class="keyword">grant</span> <span class="keyword">all</span> <span class="keyword">on</span> itcast.<span class="operator">*</span> <span class="keyword">to</span> <span class="string">'heima'</span>@<span class="string">'%'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 授予用户所有数据库所有表的所有权限</span></span><br><span class="line"><span class="keyword">grant</span> <span class="keyword">all</span> <span class="keyword">on</span> <span class="operator">*</span>.<span class="operator">*</span> <span class="keyword">to</span> <span class="string">'heima'</span>@<span class="string">'%'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 撤销权限(撤销heima用户在itcast数据库上的所有权限)</span></span><br><span class="line"><span class="keyword">revoke</span> <span class="keyword">all</span> <span class="keyword">on</span> itcast.<span class="operator">*</span> <span class="keyword">from</span> <span class="string">'heima'</span>@<span class="string">'%'</span>;</span><br><span class="line"></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">-- concat函数(字符串拼接)</span></span><br><span class="line"><span class="keyword">select</span> concat(<span class="string">'hello '</span>, <span class="string">'word'</span>);</span><br><span class="line"># hello word</span><br><span class="line"></span><br><span class="line"><span class="comment">-- lower(全部转化成小写)</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">lower</span>(<span class="string">'Hello'</span>);</span><br><span class="line"># hello</span><br><span class="line"></span><br><span class="line"><span class="comment">-- upper(全部转化成大写)</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">upper</span>(<span class="string">'Hello'</span>);</span><br><span class="line"># HELLO</span><br><span class="line"></span><br><span class="line"><span class="comment">-- lpad(左侧填充)</span></span><br><span class="line"><span class="keyword">select</span> lpad(<span class="string">'01'</span>, <span class="number">5</span>, <span class="string">'-'</span>);</span><br><span class="line"># <span class="comment">---01</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- rpad(右侧填充)</span></span><br><span class="line"><span class="keyword">select</span> rpad(<span class="string">'01'</span>, <span class="number">5</span>, <span class="string">'-'</span>);</span><br><span class="line"># <span class="number">01</span><span class="comment">---</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- trim 去除头部和尾部的空格</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">trim</span>(<span class="string">' Hello Mysql '</span>);</span><br><span class="line"># Hello Mysql</span><br><span class="line"></span><br><span class="line"><span class="comment">-- substring 字符串截取</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">substring</span>(<span class="string">'Hello Mysql'</span>, <span class="number">1</span>, <span class="number">5</span>);</span><br><span class="line"># Hello</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 由于业务需求变更,企业员工的工号,统一为5位数,目前不足5位数的全部在前面补0 比如:1号员工的工号应该为00001</span></span><br><span class="line"><span class="keyword">update</span> emp</span><br><span class="line"><span class="keyword">set</span> workno <span class="operator">=</span> lpad(workno, <span class="number">5</span>, <span class="string">'0'</span>);</span><br><span class="line"></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">-- ceil 向上取整</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">ceil</span>(<span class="number">1.5</span>);</span><br><span class="line"># <span class="number">2</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- floor 向下取整</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">floor</span>(<span class="number">1.1</span>);</span><br><span class="line"># <span class="number">1</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- mod 求模运算</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">mod</span>(<span class="number">7</span>, <span class="number">4</span>);</span><br><span class="line"># <span class="number">3</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- rand 随机数(0~1)</span></span><br><span class="line"><span class="keyword">select</span> rand();</span><br><span class="line"></span><br><span class="line"><span class="comment">-- round 四舍五入</span></span><br><span class="line"><span class="keyword">select</span> round(<span class="number">2.345</span>, <span class="number">2</span>);</span><br><span class="line"># <span class="number">2.35</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- 通过数据库函数生成一个的随机的六位验证码</span></span><br><span class="line"><span class="keyword">select</span> lpad(round(rand() <span class="operator">*</span> <span class="number">1000000</span>, <span class="number">0</span>), <span class="number">6</span>, <span class="string">'0'</span>);</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">-- curdate:当前日期</span></span><br><span class="line"><span class="keyword">select</span> curdate();</span><br><span class="line"></span><br><span class="line"><span class="comment">-- curtime:当前时间</span></span><br><span class="line"><span class="keyword">select</span> curtime();</span><br><span class="line"></span><br><span class="line"><span class="comment">-- now:当前日期和时间</span></span><br><span class="line"><span class="keyword">select</span> now();</span><br><span class="line"></span><br><span class="line"><span class="comment">-- YEAR , MONTH , DAY:当前年、月、日</span></span><br><span class="line"><span class="keyword">select</span> <span class="keyword">year</span>(now());</span><br><span class="line"><span class="keyword">select</span> <span class="keyword">month</span>(now());</span><br><span class="line"><span class="keyword">select</span> <span class="keyword">day</span>(now());</span><br><span class="line"></span><br><span class="line"><span class="comment">-- date_add:增加指定的时间间隔</span></span><br><span class="line"><span class="keyword">select</span> date_add(now(), <span class="type">INTERVAL</span> <span class="number">70</span> <span class="keyword">DAY</span>); # 当前的时间往后推<span class="number">70</span>天</span><br><span class="line"><span class="keyword">select</span> date_add(now(), <span class="type">INTERVAL</span> <span class="number">2</span> <span class="keyword">MONTH</span>);</span><br><span class="line">#向后推<span class="number">2</span>个月</span><br><span class="line"></span><br><span class="line"><span class="comment">-- datediff:获取两个日期相差的天数</span></span><br><span class="line"><span class="keyword">select</span> datediff(<span class="string">'2021-12-01'</span>, <span class="string">'2021-10-01'</span>);</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">select</span> name, datediff(curdate(), entrydate) <span class="string">'entrydays'</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">order</span> <span class="keyword">by</span> entrydays <span class="keyword">desc</span>;</span><br><span class="line"></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">-- if 相当java中的三元运算符</span></span><br><span class="line"><span class="keyword">select</span> if(<span class="literal">true</span>, <span class="string">'OK'</span>, <span class="string">'ERROR'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- ifnull 第一个字符串不为空就返回第一个,第一个为空就返回第二个</span></span><br><span class="line"><span class="keyword">select</span> ifnull(<span class="string">'OK'</span>, <span class="string">'DEFAULT'</span>);</span><br><span class="line"><span class="keyword">select</span> ifnull(<span class="keyword">null</span>, <span class="string">'DEFAULT'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- case when then else end</span></span><br><span class="line"><span class="comment">-- 需求: 查询emp表的员工姓名和工作地址 (北京/上海 ----> 一线城市 , 其他 ----> 二线城市)</span></span><br><span class="line"><span class="keyword">select</span> name,</span><br><span class="line"> (<span class="keyword">case</span> workaddress</span><br><span class="line"> <span class="keyword">when</span> <span class="string">'北京'</span> <span class="keyword">then</span> <span class="string">'一线城市'</span></span><br><span class="line"> <span class="keyword">when</span> <span class="string">'上海'</span> <span class="keyword">then</span> <span class="string">'一线城市'</span></span><br><span class="line"> <span class="keyword">else</span></span><br><span class="line"> <span class="string">'二线城市'</span> <span class="keyword">end</span>) <span class="keyword">as</span> <span class="string">'工作地址'</span></span><br><span class="line"><span class="keyword">from</span> emp;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 案例:统计班级各个学员的成绩,展示规则如下:</span></span><br><span class="line"><span class="comment">-- >= 85 展示优秀</span></span><br><span class="line"><span class="comment">-- >= 60 展示及格</span></span><br><span class="line"><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="keyword">create</span> <span class="keyword">table</span> score</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> comment <span class="string">'ID'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">20</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> math <span class="type">int</span> comment <span class="string">'数学'</span>,</span><br><span class="line"> english <span class="type">int</span> comment <span class="string">'英语'</span>,</span><br><span class="line"> chinese <span class="type">int</span> comment <span class="string">'语文'</span></span><br><span class="line">) comment <span class="string">'学员成绩表'</span>;</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> score(id, name, math, english, chinese)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'Tom'</span>, <span class="number">67</span>, <span class="number">88</span>, <span class="number">95</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'Rose'</span>, <span class="number">23</span>, <span class="number">66</span>, <span class="number">90</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'Jack'</span>, <span class="number">56</span>, <span class="number">98</span>, <span class="number">76</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> score;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 案例sql实现</span></span><br><span class="line"><span class="keyword">select</span> id,</span><br><span class="line"> name,</span><br><span class="line"> (<span class="keyword">case</span> <span class="keyword">when</span> math <span class="operator">>=</span> <span class="number">85</span> <span class="keyword">then</span> <span class="string">'优秀'</span> <span class="keyword">when</span> math <span class="operator">>=</span> <span class="number">60</span> <span class="keyword">then</span> <span class="string">'及格'</span> <span class="keyword">else</span> <span class="string">'不及格'</span> <span class="keyword">end</span>)</span><br><span class="line"> <span class="string">'数学'</span>,</span><br><span class="line"> (<span class="keyword">case</span></span><br><span class="line"> <span class="keyword">when</span> english <span class="operator">>=</span> <span class="number">85</span> <span class="keyword">then</span> <span class="string">'优秀'</span></span><br><span class="line"> <span class="keyword">when</span> english <span class="operator">>=</span> <span class="number">60</span> <span class="keyword">then</span> <span class="string">'及格'</span></span><br><span class="line"> <span class="keyword">else</span> <span class="string">'不及格'</span></span><br><span class="line"> <span class="keyword">end</span>) <span class="string">'英语'</span>,</span><br><span class="line"> (<span class="keyword">case</span></span><br><span class="line"> <span class="keyword">when</span> chinese <span class="operator">>=</span> <span class="number">85</span> <span class="keyword">then</span> <span class="string">'优秀'</span></span><br><span class="line"> <span class="keyword">when</span> chinese <span class="operator">>=</span> <span class="number">60</span> <span class="keyword">then</span> <span class="string">'及格'</span></span><br><span class="line"> <span class="keyword">else</span> <span class="string">'不及格'</span></span><br><span class="line"> <span class="keyword">end</span>) <span class="string">'语文'</span></span><br><span class="line"><span class="keyword">from</span> score;</span><br><span class="line"></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">-- id 主键,并且自动增长</span></span><br><span class="line"><span class="comment">-- name 不为空,并且唯一</span></span><br><span class="line"><span class="comment">-- age 大于零,并且小于等于120(8.0以上的数据库才支持)age int check (age > 0 && age <= 120) COMMENT '年龄'</span></span><br><span class="line"><span class="comment">-- status 如果没有指定该值,默认为1</span></span><br><span class="line"><span class="comment">-- gender 无约束</span></span><br><span class="line"><span class="keyword">drop</span> <span class="keyword">table</span> if <span class="keyword">exists</span> <span class="keyword">user</span>;</span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> <span class="keyword">user</span></span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> AUTO_INCREMENT <span class="keyword">PRIMARY</span> KEY COMMENT <span class="string">'ID唯一标识'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) <span class="keyword">NOT</span> <span class="keyword">NULL</span> <span class="keyword">UNIQUE</span> COMMENT <span class="string">'姓名'</span>,</span><br><span class="line"> age <span class="type">int</span> COMMENT <span class="string">'年龄'</span>,</span><br><span class="line"> status <span class="type">char</span>(<span class="number">1</span>) <span class="keyword">default</span> <span class="string">'1'</span> COMMENT <span class="string">'状态'</span>,</span><br><span class="line"> gender <span class="type">char</span>(<span class="number">1</span>) COMMENT <span class="string">'性别'</span></span><br><span class="line">);</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> <span class="keyword">user</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 插入数据</span></span><br><span class="line"><span class="comment">-- name的值不能重复,status的值没有填写的话,将使用的是默认的值</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> <span class="keyword">user</span>(name, age, status, gender)</span><br><span class="line"><span class="keyword">values</span> (<span class="string">'Tom1'</span>, <span class="number">19</span>, <span class="string">'1'</span>, <span class="string">'男'</span>),</span><br><span class="line"> (<span class="string">'Tom2'</span>, <span class="number">29</span>, <span class="string">'1'</span>, <span class="string">'男'</span>),</span><br><span class="line"> (<span class="string">'Tom3'</span>, <span class="number">14</span>, <span class="string">'1'</span>, <span class="string">'男'</span>);</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">create</span> <span class="keyword">table</span> dept</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'ID'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'部门名称'</span></span><br><span class="line">) comment <span class="string">'部门表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> dept (id, name)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'研发部'</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'市场部'</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'财务部'</span>),</span><br><span class="line"> (<span class="number">4</span>, <span class="string">'销售部'</span>),</span><br><span class="line"> (<span class="number">5</span>, <span class="string">'总经办'</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> employee</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'ID'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'姓名'</span>,</span><br><span class="line"> age <span class="type">int</span> comment <span class="string">'年龄'</span>,</span><br><span class="line"> job <span class="type">varchar</span>(<span class="number">20</span>) comment <span class="string">'职位'</span>,</span><br><span class="line"> salary <span class="type">int</span> comment <span class="string">'薪资'</span>,</span><br><span class="line"> entrydate <span class="type">date</span> comment <span class="string">'入职时间'</span>,</span><br><span class="line"> managerid <span class="type">int</span> comment <span class="string">'直属领导ID'</span>,</span><br><span class="line"> dept_id <span class="type">int</span> comment <span class="string">'部门ID'</span></span><br><span class="line">) comment <span class="string">'员工表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> employee (id, name, age, job, salary, entrydate, managerid, dept_id)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'金庸'</span>, <span class="number">66</span>, <span class="string">'总裁'</span>, <span class="number">20000</span>, <span class="string">'2000-01-01'</span>, <span class="keyword">null</span>, <span class="number">5</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'张无忌'</span>, <span class="number">20</span>, <span class="string">'项目经理'</span>, <span class="number">12500</span>, <span class="string">'2005-12-05'</span>, <span class="number">1</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'杨逍'</span>, <span class="number">33</span>, <span class="string">'开发'</span>, <span class="number">8400</span>, <span class="string">'2000-11-03'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">4</span>, <span class="string">'韦一笑'</span>, <span class="number">48</span>, <span class="string">'开发'</span>, <span class="number">11000</span>, <span class="string">'2002-02-05'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">5</span>, <span class="string">'常遇春'</span>, <span class="number">43</span>, <span class="string">'开发'</span>, <span class="number">10500</span>, <span class="string">'2004-09-07'</span>, <span class="number">3</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">6</span>, <span class="string">'小昭'</span>, <span class="number">19</span>, <span class="string">'程序员鼓励师'</span>, <span class="number">6600</span>, <span class="string">'2004-10-12'</span>, <span class="number">2</span>, <span class="number">1</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> dept;</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> employee;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 添加外键 员工表employee的部门id字段关联到部门表的id字段以建立外键约束</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> employee</span><br><span class="line"> <span class="keyword">add</span> <span class="keyword">constraint</span> fk_emp_dept <span class="keyword">foreign</span> key (dept_id) <span class="keyword">references</span> dept (id);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除外键</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> employee</span><br><span class="line"> <span class="keyword">drop</span> <span class="keyword">foreign</span> key fk_emp_dept;</span><br><span class="line"></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">create</span> <span class="keyword">table</span> student</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment <span class="keyword">primary</span> key comment <span class="string">'主键ID'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> <span class="keyword">no</span> <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'学号'</span></span><br><span class="line">) comment <span class="string">'学生表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> student</span><br><span class="line"><span class="keyword">values</span> (<span class="keyword">null</span>, <span class="string">'黛绮丝'</span>, <span class="string">'2000100101'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'谢逊'</span>,</span><br><span class="line"> <span class="string">'2000100102'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'殷天正'</span>, <span class="string">'2000100103'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'韦一笑'</span>, <span class="string">'2000100104'</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> course</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment <span class="keyword">primary</span> key comment <span class="string">'主键ID'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'课程名称'</span></span><br><span class="line">) comment <span class="string">'课程表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> course</span><br><span class="line"><span class="keyword">values</span> (<span class="keyword">null</span>, <span class="string">'Java'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'PHP'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'MySQL'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'Hadoop'</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> student_course</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'主键'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> studentid <span class="type">int</span> <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'学生ID'</span>,</span><br><span class="line"> courseid <span class="type">int</span> <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'课程ID'</span>,</span><br><span class="line"> <span class="keyword">constraint</span> fk_courseid <span class="keyword">foreign</span> key (courseid) <span class="keyword">references</span> course (id),</span><br><span class="line"> <span class="keyword">constraint</span> fk_studentid <span class="keyword">foreign</span> key (studentid) <span class="keyword">references</span> student (id)</span><br><span class="line">) comment <span class="string">'学生课程中间表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> student_course</span><br><span class="line"><span class="keyword">values</span> (<span class="keyword">null</span>, <span class="number">1</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="number">1</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="number">1</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="number">2</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="number">2</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="number">3</span>, <span class="number">4</span>);</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">create</span> <span class="keyword">table</span> tb_user</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment <span class="keyword">primary</span> key comment <span class="string">'主键ID'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> age <span class="type">int</span> comment <span class="string">'年龄'</span>,</span><br><span class="line"> gender <span class="type">char</span>(<span class="number">1</span>) comment <span class="string">'1: 男 , 2: 女'</span>,</span><br><span class="line"> phone <span class="type">char</span>(<span class="number">11</span>) comment <span class="string">'手机号'</span></span><br><span class="line">) comment <span class="string">'用户基本信息表'</span>;</span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> tb_user_edu</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment <span class="keyword">primary</span> key comment <span class="string">'主键ID'</span>,</span><br><span class="line"> degree <span class="type">varchar</span>(<span class="number">20</span>) comment <span class="string">'学历'</span>,</span><br><span class="line"> major <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'专业'</span>,</span><br><span class="line"> primaryschool <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'小学'</span>,</span><br><span class="line"> middleschool <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'中学'</span>,</span><br><span class="line"> university <span class="type">varchar</span>(<span class="number">50</span>) comment <span class="string">'大学'</span>,</span><br><span class="line"> userid <span class="type">int</span> <span class="keyword">unique</span> comment <span class="string">'用户ID'</span>,</span><br><span class="line"> <span class="keyword">constraint</span> fk_userid <span class="keyword">foreign</span> key (userid) <span class="keyword">references</span> tb_user (id)</span><br><span class="line">) comment <span class="string">'用户教育信息表'</span>;</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> tb_user(id, name, age, gender, phone)</span><br><span class="line"><span class="keyword">values</span> (<span class="keyword">null</span>, <span class="string">'黄渤'</span>, <span class="number">45</span>, <span class="string">'1'</span>, <span class="string">'18800001111'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'冰冰'</span>, <span class="number">35</span>, <span class="string">'2'</span>, <span class="string">'18800002222'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'码云'</span>, <span class="number">55</span>, <span class="string">'1'</span>, <span class="string">'18800008888'</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'李彦宏'</span>, <span class="number">50</span>, <span class="string">'1'</span>, <span class="string">'18800009999'</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> tb_user_edu(id, degree, major, primaryschool, middleschool,</span><br><span class="line"> university, userid)</span><br><span class="line"><span class="keyword">values</span> (<span class="keyword">null</span>, <span class="string">'本科'</span>, <span class="string">'舞蹈'</span>, <span class="string">'静安区第一小学'</span>, <span class="string">'静安区第一中学'</span>, <span class="string">'北京舞蹈学院'</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'硕士'</span>, <span class="string">'表演'</span>, <span class="string">'朝阳区第一小学'</span>, <span class="string">'朝阳区第一中学'</span>, <span class="string">'北京电影学院'</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'本科'</span>, <span class="string">'英语'</span>, <span class="string">'杭州市第一小学'</span>, <span class="string">'杭州市第一中学'</span>, <span class="string">'杭州师范大学'</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="keyword">null</span>, <span class="string">'本科'</span>, <span class="string">'应用数学'</span>, <span class="string">'阳泉第一小学'</span>, <span class="string">'阳泉区第一中学'</span>, <span class="string">'清华大学'</span>, <span class="number">4</span>);</span><br><span class="line"></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">-- 创建dept表,并插入数据</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> dept</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'ID'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'部门名称'</span></span><br><span class="line">) comment <span class="string">'部门表'</span>;</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> dept (id, name)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'研发部'</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'市场部'</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'财务部'</span>),</span><br><span class="line"> (<span class="number">4</span>,</span><br><span class="line"> <span class="string">'销售部'</span>),</span><br><span class="line"> (<span class="number">5</span>, <span class="string">'总经办'</span>),</span><br><span class="line"> (<span class="number">6</span>, <span class="string">'人事部'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 创建emp表,并插入数据</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> emp</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> auto_increment comment <span class="string">'ID'</span> <span class="keyword">primary</span> key,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'姓名'</span>,</span><br><span class="line"> age <span class="type">int</span> comment <span class="string">'年龄'</span>,</span><br><span class="line"> job <span class="type">varchar</span>(<span class="number">20</span>) comment <span class="string">'职位'</span>,</span><br><span class="line"> salary <span class="type">int</span> comment <span class="string">'薪资'</span>,</span><br><span class="line"> entrydate <span class="type">date</span> comment <span class="string">'入职时间'</span>,</span><br><span class="line"> managerid <span class="type">int</span> comment <span class="string">'直属领导ID'</span>,</span><br><span class="line"> dept_id <span class="type">int</span> comment <span class="string">'部门ID'</span></span><br><span class="line">) comment <span class="string">'员工表'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 添加外键</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> emp</span><br><span class="line"> <span class="keyword">add</span> <span class="keyword">constraint</span> fk_emp_dept_id <span class="keyword">foreign</span> key (dept_id) <span class="keyword">references</span></span><br><span class="line"> dept (id);</span><br><span class="line"></span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> emp (id, name, age, job, salary, entrydate, managerid, dept_id)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="number">1</span>, <span class="string">'金庸'</span>, <span class="number">66</span>, <span class="string">'总裁'</span>, <span class="number">20000</span>, <span class="string">'2000-01-01'</span>, <span class="keyword">null</span>, <span class="number">5</span>),</span><br><span class="line"> (<span class="number">2</span>, <span class="string">'张无忌'</span>, <span class="number">20</span>, <span class="string">'项目经理'</span>, <span class="number">12500</span>, <span class="string">'2005-12-05'</span>, <span class="number">1</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">3</span>, <span class="string">'杨逍'</span>, <span class="number">33</span>, <span class="string">'开发'</span>, <span class="number">8400</span>, <span class="string">'2000-11-03'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">4</span>, <span class="string">'韦一笑'</span>, <span class="number">48</span>, <span class="string">'开发'</span>, <span class="number">11000</span>, <span class="string">'2002-02-05'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">5</span>, <span class="string">'常遇春'</span>, <span class="number">43</span>, <span class="string">'开发'</span>, <span class="number">10500</span>, <span class="string">'2004-09-07'</span>, <span class="number">3</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">6</span>, <span class="string">'小昭'</span>, <span class="number">19</span>, <span class="string">'程序员鼓励师'</span>, <span class="number">6600</span>, <span class="string">'2004-10-12'</span>, <span class="number">2</span>, <span class="number">1</span>),</span><br><span class="line"> (<span class="number">7</span>, <span class="string">'灭绝'</span>, <span class="number">60</span>, <span class="string">'财务总监'</span>, <span class="number">8500</span>, <span class="string">'2002-09-12'</span>, <span class="number">1</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="number">8</span>, <span class="string">'周芷若'</span>, <span class="number">19</span>, <span class="string">'会计'</span>, <span class="number">48000</span>, <span class="string">'2006-06-02'</span>, <span class="number">7</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="number">9</span>, <span class="string">'丁敏君'</span>, <span class="number">23</span>, <span class="string">'出纳'</span>, <span class="number">5250</span>, <span class="string">'2009-05-13'</span>, <span class="number">7</span>, <span class="number">3</span>),</span><br><span class="line"> (<span class="number">10</span>, <span class="string">'赵敏'</span>, <span class="number">20</span>, <span class="string">'市场部总监'</span>, <span class="number">12500</span>, <span class="string">'2004-10-12'</span>, <span class="number">1</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="number">11</span>, <span class="string">'鹿杖客'</span>, <span class="number">56</span>, <span class="string">'职员'</span>, <span class="number">3750</span>, <span class="string">'2006-10-03'</span>, <span class="number">10</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="number">12</span>, <span class="string">'鹤笔翁'</span>, <span class="number">19</span>, <span class="string">'职员'</span>, <span class="number">3750</span>, <span class="string">'2007-05-09'</span>, <span class="number">10</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="number">13</span>, <span class="string">'方东白'</span>, <span class="number">19</span>, <span class="string">'职员'</span>, <span class="number">5500</span>, <span class="string">'2009-02-12'</span>, <span class="number">10</span>, <span class="number">2</span>),</span><br><span class="line"> (<span class="number">14</span>, <span class="string">'张三丰'</span>, <span class="number">88</span>, <span class="string">'销售总监'</span>, <span class="number">14000</span>, <span class="string">'2004-10-12'</span>, <span class="number">1</span>, <span class="number">4</span>),</span><br><span class="line"> (<span class="number">15</span>, <span class="string">'俞莲舟'</span>, <span class="number">38</span>, <span class="string">'销售'</span>, <span class="number">4600</span>, <span class="string">'2004-10-12'</span>, <span class="number">14</span>, <span class="number">4</span>),</span><br><span class="line"> (<span class="number">16</span>, <span class="string">'宋远桥'</span>, <span class="number">40</span>, <span class="string">'销售'</span>, <span class="number">4600</span>, <span class="string">'2004-10-12'</span>, <span class="number">14</span>, <span class="number">4</span>),</span><br><span class="line"> (<span class="number">17</span>, <span class="string">'陈友谅'</span>, <span class="number">42</span>, <span class="keyword">null</span>, <span class="number">2000</span>, <span class="string">'2011-10-12'</span>, <span class="number">1</span>, <span class="keyword">null</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 多表查询</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp,</span><br><span class="line"> dept</span><br><span class="line"><span class="keyword">where</span> emp.dept_id <span class="operator">=</span> dept.id;</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">-- 表结构: emp , dept</span></span><br><span class="line"><span class="comment">-- 连接条件: emp.dept_id = dept.id</span></span><br><span class="line"><span class="keyword">select</span> e.name, d.name</span><br><span class="line"><span class="keyword">from</span> emp e,</span><br><span class="line"> dept d</span><br><span class="line"><span class="keyword">where</span> e.dept_id <span class="operator">=</span> d.id;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询每一个员工的姓名 , 及关联的部门的名称 (显式内连接实现) --- INNER JOIN ...ON ...</span></span><br><span class="line"><span class="comment">-- 表结构: emp , dept</span></span><br><span class="line"><span class="comment">-- 连接条件: emp.dept_id = dept.id</span></span><br><span class="line"><span class="keyword">select</span> e.name, d.name</span><br><span class="line"><span class="keyword">from</span> emp e</span><br><span class="line"> <span class="keyword">inner</span> <span class="keyword">join</span> dept d <span class="keyword">on</span> e.dept_id <span class="operator">=</span> d.id;</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">-- 查询emp表的所有数据, 和对应的部门信息</span></span><br><span class="line"><span class="comment">-- 由于需求中提到,要查询emp的所有数据,所以是不能内连接查询的,需要考虑使用外连接查询。</span></span><br><span class="line"><span class="comment">-- 表结构: emp, dept</span></span><br><span class="line"><span class="comment">-- 连接条件: emp.dept_id = dept.id</span></span><br><span class="line"><span class="keyword">select</span> e.name, d.name</span><br><span class="line"><span class="keyword">from</span> emp e</span><br><span class="line"> <span class="keyword">left</span> <span class="keyword">join</span> dept d <span class="keyword">on</span> e.dept_id <span class="operator">=</span> d.id;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询dept表的所有数据, 和对应的员工信息(右外连接)</span></span><br><span class="line"><span class="comment">-- 由于需求中提到,要查询dept表的所有数据,所以是不能内连接查询的,需要考虑使用外连接查询</span></span><br><span class="line"><span class="comment">-- 表结构: emp, dept</span></span><br><span class="line"><span class="comment">-- 连接条件: emp.dept_id = dept.id</span></span><br><span class="line"><span class="keyword">select</span> e.name, d.name</span><br><span class="line"><span class="keyword">from</span> emp e</span><br><span class="line"> <span class="keyword">right</span> <span class="keyword">join</span> dept d <span class="keyword">on</span> e.dept_id <span class="operator">=</span> d.id;</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">-- 表结构: emp</span></span><br><span class="line"><span class="comment">-- 技巧:查询的时候看作是两张表</span></span><br><span class="line"><span class="keyword">select</span> e1.name <span class="string">'员工'</span>, e2.name <span class="string">'领导'</span></span><br><span class="line"><span class="keyword">from</span> emp e1,</span><br><span class="line"> emp e2</span><br><span class="line"><span class="keyword">where</span> e1.managerid <span class="operator">=</span> e2.id;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询所有员工 emp 及其领导的名字 emp , 如果员工没有领导, 也需要查询出来</span></span><br><span class="line"><span class="comment">-- 表结构: emp a , emp b</span></span><br><span class="line"><span class="keyword">select</span> e1.name <span class="string">'员工'</span>, e2.name <span class="string">'领导'</span></span><br><span class="line"><span class="keyword">from</span> emp e1</span><br><span class="line"> <span class="keyword">left</span> <span class="keyword">join</span> emp e2 <span class="keyword">on</span> e1.managerid <span class="operator">=</span> e2.id;</span><br><span class="line"></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">-- 将薪资低于 5000 的员工 , 和 年龄大于 50 岁的员工全部查询出来.</span></span><br><span class="line"><span class="comment">-- 当前对于这个需求,我们可以直接使用多条件查询,使用逻辑运算符 or 连接即可,也可以通过union/union all来联合查询</span></span><br><span class="line"><span class="comment">-- 相当于把下面的两条sql的结果拼接在一起(去掉all就可以实现去重)</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp e</span><br><span class="line"><span class="keyword">where</span> e.salary <span class="operator"><</span> <span class="number">5000</span></span><br><span class="line"><span class="keyword">union</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp e</span><br><span class="line"><span class="keyword">where</span> e.age <span class="operator">></span> <span class="number">50</span>;</span><br><span class="line"></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">-- 1.查询 "销售部" 的所有员工信息</span></span><br><span class="line"><span class="comment">-- 1.1 查询销售部的部门id</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp e</span><br><span class="line"><span class="keyword">where</span> e.dept_id <span class="operator">=</span> (<span class="keyword">select</span> id <span class="keyword">from</span> dept d <span class="keyword">where</span> d.name <span class="operator">=</span> <span class="string">'销售部'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询在 "方东白" 入职之后的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp e1</span><br><span class="line"><span class="keyword">where</span> e1.entrydate <span class="operator">></span> (<span class="keyword">select</span> e2.entrydate <span class="keyword">from</span> emp e2 <span class="keyword">where</span> e2.name <span class="operator">=</span> <span class="string">'方东白'</span>);</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="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp e</span><br><span class="line"><span class="keyword">where</span> e.dept_id <span class="keyword">in</span> (<span class="keyword">select</span> id <span class="keyword">from</span> dept <span class="keyword">where</span> dept.name <span class="operator">=</span> <span class="string">'销售部'</span> <span class="keyword">or</span> dept.name <span class="operator">=</span> <span class="string">'市场部'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询比财务部所有人工资都高的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp e</span><br><span class="line"><span class="keyword">where</span> e.salary <span class="operator">></span> <span class="keyword">all</span> (<span class="keyword">select</span> e2.salary <span class="keyword">from</span> emp e2 <span class="keyword">where</span> e2.dept_id <span class="operator">=</span> (<span class="keyword">select</span> id <span class="keyword">from</span> dept <span class="keyword">where</span> dept.name <span class="operator">=</span> <span class="string">'财务部'</span>));</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询比研发部其中任意一人工资高的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp e</span><br><span class="line"><span class="keyword">where</span> e.salary <span class="operator">></span> <span class="keyword">any</span> (<span class="keyword">select</span> e2.salary <span class="keyword">from</span> emp e2 <span class="keyword">where</span> e2.dept_id <span class="operator">=</span> (<span class="keyword">select</span> id <span class="keyword">from</span> dept <span class="keyword">where</span> dept.name <span class="operator">=</span> <span class="string">'研发部'</span>));</span><br><span class="line"></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="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp e2</span><br><span class="line"><span class="keyword">where</span> (e2.salary, e2.managerid) <span class="operator">=</span> (<span class="keyword">select</span> e.salary, e.managerid <span class="keyword">from</span> emp e <span class="keyword">where</span> e.name <span class="operator">=</span> <span class="string">'张无忌'</span>);</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="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp e2</span><br><span class="line"><span class="keyword">where</span> (e2.job, e2.salary) <span class="keyword">in</span> (<span class="keyword">select</span> e.job, e.salary <span class="keyword">from</span> emp e <span class="keyword">where</span> e.name <span class="operator">=</span> <span class="string">'鹿杖客'</span> <span class="keyword">or</span> name <span class="operator">=</span> <span class="string">'宋远桥'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询入职日期是 "2006-01-01" 之后的员工信息 , 及其部门信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> (<span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> emp <span class="keyword">where</span> entrydate <span class="operator">></span> <span class="string">'2006-01-01'</span>) e</span><br><span class="line"> <span class="keyword">left</span> <span class="keyword">join</span> dept d <span class="keyword">on</span> e.dept_id <span class="operator">=</span> d.id;</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="keyword">create</span> <span class="keyword">table</span> salgrade</span><br><span class="line">(</span><br><span class="line"> grade <span class="type">int</span>,</span><br><span class="line"> losal <span class="type">int</span>,</span><br><span class="line"> hisal <span class="type">int</span></span><br><span class="line">) comment <span class="string">'薪资等级表'</span>;</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> salgrade</span><br><span class="line"><span class="keyword">values</span> (<span class="number">1</span>, <span class="number">0</span>, <span class="number">3000</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> salgrade</span><br><span class="line"><span class="keyword">values</span> (<span class="number">2</span>, <span class="number">3001</span>, <span class="number">5000</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> salgrade</span><br><span class="line"><span class="keyword">values</span> (<span class="number">3</span>, <span class="number">5001</span>, <span class="number">8000</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> salgrade</span><br><span class="line"><span class="keyword">values</span> (<span class="number">4</span>, <span class="number">8001</span>, <span class="number">10000</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> salgrade</span><br><span class="line"><span class="keyword">values</span> (<span class="number">5</span>, <span class="number">10001</span>, <span class="number">15000</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> salgrade</span><br><span class="line"><span class="keyword">values</span> (<span class="number">6</span>, <span class="number">15001</span>, <span class="number">20000</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> salgrade</span><br><span class="line"><span class="keyword">values</span> (<span class="number">7</span>, <span class="number">20001</span>, <span class="number">25000</span>);</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> salgrade</span><br><span class="line"><span class="keyword">values</span> (<span class="number">8</span>, <span class="number">25001</span>, <span class="number">30000</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 题解</span></span><br><span class="line"><span class="comment">-- 1.查询员工的姓名、年龄、职位、部门信息(隐式内连接)</span></span><br><span class="line"><span class="keyword">select</span> e.name, e.age, e.job, d.name</span><br><span class="line"><span class="keyword">from</span> emp e,</span><br><span class="line"> dept d</span><br><span class="line"><span class="keyword">where</span> e.dept_id <span class="operator">=</span> d.id;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 2.查询年龄小于30岁的员工的姓名、年龄、职位、部门信息(显式内连接)</span></span><br><span class="line"><span class="keyword">select</span> e.name, e.age, e.job, d.name</span><br><span class="line"><span class="keyword">from</span> emp e</span><br><span class="line"> <span class="keyword">inner</span> <span class="keyword">join</span> dept d <span class="keyword">on</span> e.dept_id <span class="operator">=</span> d.id</span><br><span class="line"><span class="keyword">where</span> e.age <span class="operator"><</span> <span class="number">30</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 3.查询拥有员工的部门id、部门名称</span></span><br><span class="line"><span class="comment">-- 方法一</span></span><br><span class="line"><span class="keyword">select</span> <span class="keyword">distinct</span> d.id, d.name</span><br><span class="line"><span class="keyword">from</span> emp e,</span><br><span class="line"> dept d</span><br><span class="line"><span class="keyword">where</span> e.dept_id <span class="operator">=</span> d.id;</span><br><span class="line"><span class="comment">-- 方法二</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> dept</span><br><span class="line"><span class="keyword">where</span> dept.id <span class="keyword">in</span> (<span class="keyword">select</span> e.dept_id <span class="keyword">from</span> emp e);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 4.查询所有年龄大于40岁的员工,及其归属的部门名称;如果没有员工分配部门,也需要展示出来</span></span><br><span class="line"><span class="keyword">select</span> e.<span class="operator">*</span>, d.name</span><br><span class="line"><span class="keyword">from</span> emp e</span><br><span class="line"> <span class="keyword">left</span> <span class="keyword">join</span> dept d <span class="keyword">on</span> e.dept_id <span class="operator">=</span> d.id</span><br><span class="line"><span class="keyword">where</span> age <span class="operator">></span> <span class="number">40</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 5.查询所有员工的工资等级</span></span><br><span class="line"><span class="keyword">select</span> e.name <span class="string">'姓名'</span>, s.grade <span class="string">'工资等级'</span></span><br><span class="line"><span class="keyword">from</span> emp e,</span><br><span class="line"> salgrade s</span><br><span class="line"><span class="keyword">where</span> e.salary <span class="keyword">between</span> s.losal <span class="keyword">and</span> s.hisal;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 6.查询研发部所有员工的信息已经工资等级</span></span><br><span class="line"><span class="comment">-- 方法一</span></span><br><span class="line"><span class="keyword">select</span> e.<span class="operator">*</span>, s.grade</span><br><span class="line"><span class="keyword">from</span> emp e,</span><br><span class="line"> dept d,</span><br><span class="line"> salgrade s</span><br><span class="line"><span class="keyword">where</span> e.dept_id <span class="operator">=</span> d.id</span><br><span class="line"> <span class="keyword">and</span> (e.salary <span class="keyword">between</span> s.losal <span class="keyword">and</span> s.hisal)</span><br><span class="line"> <span class="keyword">and</span> d.name <span class="operator">=</span> <span class="string">'研发部'</span>;</span><br><span class="line"><span class="comment">-- 方法二</span></span><br><span class="line"><span class="keyword">select</span> e.<span class="operator">*</span>, s.grade</span><br><span class="line"><span class="keyword">from</span> (<span class="keyword">select</span> emp.<span class="operator">*</span></span><br><span class="line"> <span class="keyword">from</span> emp,</span><br><span class="line"> dept</span><br><span class="line"> <span class="keyword">where</span> emp.dept_id <span class="operator">=</span> dept.id</span><br><span class="line"> <span class="keyword">and</span> dept.name <span class="operator">=</span> <span class="string">'研发部'</span>) e,</span><br><span class="line"> salgrade s</span><br><span class="line"><span class="keyword">where</span> e.salary <span class="keyword">between</span> s.losal <span class="keyword">and</span> s.hisal;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 7.查询研发部的平均工资</span></span><br><span class="line"><span class="keyword">select</span> <span class="built_in">avg</span>(e.salary)</span><br><span class="line"><span class="keyword">from</span> emp e,</span><br><span class="line"> dept d</span><br><span class="line"><span class="keyword">where</span> e.dept_id <span class="operator">=</span> d.id</span><br><span class="line"> <span class="keyword">and</span> d.name <span class="operator">=</span> <span class="string">'研发部'</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 8.查询工资比灭绝高的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> salary <span class="operator">></span> (<span class="keyword">select</span> salary <span class="keyword">from</span> emp <span class="keyword">where</span> name <span class="operator">=</span> <span class="string">'灭绝'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 9.查询比平均工资高的员工信息</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp</span><br><span class="line"><span class="keyword">where</span> salary <span class="operator">></span> (<span class="keyword">select</span> <span class="built_in">avg</span>(salary) <span class="keyword">from</span> emp);</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 10.查询低于本部门平均工资的员工</span></span><br><span class="line"><span class="comment">-- 方法一</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp e2</span><br><span class="line"><span class="keyword">where</span> e2.salary <span class="operator"><</span> (<span class="keyword">select</span> <span class="built_in">avg</span>(e1.salary) <span class="keyword">from</span> emp e1 <span class="keyword">where</span> e1.dept_id <span class="operator">=</span> e2.dept_id);</span><br><span class="line"><span class="comment">-- 方法二</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> emp e,</span><br><span class="line"> (<span class="keyword">select</span> dept_id, <span class="built_in">avg</span>(salary) <span class="string">'salavg'</span> <span class="keyword">from</span> emp <span class="keyword">group</span> <span class="keyword">by</span> dept_id) eavg</span><br><span class="line"><span class="keyword">where</span> eavg.dept_id <span class="operator">=</span> e.dept_id</span><br><span class="line"> <span class="keyword">and</span> e.salary <span class="operator"><</span> eavg.salavg;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 11.查询所有的部门信息,并统计部门的员工人数</span></span><br><span class="line"><span class="comment">-- 方法一</span></span><br><span class="line"><span class="keyword">select</span> d.id, d.name, (<span class="keyword">select</span> <span class="built_in">count</span>(<span class="operator">*</span>) <span class="keyword">from</span> emp e <span class="keyword">where</span> e.dept_id <span class="operator">=</span> d.id) <span class="string">'人数'</span></span><br><span class="line"><span class="keyword">from</span> dept d;</span><br><span class="line"><span class="comment">-- 方法二</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">from</span> dept d,</span><br><span class="line"> (<span class="keyword">select</span> e.dept_id, <span class="built_in">count</span>(<span class="operator">*</span>) <span class="string">'人数'</span> <span class="keyword">from</span> emp e <span class="keyword">group</span> <span class="keyword">by</span> e.dept_id) ecount</span><br><span class="line"><span class="keyword">where</span> d.id <span class="operator">=</span> ecount.dept_id;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 12.查询所有学生的选课情况,展示出学生名称,学号,课程名称</span></span><br><span class="line"><span class="keyword">select</span> s.name, s.no, c.name</span><br><span class="line"><span class="keyword">from</span> course c,</span><br><span class="line"> student s,</span><br><span class="line"> student_course sc</span><br><span class="line"><span class="keyword">where</span> c.id <span class="operator">=</span> sc.courseid</span><br><span class="line"> <span class="keyword">and</span> s.id <span class="operator">=</span> sc.studentid;</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="keyword">drop</span> <span class="keyword">table</span> if <span class="keyword">exists</span> account;</span><br><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> account</span><br><span class="line">(</span><br><span class="line"> id <span class="type">int</span> <span class="keyword">primary</span> key AUTO_INCREMENT comment <span class="string">'ID'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">10</span>) comment <span class="string">'姓名'</span>,</span><br><span class="line"> money <span class="keyword">double</span>(<span class="number">10</span>, <span class="number">2</span>) comment <span class="string">'余额'</span></span><br><span class="line">) comment <span class="string">'账户表'</span>;</span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> account(name, money)</span><br><span class="line"><span class="keyword">VALUES</span> (<span class="string">'张三'</span>, <span class="number">2000</span>),</span><br><span class="line"> (<span class="string">'李四'</span>, <span class="number">2000</span>);</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> account;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">-- 转账操作(张三转1000给李四)</span></span><br><span class="line"><span class="comment">-- 1. 查询张三余额</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> account <span class="keyword">where</span> name <span class="operator">=</span> <span class="string">'张三'</span>;</span><br><span class="line"><span class="comment">-- 2. 张三的余额减少1000</span></span><br><span class="line"><span class="keyword">update</span> account <span class="keyword">set</span> money <span class="operator">=</span> money <span class="operator">-</span> <span class="number">1000</span> <span class="keyword">where</span> name <span class="operator">=</span> <span class="string">'张三'</span>;</span><br><span class="line"><span class="comment">-- 3. 李四的余额增加1000</span></span><br><span class="line"><span class="keyword">update</span> account <span class="keyword">set</span> money <span class="operator">=</span> money <span class="operator">+</span> <span class="number">1000</span> <span class="keyword">where</span> name <span class="operator">=</span> <span class="string">'李四'</span>;</span><br><span class="line"></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">start</span> transaction;</span><br><span class="line"><span class="comment">-- 1. 查询张三余额</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> account <span class="keyword">where</span> name <span class="operator">=</span> <span class="string">'张三'</span>;</span><br><span class="line"><span class="comment">-- 2. 张三的余额减少1000</span></span><br><span class="line"><span class="keyword">update</span> account <span class="keyword">set</span> money <span class="operator">=</span> money <span class="operator">-</span> <span class="number">1000</span> <span class="keyword">where</span> name <span class="operator">=</span> <span class="string">'张三'</span>;</span><br><span class="line"><span class="comment">-- 3. 李四的余额增加1000</span></span><br><span class="line"><span class="keyword">update</span> account <span class="keyword">set</span> money <span class="operator">=</span> money <span class="operator">+</span> <span class="number">1000</span> <span class="keyword">where</span> name <span class="operator">=</span> <span class="string">'李四'</span>;</span><br><span class="line"><span class="comment">-- 如果正常执行完毕, 则提交事务</span></span><br><span class="line"><span class="keyword">commit</span>;</span><br><span class="line"><span class="comment">-- 如果执行过程中报错, 则回滚事务</span></span><br><span class="line"><span class="comment">-- rollback;</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h1 id="二-MySql进阶"><a href="#二-MySql进阶" class="headerlink" title="二.MySql进阶"></a>二.MySql进阶</h1><h2 id="1-存储引擎"><a href="#1-存储引擎" class="headerlink" title="1.存储引擎"></a>1.存储引擎</h2><h3 id="1-1-MySql的体系结构"><a href="#1-1-MySql的体系结构" class="headerlink" title="1.1 MySql的体系结构"></a>1.1 MySql的体系结构</h3><p><img src="/pictures/image-20230916152706301.png" alt="image-20230916152706301"></p>
|
||
<p><img src="/pictures/image-20230916152828704.png" alt="image-20230916152828704"></p>
|
||
<h3 id="1-2-存储引擎简介"><a href="#1-2-存储引擎简介" class="headerlink" title="1.2 存储引擎简介"></a>1.2 存储引擎简介</h3><p><strong>简介</strong></p>
|
||
<p> 存储引擎就是存储数据、建立索引、更新/查询数据等技术的实现方式 。存储引擎是基于表的,而不是 基于库的,所以存储引擎也可被称为表类型。我们可以在创建表的时候,来指定选择的存储引擎,如果 没有指定将自动选择默认的存储引擎。</p>
|
||
<p><strong>查询一张数据库表的建表语句</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 查询建表语句</span></span><br><span class="line"><span class="keyword">show</span> <span class="keyword">create</span> <span class="keyword">table</span> book_info;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230916153448893.png" alt="image-20230916153448893"></p>
|
||
<p><strong>建表的时候指定存储引擎的语句</strong></p>
|
||
<p><img src="/pictures/image-20230916153931010.png" alt="image-20230916153931010"></p>
|
||
<h3 id="1-3-存储引擎特点"><a href="#1-3-存储引擎特点" class="headerlink" title="1.3 存储引擎特点"></a>1.3 存储引擎特点</h3><p><img src="/pictures/image-20230916154915533.png" alt="image-20230916154915533"></p>
|
||
<p><img src="/pictures/image-20230916155113863.png" alt="image-20230916155113863"></p>
|
||
<p><img src="/pictures/image-20230916155356755.png" alt="image-20230916155356755"></p>
|
||
<p><img src="/pictures/image-20230916155525548.png" alt="image-20230916155525548"></p>
|
||
<p> <strong>存储引擎的区别</strong></p>
|
||
<p><img src="/pictures/image-20230916155637133.png" alt="image-20230916155637133"></p>
|
||
<h3 id="1-4-存储引擎的选择"><a href="#1-4-存储引擎的选择" class="headerlink" title="1.4 存储引擎的选择"></a>1.4 存储引擎的选择</h3><p> 在选择存储引擎时,应该根据应用系统的特点选择合适的存储引擎。对于复杂的应用系统,还可以根据 实际情况选择多种存储引擎进行组合。 </p>
|
||
<ul>
|
||
<li>InnoDB: 是Mysql的默认存储引擎,支持事务、外键。如果应用对事务的完整性有比较高的要 求,在并发条件下要求数据的一致性,数据操作除了插入和查询之外,还包含很多的更新、删除操 作,那么InnoDB存储引擎是比较合适的选择。 </li>
|
||
<li>MyISAM : 如果应用是以读操作和插入操作为主,只有很少的更新和删除操作,并且对事务的完 整性、并发性要求不是很高,那么选择这个存储引擎是非常合适的。(例如评论的数据、日志相关的数据、电商中足迹相关的数据)</li>
|
||
<li>MEMORY:将所有数据保存在内存中,访问速度快,通常用于临时表及缓存。MEMORY的缺陷就是 对表的大小有限制,太大的表无法缓存在内存中,而且无法保障数据的安全性。</li>
|
||
</ul>
|
||
<p>一句话:项目中绝大多数的时候使用的都是InnoDB</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><h4 id="2-1-1-介绍"><a href="#2-1-1-介绍" class="headerlink" title="2.1.1 介绍"></a>2.1.1 介绍</h4><p> 索引(index)是帮助MySQL高效获取数据的数据结构(有序)。在数据之外,数据库系统还维护着满足特定查找算法的数据结构,这些数据结构以某种方式引用(指向)数据, 这样就可以在这些数据结构上实现高级查找算法,这种数据结构就是索引。</p>
|
||
<h4 id="2-1-2-演示"><a href="#2-1-2-演示" class="headerlink" title="2.1.2 演示"></a>2.1.2 演示</h4><p>注:下面的二叉树并不是一个真实的索引结构,而是一个举例</p>
|
||
<p><img src="/pictures/image-20230916150211012.png" alt="image-20230916150211012"></p>
|
||
<h4 id="2-1-3-优缺点"><a href="#2-1-3-优缺点" class="headerlink" title="2.1.3 优缺点"></a>2.1.3 优缺点</h4><p><img src="/pictures/image-20230916150430708.png" alt="image-20230916150430708"></p>
|
||
<h3 id="2-2-索引结构"><a href="#2-2-索引结构" class="headerlink" title="2.2 索引结构"></a>2.2 索引结构</h3><h4 id="2-2-1-索引的数据结构有哪些"><a href="#2-2-1-索引的数据结构有哪些" class="headerlink" title="2.2.1 索引的数据结构有哪些"></a>2.2.1 索引的数据结构有哪些</h4><p>默认的索引结构是B+树索引结构</p>
|
||
<p><img src="/pictures/image-20230916161524219.png" alt="image-20230916161524219"></p>
|
||
<p><strong>不同类型的存储引擎对不同的索引结构的支持情况</strong></p>
|
||
<p><img src="/pictures/image-20230916161623546.png" alt="image-20230916161623546"></p>
|
||
<h4 id="2-2-2-B-树的索引数据结构"><a href="#2-2-2-B-树的索引数据结构" class="headerlink" title="2.2.2 B+树的索引数据结构"></a>2.2.2 B+树的索引数据结构</h4><p><strong>二叉树和红黑树的不足</strong></p>
|
||
<p><img src="/pictures/image-20230916162305576.png" alt="image-20230916162305576"></p>
|
||
<p><strong>B树</strong></p>
|
||
<p><img src="/pictures/image-20230916163234103.png" alt="image-20230916163234103"></p>
|
||
<p><strong>B+树</strong></p>
|
||
<p><img src="/pictures/image-20230916164042303.png" alt="image-20230916164042303"></p>
|
||
<p><img src="/pictures/image-20230916164314700.png" alt="image-20230916164314700"></p>
|
||
<p><strong>MySql中的B+树结构</strong></p>
|
||
<p><img src="/pictures/image-20230916164500444.png" alt="image-20230916164500444"></p>
|
||
<h4 id="2-2-3-hash的索引数据结构"><a href="#2-2-3-hash的索引数据结构" class="headerlink" title="2.2.3 hash的索引数据结构"></a>2.2.3 hash的索引数据结构</h4><p><img src="/pictures/image-20230916164903702.png" alt="image-20230916164903702"></p>
|
||
<p><img src="/pictures/image-20230916165007465.png" alt="image-20230916165007465"></p>
|
||
<h4 id="2-3-4-思考题"><a href="#2-3-4-思考题" class="headerlink" title="2.3.4 思考题"></a>2.3.4 思考题</h4><h4 id=""><a href="#" class="headerlink" title=""></a><img src="/pictures/image-20230916165329434.png" alt="image-20230916165329434"></h4><h3 id="2-3-索引分类"><a href="#2-3-索引分类" class="headerlink" title="2.3 索引分类"></a>2.3 索引分类</h3><p><img src="/pictures/image-20230916165516779.png" alt="image-20230916165516779"></p>
|
||
<p><img src="/pictures/image-20230916165647255.png" alt="image-20230916165647255"></p>
|
||
<p><img src="/pictures/image-20230916170012664.png" alt="image-20230916170012664"></p>
|
||
<p>当我们要查询name值是Arm的数据的时候,会先通过二级索引查询,然后通过聚集索引查询这一行的信息(回表查询)</p>
|
||
<p><img src="/pictures/image-20230916170421435.png" alt="image-20230916170421435"></p>
|
||
<p><strong>思考题</strong></p>
|
||
<p><img src="/pictures/image-20230916170537693.png" alt="image-20230916170537693"></p>
|
||
<p>第一条的执行效率高,第二条要回表查询(先查询name所在行对应的主键id,然后通过主键id查询这一行的数据)</p>
|
||
<h3 id="2-4-索引语法"><a href="#2-4-索引语法" class="headerlink" title="2.4 索引语法"></a>2.4 索引语法</h3><p><strong>创建|查看|删除语法</strong></p>
|
||
<p><img src="/pictures/image-20230917091746406.png" alt="image-20230917091746406"></p>
|
||
<p><strong>举例</strong></p>
|
||
<p><img src="/pictures/image-20230917093020287.png" alt="image-20230917093020287"></p>
|
||
<h3 id="2-5-SQL性能分析"><a href="#2-5-SQL性能分析" class="headerlink" title="2.5 SQL性能分析"></a>2.5 SQL性能分析</h3><h4 id="2-5-1-SQL执行频率"><a href="#2-5-1-SQL执行频率" class="headerlink" title="2.5.1 SQL执行频率"></a>2.5.1 SQL执行频率</h4><p><img src="/pictures/image-20230917093634100.png" alt="image-20230917093634100"></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 查看系统的状态信息</span></span><br><span class="line"><span class="keyword">show</span> <span class="keyword">global</span> status <span class="keyword">like</span> <span class="string">'Com_______'</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="2-5-2-慢查询日志"><a href="#2-5-2-慢查询日志" class="headerlink" title="2.5.2 慢查询日志"></a>2.5.2 慢查询日志</h4><p><img src="/pictures/image-20230917094314803.png" alt="image-20230917094314803"></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 查询慢查询日志是否开启</span></span><br><span class="line"><span class="keyword">show</span> variables <span class="keyword">like</span> <span class="string">'slow_query_log'</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="2-5-3-profile详情"><a href="#2-5-3-profile详情" class="headerlink" title="2.5.3 profile详情"></a>2.5.3 profile详情</h4><p><img src="/pictures/image-20230917095232011.png" alt="image-20230917095232011"></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 是否支持profile详情功能</span></span><br><span class="line"><span class="keyword">select</span> @<span class="variable">@have_profiling</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查看是否开启该功能</span></span><br><span class="line"><span class="keyword">select</span> @<span class="variable">@profiling</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 开启profile</span></span><br><span class="line"><span class="keyword">set</span> profiling <span class="operator">=</span> <span class="number">1</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230917095320953.png" alt="image-20230917095320953"></p>
|
||
<h4 id="2-5-4-explain执行计划"><a href="#2-5-4-explain执行计划" class="headerlink" title="2.5.4 explain执行计划"></a>2.5.4 explain执行计划</h4><p><img src="/pictures/image-20230917095911304.png" alt="image-20230917095911304"></p>
|
||
<p><img src="/pictures/image-20230917101205097.png" alt="image-20230917101205097"></p>
|
||
<p><img src="/pictures/image-20230917101337147.png" alt="image-20230917101337147"></p>
|
||
<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-20230917141334774.png" alt="image-20230917141334774"></p>
|
||
<p>现在有一个有着10000000数据的表(tb_sku),我们根据sn这一字段查询某一条具体的数据,没有建立索引之前的查询耗费的时间是20多秒,建立索引耗费大约90秒,为sn字段建立索引之后,查询耗费时间大概是零点几秒。</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-20230917142410276.png" alt="image-20230917142410276"></p>
|
||
<p><img src="/pictures/image-20230917142707646.png" alt="image-20230917142707646"></p>
|
||
<h4 id="2-6-3-索引失效的情况"><a href="#2-6-3-索引失效的情况" class="headerlink" title="2.6.3 索引失效的情况"></a>2.6.3 索引失效的情况</h4><p><img src="/pictures/image-20230917142948227.png" alt="image-20230917142948227"></p>
|
||
<p><img src="/pictures/image-20230917143143047.png" alt="image-20230917143143047"></p>
|
||
<p><img src="/pictures/image-20230917143421975.png" alt="image-20230917143421975"></p>
|
||
<p><img src="/pictures/image-20230917143842497.png" alt="image-20230917143842497"></p>
|
||
<p><img src="/pictures/image-20230917144459567.png" alt="image-20230917144459567"></p>
|
||
<h4 id="2-6-4-SQL提示"><a href="#2-6-4-SQL提示" class="headerlink" title="2.6.4 SQL提示"></a>2.6.4 SQL提示</h4><p><img src="/pictures/image-20230917145046280.png" alt="image-20230917145046280"></p>
|
||
<h4 id="2-6-5-覆盖索引"><a href="#2-6-5-覆盖索引" class="headerlink" title="2.6.5 覆盖索引"></a>2.6.5 覆盖索引</h4><p><img src="/pictures/image-20230917145643194.png" alt="image-20230917145643194"></p>
|
||
<h4 id="2-6-6-前缀索引"><a href="#2-6-6-前缀索引" class="headerlink" title="2.6.6 前缀索引"></a>2.6.6 前缀索引</h4><p><img src="/pictures/image-20230917153757773.png" alt="image-20230917153757773"></p>
|
||
<p><img src="/pictures/image-20230917154300147.png" alt="image-20230917154300147"></p>
|
||
<h4 id="2-6-7-单例索引与联合索引的选择问题"><a href="#2-6-7-单例索引与联合索引的选择问题" class="headerlink" title="2.6.7 单例索引与联合索引的选择问题"></a>2.6.7 单例索引与联合索引的选择问题</h4><p><img src="/pictures/image-20230917155017641.png" alt="image-20230917155017641"></p>
|
||
<p><img src="/pictures/image-20230917155223679.png" alt="image-20230917155223679"></p>
|
||
<h3 id="2-7-索引设计原则"><a href="#2-7-索引设计原则" class="headerlink" title="2.7 索引设计原则"></a>2.7 索引设计原则</h3><p><img src="/pictures/image-20230917155748055.png" alt="image-20230917155748055"></p>
|
||
<h2 id="3-SQL优化"><a href="#3-SQL优化" class="headerlink" title="3.SQL优化"></a>3.SQL优化</h2><h3 id="3-1-插入数据的优化"><a href="#3-1-插入数据的优化" class="headerlink" title="3.1 插入数据的优化"></a>3.1 插入数据的优化</h3><p><img src="/pictures/image-20230917181618942.png" alt="image-20230917181618942"></p>
|
||
<p><img src="/pictures/image-20230917181842030.png" alt="image-20230917181842030"></p>
|
||
<p>100万的数据如果使用insert插入的话需要10分钟左右,如果使用文件的方式导入,只需要10多秒。</p>
|
||
<h3 id="3-2-主键优化"><a href="#3-2-主键优化" class="headerlink" title="3.2 主键优化"></a>3.2 主键优化</h3><p><img src="/pictures/image-20230917205500523.png" alt="image-20230917205500523"></p>
|
||
<p><img src="/pictures/image-20230917205636137.png" alt="image-20230917205636137"></p>
|
||
<p><img src="/pictures/image-20230917205833596.png" alt="image-20230917205833596"></p>
|
||
<p><img src="/pictures/image-20230917210112389.png" alt="image-20230917210112389"></p>
|
||
<p><img src="/pictures/image-20230917210303469.png" alt="image-20230917210303469"></p>
|
||
<h3 id="3-3-order-by优化"><a href="#3-3-order-by优化" class="headerlink" title="3.3 order by优化"></a>3.3 order by优化</h3><p><img src="/pictures/image-20230917210730392.png" alt="image-20230917210730392"></p>
|
||
<p><img src="/pictures/image-20230917211254167.png" alt="image-20230917211254167"></p>
|
||
<p><img src="/pictures/image-20230917210616858.png" alt="image-20230917210616858"></p>
|
||
<p><img src="/pictures/image-20230917211543109.png" alt="image-20230917211543109"></p>
|
||
<h3 id="3-4-group-by优化"><a href="#3-4-group-by优化" class="headerlink" title="3.4 group by优化"></a>3.4 group by优化</h3><p><img src="/pictures/image-20230917212026101.png" alt="image-20230917212026101"></p>
|
||
<h3 id="3-5-limit优化"><a href="#3-5-limit优化" class="headerlink" title="3.5 limit优化"></a>3.5 limit优化</h3><p><img src="/pictures/image-20230917212530539.png" alt="image-20230917212530539"></p>
|
||
<h3 id="3-6-count优化"><a href="#3-6-count优化" class="headerlink" title="3.6 count优化"></a>3.6 count优化</h3><p><img src="/pictures/image-20230917212709489.png" alt="image-20230917212709489"></p>
|
||
<p><img src="/pictures/image-20230917213029734.png" alt="image-20230917213029734"></p>
|
||
<p><img src="/pictures/image-20230917213316193.png" alt="image-20230917213316193"></p>
|
||
<h3 id="3-7-update优化"><a href="#3-7-update优化" class="headerlink" title="3.7 update优化"></a>3.7 update优化</h3><p><img src="/pictures/image-20230917213859581.png" alt="image-20230917213859581"></p>
|
||
<h3 id="3-8-总结"><a href="#3-8-总结" class="headerlink" title="3.8 总结"></a>3.8 总结</h3><p><img src="/pictures/image-20230917214424722.png" alt="image-20230917214424722"></p>
|
||
<h2 id="4-视图-存储过程-触发器"><a href="#4-视图-存储过程-触发器" class="headerlink" title="4.视图/存储过程/触发器"></a>4.视图/存储过程/触发器</h2><h3 id="4-1-视图"><a href="#4-1-视图" class="headerlink" title="4.1 视图"></a>4.1 视图</h3><h4 id="4-1-1-视图介绍"><a href="#4-1-1-视图介绍" class="headerlink" title="4.1.1 视图介绍"></a>4.1.1 视图介绍</h4><p> 视图(View)是一种虚拟存在的表。视图中的数据并不在数据库中实际存在,行和列数据来自定义视图的查询中使用的表,并且是在使用视图时动态生成的。通俗的讲,视图只保存了查询的SQL逻辑,不保存查询结果。所以我们在创建视图的时候,主要的工作就落在创建这条SQL查询语句上。</p>
|
||
<h4 id="4-1-2-语法"><a href="#4-1-2-语法" class="headerlink" title="4.1.2 语法"></a>4.1.2 语法</h4><p><strong>创建</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="keyword">CREATE</span> [<span class="keyword">OR</span> REPLACE] <span class="keyword">VIEW</span> 视图名称[(列名列表)] <span class="keyword">AS</span> <span class="keyword">SELECT</span>语句 [ <span class="keyword">WITH</span> [<span class="keyword">CASCADED</span> <span class="operator">|</span> <span class="keyword">LOCAL</span> ] <span class="keyword">CHECK</span> OPTION ]</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>查询</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line">查看创建视图语句:<span class="keyword">SHOW</span> <span class="keyword">CREATE</span> <span class="keyword">VIEW</span> 视图名称;</span><br><span class="line">查看视图数据:<span class="keyword">SELECT</span> <span class="operator">*</span> <span class="keyword">FROM</span> 视图名称 ...... ;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>修改</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line">方式一:<span class="keyword">CREATE</span> [<span class="keyword">OR</span> REPLACE] <span class="keyword">VIEW</span> 视图名称[(列名列表)] <span class="keyword">AS</span> <span class="keyword">SELECT</span>语句 [ <span class="keyword">WITH</span> [ <span class="keyword">CASCADED</span> <span class="operator">|</span> <span class="keyword">LOCAL</span> ] <span class="keyword">CHECK</span> OPTION ]</span><br><span class="line">方式二:<span class="keyword">ALTER</span> <span class="keyword">VIEW</span> 视图名称[(列名列表)] <span class="keyword">AS</span> <span class="keyword">SELECT</span>语句 [ <span class="keyword">WITH</span> [ <span class="keyword">CASCADED</span> <span class="operator">|</span> <span class="keyword">LOCAL</span> ] <span class="keyword">CHECK</span> OPTION ]</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>删除</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="keyword">DROP</span> <span class="keyword">VIEW</span> [IF <span class="keyword">EXISTS</span>] 视图名称 [,视图名称] ...</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>演示示例</strong></p>
|
||
<figure class="highlight sql"><table><tr><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="keyword">create</span> <span class="keyword">or</span> replace <span class="keyword">view</span> stu_v_1 <span class="keyword">as</span> <span class="keyword">select</span> id, name <span class="keyword">from</span> student <span class="keyword">where</span> id <span class="operator"><=</span> <span class="number">10</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查看创建视图的语句</span></span><br><span class="line"><span class="keyword">show</span> <span class="keyword">create</span> <span class="keyword">view</span> stu_v_1;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查看视图数据</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> stu_v_1;</span><br><span class="line"><span class="comment">-- 也可以加上条件</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> stu_v_1 <span class="keyword">where</span> id <span class="operator">=</span> <span class="number">1</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 修改视图的方式(or replace可以实现修改效果)</span></span><br><span class="line"><span class="comment">-- 方式一</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">or</span> replace <span class="keyword">view</span> stu_v_1 <span class="keyword">as</span> <span class="keyword">select</span> id, name, <span class="keyword">no</span> <span class="keyword">from</span> student <span class="keyword">where</span> id <span class="operator"><=</span> <span class="number">10</span>;</span><br><span class="line"><span class="comment">-- 方式二</span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">view</span> stu_v_1 <span class="keyword">as</span> <span class="keyword">select</span> id, name <span class="keyword">from</span> student <span class="keyword">where</span> id <span class="operator"><=</span> <span class="number">10</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除视图</span></span><br><span class="line"><span class="keyword">drop</span> <span class="keyword">view</span> if <span class="keyword">exists</span> stu_v_1;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 通过视图实现插入操作</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">or</span> replace <span class="keyword">view</span> stu_v_1 <span class="keyword">as</span> <span class="keyword">select</span> id, name <span class="keyword">from</span> student <span class="keyword">where</span> id <span class="operator"><=</span> <span class="number">20</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 向视图中添加数据(实际上插入的数据插入到原table表中)</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> stu_v_1 <span class="keyword">values</span>(<span class="number">6</span>,<span class="string">'Tom'</span>);</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="4-1-3-检查选项"><a href="#4-1-3-检查选项" class="headerlink" title="4.1.3 检查选项"></a>4.1.3 检查选项</h4><p> 当使用WITH CHECK OPTION子句创建视图时,MySQL会通过视图检查正在更改的每个行,例如 插入,更新,删除,以使其符合视图的定义。MySQL允许基于另一个视图创建视图,它还会检查依赖视图中的规则以保持一致性。为了确定检查的范围,mysql提供了两个选项: CASCADED 和 LOCAL,默认值为 CASCADED 。</p>
|
||
<p><strong>1.CASCADED</strong> 级联</p>
|
||
<p> 比如,v2视图是基于v1视图的,如果在v2视图创建的时候指定了检查选项为 cascaded,但是v1视图创建时未指定检查选项。 则在执行检查时,不仅会检查v2,还会级联检查v2的关联视图v1。</p>
|
||
<p> <img src="/pictures/image-20231006182938266.png" alt="image-20231006182938266"></p>
|
||
<p><strong>2.LOCAL</strong> 本地</p>
|
||
<p> 比如,v2视图是基于v1视图的,如果在v2视图创建的时候指定了检查选项为 local ,但是v1视图创建时未指定检查选项。 则在执行检查时,知会检查v2,不会检查v2的关联视图v1。</p>
|
||
<p> <img src="/pictures/image-20231006183051143.png" alt="image-20231006183051143"></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 检查选项</span></span><br><span class="line"><span class="comment">-- 添加了检查选项,在插入数据的时候会检查插入的数据是否满足视图创建的条件(创建语句为create or replace view stu_v_1 as select id, name from student where id <= 20;此时插入的数据id要<=20,否则报错)</span></span><br><span class="line"><span class="comment">-- cascaded:插入时会检查是否满足当前视图和依赖的视图的条件</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">or</span> replace <span class="keyword">view</span> stu_v_1 <span class="keyword">as</span> <span class="keyword">select</span> id, name <span class="keyword">from</span> student <span class="keyword">where</span> id <span class="operator"><=</span> <span class="number">20</span> <span class="keyword">with</span> <span class="keyword">cascaded</span> <span class="keyword">check</span> option ;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- local:插入时会检查是否满足当前视图和依赖的视图(定义了检查选项的视图)的条件</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">or</span> replace <span class="keyword">view</span> stu_v_1 <span class="keyword">as</span> <span class="keyword">select</span> id, name <span class="keyword">from</span> student <span class="keyword">where</span> id <span class="operator"><=</span> <span class="number">20</span> <span class="keyword">with</span> <span class="keyword">local</span> <span class="keyword">check</span> option ;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- local和cascaded的区别:</span></span><br><span class="line"><span class="comment">-- local:v2依赖了v1,只有v1也加上了with local check option检查选项,在v2插入数据的时候才会检查v1的条件</span></span><br><span class="line"><span class="comment">-- cascaded:v2依赖了v1,不管v1有没有加上检查选项,在v2插入数据时都会检查v1的条件</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- 重点</span></span><br><span class="line"><span class="comment">-- 1.加不加检查选项的区别</span></span><br><span class="line"><span class="comment">-- 2.with cascaded check option和with local check option的区别</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="4-1-4-视图更新"><a href="#4-1-4-视图更新" class="headerlink" title="4.1.4 视图更新"></a>4.1.4 视图更新</h4><p>要使视图可更新,视图中的行与基础表中的行之间必须存在一对一的关系。如果视图包含以下任何一项,则该视图不可更新:</p>
|
||
<p>A. 聚合函数或窗口函数(SUM()、 MIN()、 MAX()、 COUNT()等)</p>
|
||
<p>B. DISTINCT</p>
|
||
<p>C. GROUP BY</p>
|
||
<p>D. HAVING</p>
|
||
<p>E. UNION 或者 UNION ALL</p>
|
||
<p> <img src="/pictures/image-20231006184725321.png" alt="image-20231006184725321"></p>
|
||
<h4 id="4-1-5-视图作用"><a href="#4-1-5-视图作用" class="headerlink" title="4.1.5 视图作用"></a>4.1.5 视图作用</h4><p><img src="/pictures/image-20231006185121986.png" alt="image-20231006185121986"></p>
|
||
<h4 id="4-1-6-视图案例"><a href="#4-1-6-视图案例" class="headerlink" title="4.1.6 视图案例"></a>4.1.6 视图案例</h4><p>tb_user表结构以及sql语句</p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="keyword">create</span> <span class="keyword">table</span> tb_user(</span><br><span class="line"> id <span class="type">int</span> <span class="keyword">primary</span> key auto_increment comment <span class="string">'主键'</span>,</span><br><span class="line"> name <span class="type">varchar</span>(<span class="number">50</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'用户名'</span>,</span><br><span class="line"> phone <span class="type">varchar</span>(<span class="number">11</span>) <span class="keyword">not</span> <span class="keyword">null</span> comment <span class="string">'手机号'</span>,</span><br><span class="line"> email <span class="type">varchar</span>(<span class="number">100</span>) comment <span class="string">'邮箱'</span>,</span><br><span class="line"> profession <span class="type">varchar</span>(<span class="number">11</span>) comment <span class="string">'专业'</span>,</span><br><span class="line"> age tinyint unsigned comment <span class="string">'年龄'</span>,</span><br><span class="line"> gender <span class="type">char</span>(<span class="number">1</span>) comment <span class="string">'性别 , 1: 男, 2: 女'</span>,</span><br><span class="line"> status <span class="type">char</span>(<span class="number">1</span>) comment <span class="string">'状态'</span>,</span><br><span class="line"> createtime datetime comment <span class="string">'创建时间'</span></span><br><span class="line">) comment <span class="string">'系统用户表'</span>;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'吕布'</span>, <span class="string">'17799990000'</span>, <span class="string">'lvbu666@163.com'</span>, <span class="string">'软件工程'</span>, <span class="number">23</span>, <span class="string">'1'</span>, <span class="string">'6'</span>, <span class="string">'2001-02-02 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'曹操'</span>, <span class="string">'17799990001'</span>, <span class="string">'caocao666@qq.com'</span>, <span class="string">'通讯工程'</span>, <span class="number">33</span>, <span class="string">'1'</span>, <span class="string">'0'</span>, <span class="string">'2001-03-05 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'赵云'</span>, <span class="string">'17799990002'</span>, <span class="string">'17799990@139.com'</span>, <span class="string">'英语'</span>, <span class="number">34</span>, <span class="string">'1'</span>, <span class="string">'2'</span>, <span class="string">'2002-03-02 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'孙悟空'</span>, <span class="string">'17799990003'</span>, <span class="string">'17799990@sina.com'</span>, <span class="string">'工程造价'</span>, <span class="number">54</span>, <span class="string">'1'</span>, <span class="string">'0'</span>, <span class="string">'2001-07-02 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'花木兰'</span>, <span class="string">'17799990004'</span>, <span class="string">'19980729@sina.com'</span>, <span class="string">'软件工程'</span>, <span class="number">23</span>, <span class="string">'2'</span>, <span class="string">'1'</span>, <span class="string">'2001-04-22 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'大乔'</span>, <span class="string">'17799990005'</span>, <span class="string">'daqiao666@sina.com'</span>, <span class="string">'舞蹈'</span>, <span class="number">22</span>, <span class="string">'2'</span>, <span class="string">'0'</span>, <span class="string">'2001-02-07 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'露娜'</span>, <span class="string">'17799990006'</span>, <span class="string">'luna_love@sina.com'</span>, <span class="string">'应用数学'</span>, <span class="number">24</span>, <span class="string">'2'</span>, <span class="string">'0'</span>, <span class="string">'2001-02-08 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'程咬金'</span>, <span class="string">'17799990007'</span>, <span class="string">'chengyaojin@163.com'</span>, <span class="string">'化工'</span>, <span class="number">38</span>, <span class="string">'1'</span>, <span class="string">'5'</span>, <span class="string">'2001-05-23 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'项羽'</span>, <span class="string">'17799990008'</span>, <span class="string">'xiaoyu666@qq.com'</span>, <span class="string">'金属材料'</span>, <span class="number">43</span>, <span class="string">'1'</span>, <span class="string">'0'</span>, <span class="string">'2001-09-18 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'白起'</span>, <span class="string">'17799990009'</span>, <span class="string">'baiqi666@sina.com'</span>, <span class="string">'机械工程及其自动化'</span>, <span class="number">27</span>, <span class="string">'1'</span>, <span class="string">'2'</span>, <span class="string">'2001-08-16 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'韩信'</span>, <span class="string">'17799990010'</span>, <span class="string">'hanxin520@163.com'</span>, <span class="string">'无机非金属材料工程'</span>, <span class="number">27</span>, <span class="string">'1'</span>, <span class="string">'0'</span>, <span class="string">'2001-06-12 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'荆轲'</span>, <span class="string">'17799990011'</span>, <span class="string">'jingke123@163.com'</span>, <span class="string">'会计'</span>, <span class="number">29</span>, <span class="string">'1'</span>, <span class="string">'0'</span>, <span class="string">'2001-05-11 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'兰陵王'</span>, <span class="string">'17799990012'</span>, <span class="string">'lanlinwang666@126.com'</span>, <span class="string">'工程造价'</span>, <span class="number">44</span>, <span class="string">'1'</span>, <span class="string">'1'</span>, <span class="string">'2001-04-09 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'狂铁'</span>, <span class="string">'17799990013'</span>, <span class="string">'kuangtie@sina.com'</span>, <span class="string">'应用数学'</span>, <span class="number">43</span>, <span class="string">'1'</span>, <span class="string">'2'</span>, <span class="string">'2001-04-10 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'貂蝉'</span>, <span class="string">'17799990014'</span>, <span class="string">'84958948374@qq.com'</span>, <span class="string">'软件工程'</span>, <span class="number">40</span>, <span class="string">'2'</span>, <span class="string">'3'</span>, <span class="string">'2001-02-12 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'妲己'</span>, <span class="string">'17799990015'</span>, <span class="string">'2783238293@qq.com'</span>, <span class="string">'软件工程'</span>, <span class="number">31</span>, <span class="string">'2'</span>, <span class="string">'0'</span>, <span class="string">'2001-01-30 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'芈月'</span>, <span class="string">'17799990016'</span>, <span class="string">'xiaomin2001@sina.com'</span>, <span class="string">'工业经济'</span>, <span class="number">35</span>, <span class="string">'2'</span>, <span class="string">'0'</span>, <span class="string">'2000-05-03 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'嬴政'</span>, <span class="string">'17799990017'</span>, <span class="string">'8839434342@qq.com'</span>, <span class="string">'化工'</span>, <span class="number">38</span>, <span class="string">'1'</span>, <span class="string">'1'</span>, <span class="string">'2001-08-08 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'狄仁杰'</span>, <span class="string">'17799990018'</span>, <span class="string">'jujiamlm8166@163.com'</span>, <span class="string">'国际贸易'</span>, <span class="number">30</span>, <span class="string">'1'</span>, <span class="string">'0'</span>, <span class="string">'2007-03-12 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'安琪拉'</span>, <span class="string">'17799990019'</span>, <span class="string">'jdodm1h@126.com'</span>, <span class="string">'城市规划'</span>, <span class="number">51</span>, <span class="string">'2'</span>, <span class="string">'0'</span>, <span class="string">'2001-08-15 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'典韦'</span>, <span class="string">'17799990020'</span>, <span class="string">'ycaunanjian@163.com'</span>, <span class="string">'城市规划'</span>, <span class="number">52</span>, <span class="string">'1'</span>, <span class="string">'2'</span>, <span class="string">'2000-04-12 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'廉颇'</span>, <span class="string">'17799990021'</span>, <span class="string">'lianpo321@126.com'</span>, <span class="string">'土木工程'</span>, <span class="number">19</span>, <span class="string">'1'</span>, <span class="string">'3'</span>, <span class="string">'2002-07-18 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'后羿'</span>, <span class="string">'17799990022'</span>, <span class="string">'altycj2000@139.com'</span>, <span class="string">'城市园林'</span>, <span class="number">20</span>, <span class="string">'1'</span>, <span class="string">'0'</span>, <span class="string">'2002-03-10 00:00:00'</span>);</span><br><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> itcast.tb_user (name, phone, email, profession, age, gender, status, createtime) <span class="keyword">VALUES</span> (<span class="string">'姜子牙'</span>, <span class="string">'17799990023'</span>, <span class="string">'37483844@qq.com'</span>, <span class="string">'工程造价'</span>, <span class="number">29</span>, <span class="string">'1'</span>, <span class="string">'4'</span>, <span class="string">'2003-05-26 00:00:00'</span>);</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>案例</p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 视图案例</span></span><br><span class="line"><span class="comment">-- 为了保证数据库表的安全性,开发人员在操作tb_user表时,只能看到的用户的基本字段,屏蔽手机号和邮箱两个字段</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">view</span> tb_user_view <span class="keyword">as</span> <span class="keyword">select</span> id, name, profession, age, gender, status, createtime <span class="keyword">from</span> tb_user;</span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> tb_user_view;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 查询每个学生所选修的课程(三张表联查),这个功能在很多的业务中都有使用到,为了简化操作,定义一个视图</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">view</span> tb_stu_course_view <span class="keyword">as</span> <span class="keyword">select</span> s.name student_name,s.no,c.name course_name <span class="keyword">from</span> student s, course c, student_course sc <span class="keyword">where</span> s.id <span class="operator">=</span> sc.studentid <span class="keyword">and</span> c.id <span class="operator">=</span> sc.courseid;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-2-存储过程"><a href="#4-2-存储过程" class="headerlink" title="4.2 存储过程"></a>4.2 存储过程</h3><h4 id="4-2-1-介绍"><a href="#4-2-1-介绍" class="headerlink" title="4.2.1 介绍"></a>4.2.1 介绍</h4><p> <img src="/pictures/image-20231006190705216.png" alt="image-20231006190705216"></p>
|
||
<p> <img src="/pictures/image-20231006190743209.png" alt="image-20231006190743209"></p>
|
||
<h4 id="4-2-2-基本语法"><a href="#4-2-2-基本语法" class="headerlink" title="4.2.2 基本语法"></a>4.2.2 基本语法</h4><p><strong>创建</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="keyword">CREATE</span> <span class="keyword">PROCEDURE</span> 存储过程名称 ([ 参数列表 ])</span><br><span class="line"><span class="keyword">BEGIN</span></span><br><span class="line"> <span class="comment">-- SQL语句</span></span><br><span class="line"><span class="keyword">END</span> ;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>调用</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="keyword">CALL</span> 名称 ([ 参数 ]);</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>查看</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> <span class="operator">*</span> <span class="keyword">FROM</span> INFORMATION_SCHEMA.ROUTINES <span class="keyword">WHERE</span> ROUTINE_SCHEMA <span class="operator">=</span> <span class="string">'xxx'</span>; <span class="comment">-- 查询指定数据库的存储过程及状态信息</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">SHOW</span> <span class="keyword">CREATE</span> <span class="keyword">PROCEDURE</span> 存储过程名称 ; <span class="comment">-- 查询某个存储过程的定义</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>删除</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="keyword">DROP</span> <span class="keyword">PROCEDURE</span> [ IF <span class="keyword">EXISTS</span> ] 存储过程名称 ;</span><br></pre></td></tr></table></figure>
|
||
|
||
<blockquote>
|
||
<p>注意:<br>在命令行中,执行创建存储过程的SQL时,需要通过关键字 delimiter 指定SQL语句的结束符</p>
|
||
</blockquote>
|
||
<p><strong>演示示例</strong></p>
|
||
<figure class="highlight sql"><table><tr><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="keyword">create</span> <span class="keyword">procedure</span> p1()</span><br><span class="line"><span class="keyword">begin</span></span><br><span class="line"> <span class="keyword">select</span> <span class="built_in">count</span>(<span class="operator">*</span>) <span class="keyword">from</span> student;</span><br><span class="line"><span class="keyword">end</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 调用</span></span><br><span class="line"><span class="keyword">call</span> p1();</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">-- 查询itcast数据库中定义的存储过程</span></span><br><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> information_schema.ROUTINES <span class="keyword">where</span> ROUTINE_SCHEMA <span class="operator">=</span> <span class="string">'itcast'</span>;</span><br><span class="line"><span class="comment">-- 查询某个存储过程的定义</span></span><br><span class="line"><span class="keyword">SHOW</span> <span class="keyword">CREATE</span> <span class="keyword">PROCEDURE</span> p1 ;</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 删除</span></span><br><span class="line"><span class="keyword">drop</span> <span class="keyword">procedure</span> if <span class="keyword">exists</span> p1;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="4-2-3-变量"><a href="#4-2-3-变量" class="headerlink" title="4.2.3 变量"></a>4.2.3 变量</h4><p>在MySQL中变量分为三种类型: 系统变量、用户定义变量、局部变量</p>
|
||
<h5 id="4-2-3-1-系统变量"><a href="#4-2-3-1-系统变量" class="headerlink" title="4.2.3.1 系统变量"></a>4.2.3.1 系统变量</h5><p>系统变量 是MySQL服务器提供,不是用户定义的,属于服务器层面。分为全局变量(GLOBAL)、会话 变量(SESSION)</p>
|
||
<p>1.查看系统变量</p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="keyword">SHOW</span> [ SESSION <span class="operator">|</span> <span class="keyword">GLOBAL</span> ] VARIABLES ; <span class="comment">-- 查看所有系统变量</span></span><br><span class="line"><span class="keyword">SHOW</span> [ SESSION <span class="operator">|</span> <span class="keyword">GLOBAL</span> ] VARIABLES <span class="keyword">LIKE</span> <span class="string">'......'</span>; <span class="comment">-- 可以通过LIKE模糊匹配方式查找变量</span></span><br><span class="line"><span class="keyword">SELECT</span> @@[SESSION <span class="operator">|</span> <span class="keyword">GLOBAL</span>] 系统变量名; <span class="comment">-- 查看指定变量的值</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.设置系统变量</p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="keyword">SET</span> [ SESSION <span class="operator">|</span> <span class="keyword">GLOBAL</span> ] 系统变量名 <span class="operator">=</span> 值 ;</span><br><span class="line"><span class="keyword">SET</span> @@[SESSION <span class="operator">|</span> <span class="keyword">GLOBAL</span>]系统变量名 <span class="operator">=</span> 值 ;</span><br></pre></td></tr></table></figure>
|
||
|
||
<blockquote>
|
||
<p><strong>注意</strong>:</p>
|
||
<pre><code>如果没有指定SESSION/GLOBAL,默认是SESSION,会话变量
|
||
</code></pre>
|
||
<blockquote>
|
||
<p>1 mysql服务重新启动之后,所设置的全局参数会失效,要想不失效,可以在 /etc/my.cnf 中配置</p>
|
||
</blockquote>
|
||
<p> A. 全局变量(GLOBAL): 全局变量针对于所有的会话</p>
|
||
<p> B. 会话变量(SESSION): 会话变量针对于单个会话,在另外一个会话窗口就不生效了</p>
|
||
</blockquote>
|
||
<p><strong>演示示例</strong></p>
|
||
<figure class="highlight sql"><table><tr><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="keyword">show</span> session variables ; #查看会话的系统变量</span><br><span class="line"><span class="keyword">show</span> <span class="keyword">global</span> variables ; #查看全局的系统变量</span><br><span class="line"><span class="comment">-- 查看以auto开头的系统变量</span></span><br><span class="line"><span class="keyword">show</span> variables <span class="keyword">like</span> <span class="string">'auto%'</span>;</span><br><span class="line"><span class="comment">-- 查看某一个具体的环境变量值(以autocommit为例)</span></span><br><span class="line"><span class="keyword">select</span> @<span class="variable">@autocommit</span>; #会话的</span><br><span class="line"><span class="keyword">select</span> @<span class="variable">@global</span>.autocommit; #全局的</span><br><span class="line"></span><br><span class="line"><span class="comment">-- 设置系统变量(以autocommit为例)</span></span><br><span class="line"><span class="keyword">set</span> session autocommit <span class="operator">=</span> <span class="number">1</span>; #会话级别的</span><br><span class="line"><span class="keyword">set</span> <span class="keyword">global</span> autocommit <span class="operator">=</span> <span class="number">1</span>; #全局级别的</span><br><span class="line"><span class="comment">-- 或者</span></span><br><span class="line"><span class="keyword">set</span> @<span class="variable">@autocommit</span> <span class="operator">=</span> <span class="number">1</span>;</span><br><span class="line"><span class="keyword">set</span> @<span class="variable">@global</span>.autocommit <span class="operator">=</span> <span class="number">1</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="4-2-3-2-用户定义变量"><a href="#4-2-3-2-用户定义变量" class="headerlink" title="4.2.3.2 用户定义变量"></a>4.2.3.2 用户定义变量</h5><p>用户定义变量 是用户根据需要自己定义的变量,用户变量不用提前声明,在用的时候直接用 “@变量 名” 使用就可以。其作用域为当前连接</p>
|
||
<p><strong>1.赋值</strong></p>
|
||
<p>方式一:</p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="keyword">SET</span> <span class="variable">@var_name</span> <span class="operator">=</span> expr [, <span class="variable">@var_name</span> <span class="operator">=</span> expr] ... ;</span><br><span class="line"><span class="keyword">SET</span> <span class="variable">@var_name</span> :<span class="operator">=</span> expr [, <span class="variable">@var_name</span> :<span class="operator">=</span> expr] ... ;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>赋值时,可以使用 = ,也可以使用 := </p>
|
||
<p>方式二:</p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> <span class="variable">@var_name</span> :<span class="operator">=</span> expr [, <span class="variable">@var_name</span> :<span class="operator">=</span> expr] ... ;</span><br><span class="line"><span class="keyword">SELECT</span> 字段名 <span class="keyword">INTO</span> <span class="variable">@var_name</span> <span class="keyword">FROM</span> 表名;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>2.使用</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> <span class="variable">@var_name</span> ;</span><br></pre></td></tr></table></figure>
|
||
|
||
<blockquote>
|
||
<p>注意: 用户定义的变量无需对其进行声明或初始化,只不过获取到的值为NULL</p>
|
||
</blockquote>
|
||
<p><strong>演示示例</strong></p>
|
||
<figure class="highlight sql"><table><tr><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">set</span> <span class="variable">@myname</span> <span class="operator">=</span> <span class="string">'itcast'</span>;</span><br><span class="line"><span class="keyword">set</span> <span class="variable">@myage</span> :<span class="operator">=</span> <span class="number">10</span>;</span><br><span class="line"><span class="keyword">set</span> <span class="variable">@mygender</span> :<span class="operator">=</span> <span class="string">'男'</span>,<span class="variable">@myhobby</span> <span class="operator">=</span> <span class="string">'java'</span>;</span><br><span class="line"><span class="comment">-- 方式二</span></span><br><span class="line"><span class="keyword">select</span> <span class="variable">@mycolor</span> :<span class="operator">=</span> <span class="string">'red'</span>;</span><br><span class="line"><span class="keyword">select</span> <span class="built_in">count</span>(<span class="operator">*</span>) <span class="keyword">into</span> <span class="variable">@mycount</span> <span class="keyword">from</span> tb_user; #将tb_user表中的总记录数赋值给<span class="variable">@mycount</span></span><br><span class="line"></span><br><span class="line"><span class="comment">-- 使用</span></span><br><span class="line"><span class="keyword">select</span> <span class="variable">@myname</span>,<span class="variable">@myage</span>,<span class="variable">@mygender</span>,<span class="variable">@myhobby</span>,<span class="variable">@mycolor</span>,<span class="variable">@mycount</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="4-2-3-3-局部变量"><a href="#4-2-3-3-局部变量" class="headerlink" title="4.2.3.3 局部变量"></a>4.2.3.3 局部变量</h5><p>局部变量 是根据需要定义的在局部生效的变量,访问之前,需要DECLARE声明。可用作存储过程内的 局部变量和输入参数,局部变量的范围是在其内声明的BEGIN … END块</p>
|
||
<p>1**.声明**</p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="keyword">DECLARE</span> 变量名 变量类型 [<span class="keyword">DEFAULT</span> ... ] ;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>变量类型就是数据库字段类型:INT、BIGINT、CHAR、VARCHAR、DATE、TIME等</p>
|
||
<p><strong>2.赋值</strong></p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="keyword">SET</span> 变量名 <span class="operator">=</span> 值 ;</span><br><span class="line"><span class="keyword">SET</span> 变量名 :<span class="operator">=</span> 值 ;</span><br><span class="line"><span class="keyword">SELECT</span> 字段名 <span class="keyword">INTO</span> 变量名 <span class="keyword">FROM</span> 表名 ... ;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>演示示例</strong></p>
|
||
<figure class="highlight sql"><table><tr><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="keyword">create</span> <span class="keyword">procedure</span> p2()</span><br><span class="line"><span class="keyword">begin</span></span><br><span class="line"> # 定义一个<span class="type">int</span>类型的局部变量,默认值是<span class="number">0</span></span><br><span class="line"> <span class="keyword">declare</span> stu_count <span class="type">int</span> <span class="keyword">default</span> <span class="number">0</span>;</span><br><span class="line"> # 给stu_count赋值</span><br><span class="line"> <span class="comment">-- set stu_count = 100;</span></span><br><span class="line"> <span class="keyword">select</span> <span class="built_in">count</span>(<span class="operator">*</span>) <span class="keyword">into</span> stu_count <span class="keyword">from</span> tb_user;</span><br><span class="line"> #输出</span><br><span class="line"> <span class="keyword">select</span> stu_count;</span><br><span class="line"><span class="keyword">end</span>;</span><br><span class="line"><span class="comment">-- 调用函数</span></span><br><span class="line"><span class="keyword">call</span> p2();</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="4-2-4-if判断"><a href="#4-2-4-if判断" class="headerlink" title="4.2.4 if判断"></a>4.2.4 if判断</h4><p><strong>介绍</strong></p>
|
||
<p>if 用于做条件判断,具体的语法结构为:</p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line">IF 条件<span class="number">1</span> <span class="keyword">THEN</span></span><br><span class="line"> .....</span><br><span class="line">ELSEIF 条件<span class="number">2</span> <span class="keyword">THEN</span> <span class="comment">-- 可选</span></span><br><span class="line"> .....</span><br><span class="line"><span class="keyword">ELSE</span> <span class="comment">-- 可选</span></span><br><span class="line"> .....</span><br><span class="line"><span class="keyword">END</span> IF;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>在if条件判断的结构中,ELSE IF 结构可以有多个,也可以没有. ELSE结构可以有,也可以没有.</p>
|
||
<p><strong>案例</strong></p>
|
||
<p>根据定义的分数score变量,判定当前分数对应的分数等级</p>
|
||
<ul>
|
||
<li><p>score >= 85分,等级为优秀</p>
|
||
</li>
|
||
<li><p>score >= 60分 且 score < 85分,等级为及格</p>
|
||
</li>
|
||
<li><p>score < 60分,等级为不及格</p>
|
||
</li>
|
||
</ul>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- if判断</span></span><br><span class="line"><span class="comment">-- 根据定义的分数score变量,判定当前分数对应的分数等级</span></span><br><span class="line"><span class="comment">-- score >= 85分,等级为优秀</span></span><br><span class="line"><span class="comment">-- score >= 60分 且 score < 85分,等级为及格</span></span><br><span class="line"><span class="comment">-- score < 60分,等级为不及格</span></span><br><span class="line"><span class="keyword">drop</span> <span class="keyword">procedure</span> p3;</span><br><span class="line"><span class="keyword">create</span> <span class="keyword">procedure</span> p3()</span><br><span class="line"><span class="keyword">begin</span></span><br><span class="line"> # 先给一个默认值 <span class="number">58</span></span><br><span class="line"> <span class="keyword">declare</span> score <span class="type">int</span> <span class="keyword">default</span> <span class="number">58</span>;</span><br><span class="line"> <span class="keyword">declare</span> <span class="keyword">result</span> <span class="type">varchar</span>(<span class="number">10</span>);</span><br><span class="line"> if score <span class="operator">>=</span> <span class="number">85</span> <span class="keyword">then</span></span><br><span class="line"> <span class="keyword">set</span> <span class="keyword">result</span> :<span class="operator">=</span> <span class="string">'优秀'</span>;</span><br><span class="line"> elseif score <span class="operator">>=</span> <span class="number">60</span> <span class="keyword">then</span></span><br><span class="line"> <span class="keyword">set</span> <span class="keyword">result</span> :<span class="operator">=</span> <span class="string">'及格'</span>;</span><br><span class="line"> <span class="keyword">else</span></span><br><span class="line"> <span class="keyword">set</span> <span class="keyword">result</span> :<span class="operator">=</span> <span class="string">'不及格'</span>;</span><br><span class="line"> <span class="keyword">end</span> if;</span><br><span class="line"> #输出</span><br><span class="line"> <span class="keyword">select</span> <span class="keyword">result</span>;</span><br><span class="line"><span class="keyword">end</span> ;</span><br><span class="line"><span class="comment">-- 调用</span></span><br><span class="line"><span class="keyword">call</span> p3();</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="4-2-5-参数"><a href="#4-2-5-参数" class="headerlink" title="4.2.5 参数"></a>4.2.5 参数</h4><p><strong>介绍</strong></p>
|
||
<p>参数的类型,主要分为以下三种:IN、OUT、INOUT. 具体的含义如下:</p>
|
||
<p><img src="/pictures/image-20231006213944694.png" alt="image-20231006213944694"></p>
|
||
<p>语法</p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="keyword">CREATE</span> <span class="keyword">PROCEDURE</span> 存储过程名称 ([ <span class="keyword">IN</span><span class="operator">/</span><span class="keyword">OUT</span><span class="operator">/</span><span class="keyword">INOUT</span> 参数名 参数类型 ])</span><br><span class="line"><span class="keyword">BEGIN</span></span><br><span class="line"> <span class="comment">-- SQL语句</span></span><br><span class="line"><span class="keyword">END</span> ;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>案例</strong></p>
|
||
<p>1.根据传入的分数score变量,判定当前分数对应的分数等级,并返回</p>
|
||
<ul>
|
||
<li><p>score >= 85分,等级为优秀</p>
|
||
</li>
|
||
<li><p>score >= 60分 且 score < 85分,等级为及格</p>
|
||
</li>
|
||
<li><p>score < 60分,等级为不及格</p>
|
||
</li>
|
||
</ul>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 参数</span></span><br><span class="line"><span class="comment">-- 1.根据传入的分数score变量,判定当前分数对应的分数等级,并返回</span></span><br><span class="line"><span class="comment">-- score >= 85分,等级为优秀</span></span><br><span class="line"><span class="comment">-- score >= 60分 且 score < 85分,等级为及格</span></span><br><span class="line"><span class="comment">-- score < 60分,等级为不及格</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">procedure</span> p4(<span class="keyword">in</span> score <span class="type">int</span>, <span class="keyword">out</span> <span class="keyword">result</span> <span class="type">varchar</span>(<span class="number">10</span>))</span><br><span class="line"><span class="keyword">begin</span></span><br><span class="line"> if score <span class="operator">>=</span> <span class="number">85</span> <span class="keyword">then</span></span><br><span class="line"> <span class="keyword">set</span> <span class="keyword">result</span> :<span class="operator">=</span> <span class="string">'优秀'</span>;</span><br><span class="line"> elseif score <span class="operator">>=</span> <span class="number">60</span> <span class="keyword">then</span></span><br><span class="line"> <span class="keyword">set</span> <span class="keyword">result</span> :<span class="operator">=</span> <span class="string">'及格'</span>;</span><br><span class="line"> <span class="keyword">else</span></span><br><span class="line"> <span class="keyword">set</span> <span class="keyword">result</span> :<span class="operator">=</span> <span class="string">'不及格'</span>;</span><br><span class="line"> <span class="keyword">end</span> if;</span><br><span class="line"><span class="keyword">end</span> ;</span><br><span class="line"><span class="comment">-- 调用</span></span><br><span class="line"><span class="keyword">call</span> p4(<span class="number">88</span>,<span class="variable">@result</span>);</span><br><span class="line"><span class="comment">-- 查看结果</span></span><br><span class="line"><span class="keyword">select</span> <span class="variable">@result</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.将传入的200分制的分数,进行换算,换成百分制,然后返回</p>
|
||
<figure class="highlight sql"><table><tr><td class="code"><pre><span class="line"><span class="comment">-- 2.将传入的200分制的分数,进行换算,换成百分制,然后返回</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">procedure</span> p5(<span class="keyword">inout</span> score <span class="keyword">double</span>)</span><br><span class="line"><span class="keyword">begin</span></span><br><span class="line"> <span class="keyword">set</span> score :<span class="operator">=</span> score <span class="operator">*</span> <span class="number">0.5</span>;</span><br><span class="line"><span class="keyword">end</span>;</span><br><span class="line"><span class="comment">-- 调用(score既是输入又是输出)</span></span><br><span class="line"><span class="keyword">set</span> <span class="variable">@score</span> <span class="operator">=</span> <span class="number">78</span>;</span><br><span class="line"><span class="keyword">call</span> p5(<span class="variable">@score</span>);</span><br><span class="line"><span class="keyword">select</span> <span class="variable">@score</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="4-2-6-case"><a href="#4-2-6-case" class="headerlink" title="4.2.6 case"></a>4.2.6 case</h4>]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>Mysql</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>对象存储服务MinIO</title>
|
||
<url>/posts/36397.html</url>
|
||
<content><![CDATA[<h1 id="一-MinIo基本介绍"><a href="#一-MinIo基本介绍" class="headerlink" title="一.MinIo基本介绍"></a>一.MinIo基本介绍</h1><h2 id="1-简介"><a href="#1-简介" class="headerlink" title="1.简介"></a>1.简介</h2><p> MinIO基于Apache License v2.0开源协议的对象存储服务,可以做为云存储的解决方案用来保存海量的图片,视频,文档。由于采用Golang实现,服务端可以工作在Windows,Linux, OS X和FreeBSD上。配置简单,基本是复制可执行程序,单行命令可以运行起来。MinIO兼容亚马逊<strong>S3云存储服务接口</strong>,非常适合于存储大容量非结构化的数据,例如图片、视频、日志文件、备份数据和容器/虚拟机镜像等,而一个对象文件可以是任意大小,从几kb到最大5T不等。</p>
|
||
<p><strong>S3 ( Simple Storage Service简单存储服务)</strong></p>
|
||
<p>基本概念</p>
|
||
<ul>
|
||
<li>bucket – 类比于文件系统的目录</li>
|
||
<li>Object – 类比文件系统的文件</li>
|
||
<li>Keys – 类比文件名</li>
|
||
</ul>
|
||
<p>官网文档:<a href="http://docs.minio.org.cn/docs/">http://docs.minio.org.cn/docs/</a></p>
|
||
<h2 id="2-特点"><a href="#2-特点" class="headerlink" title="2.特点"></a>2.特点</h2><ul>
|
||
<li><p>数据保护</p>
|
||
<p>Minio使用Minio Erasure Code(纠删码)来防止硬件故障。即便损坏一半以上的driver,但是仍然可以从中恢复。</p>
|
||
</li>
|
||
<li><p>高性能</p>
|
||
<p>作为高性能对象存储,在标准硬件条件下它能达到55GB/s的读、35GB/s的写速率</p>
|
||
</li>
|
||
<li><p>可扩容</p>
|
||
<p>不同MinIO集群可以组成联邦,并形成一个全局的命名空间,并跨越多个数据中心</p>
|
||
</li>
|
||
<li><p>SDK支持</p>
|
||
<p>基于Minio轻量的特点,它得到类似Java、Python或Go等语言的sdk支持</p>
|
||
</li>
|
||
<li><p>有操作页面</p>
|
||
<p>面向用户友好的简单操作界面,非常方便的管理Bucket及里面的文件资源</p>
|
||
</li>
|
||
<li><p>功能简单</p>
|
||
<p>这一设计原则让MinIO不容易出错、更快启动</p>
|
||
</li>
|
||
<li><p>丰富的API</p>
|
||
<p>支持文件资源的分享连接及分享链接的过期策略、存储桶操作、文件列表访问及文件上传下载的基本功能等。</p>
|
||
</li>
|
||
<li><p>文件变化主动通知</p>
|
||
<p>存储桶(Bucket)如果发生改变,比如上传对象和删除对象,可以使用存储桶事件通知机制进行监控,并通过以下方式发布出去:AMQP、MQTT、Elasticsearch、Redis、NATS、MySQL、Kafka、Webhooks等。</p>
|
||
</li>
|
||
</ul>
|
||
<h2 id="3-对象存储方式比较"><a href="#3-对象存储方式比较" class="headerlink" title="3.对象存储方式比较"></a>3.对象存储方式比较</h2><table>
|
||
<thead>
|
||
<tr>
|
||
<th>存储方式</th>
|
||
<th>优点</th>
|
||
<th>缺点</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>服务器磁盘</td>
|
||
<td>开发便捷,成本低</td>
|
||
<td>扩展困难</td>
|
||
</tr>
|
||
<tr>
|
||
<td>分布式文件系统 (如MinIo)</td>
|
||
<td>容易实现扩容</td>
|
||
<td>复杂度高</td>
|
||
</tr>
|
||
<tr>
|
||
<td>第三方存储 (如阿里OSS)</td>
|
||
<td>开发简单,功能强大,免维护</td>
|
||
<td>收费</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<h2 id="4-分布式文件系统比较"><a href="#4-分布式文件系统比较" class="headerlink" title="4.分布式文件系统比较"></a>4.分布式文件系统比较</h2><table>
|
||
<thead>
|
||
<tr>
|
||
<th>存储方式</th>
|
||
<th>优点</th>
|
||
<th>缺点</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>FastDFS</td>
|
||
<td>1,主备服务,高可用 2,支持主从文件,支持自定义扩展名 3,支持动态扩容</td>
|
||
<td>1,没有完备官方文档,近几年没有更新 2,环境搭建较为麻烦</td>
|
||
</tr>
|
||
<tr>
|
||
<td>MinIO</td>
|
||
<td>1,性能高,准硬件条件下它能达到55GB/s的读、35GB/s的写速率 2,部署自带管理界面 3,MinIO.Inc运营的开源项目,社区活跃度高 4,提供了所有主流开发语言的SDK</td>
|
||
<td>1,不支持动态增加节点</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<h1 id="二-MinIo安装教程"><a href="#二-MinIo安装教程" class="headerlink" title="二.MinIo安装教程"></a>二.MinIo安装教程</h1><p>使用Docker的方式安装MInIo,Docker使用教程 <a href="https://qingling.icu/posts/19306.html">https://qingling.icu/posts/19306.html</a></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">拉取minio的镜像</span></span><br><span class="line">docker pull minio/minio</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">设置用户名-e <span class="string">"MINIO_ACCESS_KEY=minio"</span></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">设置密码 -e <span class="string">"MINIO_SECRET_KEY=minio123"</span></span></span><br><span class="line">docker run -p 9000:9000 --name minio -d --restart=always -e "MINIO_ACCESS_KEY=minio" -e "MINIO_SECRET_KEY=minio123" -v /home/data:/data -v /home/config:/root/.minio minio/minio server /data</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>访问: <a href="http://192.168.200.130:9000/">http://192.168.200.130:9000</a> </p>
|
||
<p><img src="/pictures/image-20230818145600002.png" alt="image-20230818145600002"></p>
|
||
<p>Access Key为minio Secret_key 为minio123 进入系统后可以看到主界面</p>
|
||
<p><img src="/pictures/image-20230818145721071.png" alt="image-20230818145721071"></p>
|
||
<h1 id="三-快速入门"><a href="#三-快速入门" class="headerlink" title="三.快速入门"></a>三.快速入门</h1><p><strong>基本概念</strong></p>
|
||
<ul>
|
||
<li>bucket – 类比于文件系统的目录</li>
|
||
<li>Object – 类比文件系统的文件</li>
|
||
<li>Keys – 类比文件名</li>
|
||
</ul>
|
||
<h2 id="1-创建一个bucket"><a href="#1-创建一个bucket" class="headerlink" title="1.创建一个bucket"></a>1.创建一个bucket</h2><p><strong>点击右下角的“+”号 ,创建一个桶</strong></p>
|
||
<p><img src="/pictures/image-20230818150154249.png" alt="image-20230818150154249"></p>
|
||
<p><strong>创建成功后</strong></p>
|
||
<p><img src="/pictures/image-20230818150902795.png" alt="image-20230818150902795"></p>
|
||
<h2 id="2-环境搭建"><a href="#2-环境搭建" class="headerlink" title="2.环境搭建"></a>2.环境搭建</h2><h3 id="2-1-创建一个Demo工程"><a href="#2-1-创建一个Demo工程" class="headerlink" title="2.1 创建一个Demo工程"></a>2.1 创建一个Demo工程</h3><p><img src="/pictures/image-20230818151929679.png" alt="image-20230818151929679"></p>
|
||
<h3 id="2-2-导入依赖和创建启动类"><a href="#2-2-导入依赖和创建启动类" class="headerlink" title="2.2 导入依赖和创建启动类"></a>2.2 导入依赖和创建启动类</h3><p>pom.xml</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependencies</span>></span></span><br><span class="line"> </span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>io.minio<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>minio<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>7.1.0<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-web<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-test<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependencies</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>启动类</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.minio;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.SpringApplication;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.autoconfigure.SpringBootApplication;</span><br><span class="line"></span><br><span class="line"><span class="meta">@SpringBootApplication</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MinIOApplication</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> SpringApplication.run(MinIOApplication.class,args);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="3-测试案例"><a href="#3-测试案例" class="headerlink" title="3.测试案例"></a>3.测试案例</h2><h3 id="3-1-上传文件进行静态访问"><a href="#3-1-上传文件进行静态访问" class="headerlink" title="3.1 上传文件进行静态访问"></a>3.1 上传文件进行静态访问</h3><p><strong>目标:把test.html文件上传到minio中,并且可以在浏览器中访问</strong></p>
|
||
<p>test.html测试文件</p>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"utf-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>Hello World!<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"><span class="tag"><<span class="name">b</span>></span>普通文本 String 展示:<span class="tag"></<span class="name">b</span>></span><span class="tag"><<span class="name">br</span>></span><span class="tag"><<span class="name">br</span>></span></span><br><span class="line">Hello freemarker <span class="tag"><<span class="name">br</span>></span></span><br><span class="line"><span class="tag"><<span class="name">hr</span>></span></span><br><span class="line"><span class="tag"><<span class="name">b</span>></span>对象Student中的数据展示:<span class="tag"></<span class="name">b</span>></span><span class="tag"><<span class="name">br</span>/></span></span><br><span class="line">姓名:小明<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line">年龄:18</span><br><span class="line"><span class="tag"><<span class="name">hr</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>文件上传代码</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.minio;</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 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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/18</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">@SpringBootTest(classes = MinIOApplication.class)</span></span><br><span class="line"><span class="meta">@RunWith(SpringRunner.class)</span></span><br><span class="line"><span class="meta">@Slf4j</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MinIOTest</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 把list.html文件上传到minio中,并且可以在浏览器中访问</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">testMinIO</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">//读取一个文件</span></span><br><span class="line"> <span class="type">FileInputStream</span> <span class="variable">inputStream</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">FileInputStream</span>(<span class="string">"C:\\Gong\\data\\test.html"</span>);</span><br><span class="line"> <span class="comment">//1.获取MinIO的连接信息,创建一个minio的客户端</span></span><br><span class="line"> <span class="type">MinioClient</span> <span class="variable">minioClient</span> <span class="operator">=</span> MinioClient.builder()</span><br><span class="line"> .credentials(<span class="string">"minio"</span>, <span class="string">"minio123"</span>)<span class="comment">//minio的账号密码</span></span><br><span class="line"> .endpoint(<span class="string">"http://192.168.200.130:9000"</span>)<span class="comment">//minio的地址</span></span><br><span class="line"> .build();</span><br><span class="line"> <span class="comment">//2.上传</span></span><br><span class="line"> <span class="type">PutObjectArgs</span> <span class="variable">putObjectArgs</span> <span class="operator">=</span> PutObjectArgs.builder()</span><br><span class="line"> .object(<span class="string">"test.html"</span>)<span class="comment">//文件的名称</span></span><br><span class="line"> .contentType(<span class="string">"text/html"</span>)<span class="comment">//文件的类型</span></span><br><span class="line"> .bucket(<span class="string">"leadnews"</span>)<span class="comment">//桶的名称,与之前的minio管理界面创建的bucket名称一致即可</span></span><br><span class="line"> .stream(inputStream,inputStream.available(),-<span class="number">1</span>)</span><br><span class="line"> .build();</span><br><span class="line"> <span class="comment">//3.访问的路径 minio的访问路径 + 桶的名称 + 文件的名称</span></span><br><span class="line"> log.info(<span class="string">"http://192.168.200.130:9000/leadnews/test.html"</span>);</span><br><span class="line"> minioClient.putObject(putObjectArgs);</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>执行成功之后可以在MinIO中找到该文件</strong></p>
|
||
<p><img src="/pictures/image-20230818154409682.png" alt="image-20230818154409682"></p>
|
||
<p><strong>设置浏览器输入文件在minio中的地址可以直接访问文件的内容</strong></p>
|
||
<p>设置bucket的访问权限</p>
|
||
<p><img src="/pictures/image-20230818154858988.png" alt="image-20230818154858988"></p>
|
||
<p>设置完毕后访问文件的地址可以直接访问到</p>
|
||
<p><img src="/pictures/image-20230818155021308.png" alt="image-20230818155021308"></p>
|
||
<h2 id="4-封装MinIO为Starter-以黑马头条项目为例"><a href="#4-封装MinIO为Starter-以黑马头条项目为例" class="headerlink" title="4.封装MinIO为Starter-以黑马头条项目为例"></a>4.封装MinIO为Starter-以黑马头条项目为例</h2><p>黑马头条项目gitee地址: <a href="https://gitee.com/JasonsGong/heima-leadnews">https://gitee.com/JasonsGong/heima-leadnews</a></p>
|
||
<p>在开发的过程中,有很多模块需要使用到文件服务,我们直接把文件服务封装成一个Starter,方便其余的模块调用</p>
|
||
<p><img src="/pictures/image-20230818155501495.png" alt="image-20230818155501495"></p>
|
||
<h3 id="4-1-创建模块heima-file-starter"><a href="#4-1-创建模块heima-file-starter" class="headerlink" title="4.1 创建模块heima-file-starter"></a>4.1 创建模块heima-file-starter</h3><p>导入依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependencies</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-autoconfigure<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>io.minio<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>minio<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>7.1.0<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-configuration-processor<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">optional</span>></span>true<span class="tag"></<span class="name">optional</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-actuator<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependencies</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-2-配置类"><a href="#4-2-配置类" class="headerlink" title="4.2 配置类"></a>4.2 配置类</h3><p>MinIOConfigProperties</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.file.config;</span><br><span class="line"></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.springframework.boot.context.properties.ConfigurationProperties;</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="meta">@Data</span></span><br><span class="line"><span class="meta">@ConfigurationProperties(prefix = "minio")</span> </span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MinIOConfigProperties</span> <span class="keyword">implements</span> <span class="title class_">Serializable</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String accessKey;</span><br><span class="line"> <span class="keyword">private</span> String secretKey;</span><br><span class="line"> <span class="keyword">private</span> String bucket;</span><br><span class="line"> <span class="keyword">private</span> String endpoint;</span><br><span class="line"> <span class="keyword">private</span> String readPath;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>MinIOConfig</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.file.config;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.heima.file.service.FileStorageService;</span><br><span class="line"><span class="keyword">import</span> io.minio.MinioClient;</span><br><span class="line"><span class="keyword">import</span> lombok.Data;</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.boot.autoconfigure.condition.ConditionalOnClass;</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><br><span class="line"></span><br><span class="line"><span class="meta">@Data</span></span><br><span class="line"><span class="meta">@Configuration</span></span><br><span class="line"><span class="meta">@EnableConfigurationProperties({MinIOConfigProperties.class})</span></span><br><span class="line"><span class="comment">//当引入FileStorageService接口时</span></span><br><span class="line"><span class="meta">@ConditionalOnClass(FileStorageService.class)</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MinIOConfig</span> {</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> MinIOConfigProperties minIOConfigProperties;</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> MinioClient <span class="title function_">buildMinioClient</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> MinioClient</span><br><span class="line"> .builder()</span><br><span class="line"> .credentials(minIOConfigProperties.getAccessKey(), minIOConfigProperties.getSecretKey())</span><br><span class="line"> .endpoint(minIOConfigProperties.getEndpoint())</span><br><span class="line"> .build();</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-3-封装操作minIO类"><a href="#4-3-封装操作minIO类" class="headerlink" title="4.3 封装操作minIO类"></a>4.3 封装操作minIO类</h3><p>FileStorageService</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.file.service;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.InputStream;</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> itheima</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">interface</span> <span class="title class_">FileStorageService</span> {</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 class="doctag">@param</span> prefix 文件前缀</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> filename 文件名</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> inputStream 文件流</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">public</span> String <span class="title function_">uploadImgFile</span><span class="params">(String prefix, String filename,InputStream inputStream)</span>;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 上传html文件</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> prefix 文件前缀</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> filename 文件名</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> inputStream 文件流</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">public</span> String <span class="title function_">uploadHtmlFile</span><span class="params">(String prefix, String filename,InputStream inputStream)</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 class="doctag">@param</span> pathUrl 文件全路径</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">delete</span><span class="params">(String pathUrl)</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 class="doctag">@param</span> pathUrl 文件全路径</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="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="type">byte</span>[] downLoadFile(String pathUrl);</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>MinIOFileStorageService</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.file.service.impl;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.heima.file.config.MinIOConfig;</span><br><span class="line"><span class="keyword">import</span> com.heima.file.config.MinIOConfigProperties;</span><br><span class="line"><span class="keyword">import</span> com.heima.file.service.FileStorageService;</span><br><span class="line"><span class="keyword">import</span> io.minio.GetObjectArgs;</span><br><span class="line"><span class="keyword">import</span> io.minio.MinioClient;</span><br><span class="line"><span class="keyword">import</span> io.minio.PutObjectArgs;</span><br><span class="line"><span class="keyword">import</span> io.minio.RemoveObjectArgs;</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.beans.factory.annotation.Autowired;</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.Import;</span><br><span class="line"><span class="keyword">import</span> org.springframework.util.StringUtils;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.ByteArrayOutputStream;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.io.InputStream;</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><br><span class="line"><span class="meta">@Slf4j</span></span><br><span class="line"><span class="meta">@EnableConfigurationProperties(MinIOConfigProperties.class)</span></span><br><span class="line"><span class="meta">@Import(MinIOConfig.class)</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MinIOFileStorageService</span> <span class="keyword">implements</span> <span class="title class_">FileStorageService</span> {</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> MinioClient minioClient;</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> MinIOConfigProperties minIOConfigProperties;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">final</span> <span class="keyword">static</span> <span class="type">String</span> <span class="variable">separator</span> <span class="operator">=</span> <span class="string">"/"</span>;</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">@param</span> dirPath</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> filename yyyy/mm/dd/file.jpg</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">public</span> String <span class="title function_">builderFilePath</span><span class="params">(String dirPath,String filename)</span> {</span><br><span class="line"> <span class="type">StringBuilder</span> <span class="variable">stringBuilder</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">StringBuilder</span>(<span class="number">50</span>);</span><br><span class="line"> <span class="keyword">if</span>(!StringUtils.isEmpty(dirPath)){</span><br><span class="line"> stringBuilder.append(dirPath).append(separator);</span><br><span class="line"> }</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="string">"yyyy/MM/dd"</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">todayStr</span> <span class="operator">=</span> sdf.format(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"> stringBuilder.append(todayStr).append(separator);</span><br><span class="line"> stringBuilder.append(filename);</span><br><span class="line"> <span class="keyword">return</span> stringBuilder.toString();</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 class="doctag">@param</span> prefix 文件前缀</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> filename 文件名</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> inputStream 文件流</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> String <span class="title function_">uploadImgFile</span><span class="params">(String prefix, String filename,InputStream inputStream)</span> {</span><br><span class="line"> <span class="type">String</span> <span class="variable">filePath</span> <span class="operator">=</span> builderFilePath(prefix, filename);</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">PutObjectArgs</span> <span class="variable">putObjectArgs</span> <span class="operator">=</span> PutObjectArgs.builder()</span><br><span class="line"> .object(filePath)</span><br><span class="line"> .contentType(<span class="string">"image/jpg"</span>)</span><br><span class="line"> .bucket(minIOConfigProperties.getBucket()).stream(inputStream,inputStream.available(),-<span class="number">1</span>)</span><br><span class="line"> .build();</span><br><span class="line"> minioClient.putObject(putObjectArgs);</span><br><span class="line"> <span class="type">StringBuilder</span> <span class="variable">urlPath</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">StringBuilder</span>(minIOConfigProperties.getReadPath());</span><br><span class="line"> urlPath.append(separator+minIOConfigProperties.getBucket());</span><br><span class="line"> urlPath.append(separator);</span><br><span class="line"> urlPath.append(filePath);</span><br><span class="line"> <span class="keyword">return</span> urlPath.toString();</span><br><span class="line"> }<span class="keyword">catch</span> (Exception ex){</span><br><span class="line"> log.error(<span class="string">"minio put file error."</span>,ex);</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"上传文件失败"</span>);</span><br><span class="line"> }</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"> * 上传html文件</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> prefix 文件前缀</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> filename 文件名</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> inputStream 文件流</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> String <span class="title function_">uploadHtmlFile</span><span class="params">(String prefix, String filename,InputStream inputStream)</span> {</span><br><span class="line"> <span class="type">String</span> <span class="variable">filePath</span> <span class="operator">=</span> builderFilePath(prefix, filename);</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">PutObjectArgs</span> <span class="variable">putObjectArgs</span> <span class="operator">=</span> PutObjectArgs.builder()</span><br><span class="line"> .object(filePath)</span><br><span class="line"> .contentType(<span class="string">"text/html"</span>)</span><br><span class="line"> .bucket(minIOConfigProperties.getBucket()).stream(inputStream,inputStream.available(),-<span class="number">1</span>)</span><br><span class="line"> .build();</span><br><span class="line"> minioClient.putObject(putObjectArgs);</span><br><span class="line"> <span class="type">StringBuilder</span> <span class="variable">urlPath</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">StringBuilder</span>(minIOConfigProperties.getReadPath());</span><br><span class="line"> urlPath.append(separator+minIOConfigProperties.getBucket());</span><br><span class="line"> urlPath.append(separator);</span><br><span class="line"> urlPath.append(filePath);</span><br><span class="line"> <span class="keyword">return</span> urlPath.toString();</span><br><span class="line"> }<span class="keyword">catch</span> (Exception ex){</span><br><span class="line"> log.error(<span class="string">"minio put file error."</span>,ex);</span><br><span class="line"> ex.printStackTrace();</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"上传文件失败"</span>);</span><br><span class="line"> }</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 class="doctag">@param</span> pathUrl 文件全路径</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_">delete</span><span class="params">(String pathUrl)</span> {</span><br><span class="line"> <span class="type">String</span> <span class="variable">key</span> <span class="operator">=</span> pathUrl.replace(minIOConfigProperties.getEndpoint()+<span class="string">"/"</span>,<span class="string">""</span>);</span><br><span class="line"> <span class="type">int</span> <span class="variable">index</span> <span class="operator">=</span> key.indexOf(separator);</span><br><span class="line"> <span class="type">String</span> <span class="variable">bucket</span> <span class="operator">=</span> key.substring(<span class="number">0</span>,index);</span><br><span class="line"> <span class="type">String</span> <span class="variable">filePath</span> <span class="operator">=</span> key.substring(index+<span class="number">1</span>);</span><br><span class="line"> <span class="comment">// 删除Objects</span></span><br><span class="line"> <span class="type">RemoveObjectArgs</span> <span class="variable">removeObjectArgs</span> <span class="operator">=</span> RemoveObjectArgs.builder().bucket(bucket).object(filePath).build();</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> minioClient.removeObject(removeObjectArgs);</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> log.error(<span class="string">"minio remove file error. pathUrl:{}"</span>,pathUrl);</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> }</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 class="doctag">@param</span> pathUrl 文件全路径</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="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="type">byte</span>[] downLoadFile(String pathUrl) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">key</span> <span class="operator">=</span> pathUrl.replace(minIOConfigProperties.getEndpoint()+<span class="string">"/"</span>,<span class="string">""</span>);</span><br><span class="line"> <span class="type">int</span> <span class="variable">index</span> <span class="operator">=</span> key.indexOf(separator);</span><br><span class="line"> <span class="type">String</span> <span class="variable">bucket</span> <span class="operator">=</span> key.substring(<span class="number">0</span>,index);</span><br><span class="line"> <span class="type">String</span> <span class="variable">filePath</span> <span class="operator">=</span> key.substring(index+<span class="number">1</span>);</span><br><span class="line"> <span class="type">InputStream</span> <span class="variable">inputStream</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> inputStream = minioClient.getObject(GetObjectArgs.builder().bucket(minIOConfigProperties.getBucket()).object(filePath).build());</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> log.error(<span class="string">"minio down file error. pathUrl:{}"</span>,pathUrl);</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="type">ByteArrayOutputStream</span> <span class="variable">byteArrayOutputStream</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ByteArrayOutputStream</span>();</span><br><span class="line"> <span class="type">byte</span>[] buff = <span class="keyword">new</span> <span class="title class_">byte</span>[<span class="number">100</span>];</span><br><span class="line"> <span class="type">int</span> <span class="variable">rc</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="keyword">if</span> (!((rc = inputStream.read(buff, <span class="number">0</span>, <span class="number">100</span>)) > <span class="number">0</span>)) <span class="keyword">break</span>;</span><br><span class="line"> } <span class="keyword">catch</span> (IOException e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> byteArrayOutputStream.write(buff, <span class="number">0</span>, rc);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> byteArrayOutputStream.toByteArray();</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-4-对外加入自动配置"><a href="#4-4-对外加入自动配置" class="headerlink" title="4.4 对外加入自动配置"></a>4.4 对外加入自动配置</h3><p>在resources中新建<code>META-INF/spring.factories</code></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line">org.springframework.boot.autoconfigure.EnableAutoConfiguration=\</span><br><span class="line"> com.heima.file.service.impl.MinIOFileStorageService</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-5-其他微服务使用"><a href="#4-5-其他微服务使用" class="headerlink" title="4.5 其他微服务使用"></a>4.5 其他微服务使用</h3><p>第一,导入heima-file-starter的依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.heima<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>heima-file-starter<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>1.0-SNAPSHOT<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>第二,在微服务中添加minio所需要的配置</p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">minio:</span></span><br><span class="line"> <span class="attr">accessKey:</span> <span class="string">minio</span></span><br><span class="line"> <span class="attr">secretKey:</span> <span class="string">minio123</span></span><br><span class="line"> <span class="attr">bucket:</span> <span class="string">leadnews</span></span><br><span class="line"> <span class="attr">endpoint:</span> <span class="string">http://192.168.200.130:9000</span></span><br><span class="line"> <span class="attr">readPath:</span> <span class="string">http://192.168.200.130:9000</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>第三,在对应使用的业务类中注入FileStorageService,样例如下:</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Autowired</span></span><br><span class="line"><span class="keyword">private</span> FileStorageService fileStorageService;</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.minio;</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 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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/18</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">@SpringBootTest(classes = MinIOApplication.class)</span></span><br><span class="line"><span class="meta">@RunWith(SpringRunner.class)</span></span><br><span class="line"><span class="meta">@Slf4j</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MinIOTest</span> {</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> FileStorageService fileStorageService;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">testMinIOStarter</span><span class="params">()</span>{</span><br><span class="line"> <span class="comment">//读取一个文件</span></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">FileInputStream</span> <span class="variable">inputStream</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">FileInputStream</span>(<span class="string">"C:\\Gong\\data\\test.html"</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">s</span> <span class="operator">=</span> fileStorageService.uploadHtmlFile(<span class="string">""</span>, <span class="string">"test,html"</span>, inputStream);</span><br><span class="line"> log.info(s);</span><br><span class="line"> } <span class="keyword">catch</span> (FileNotFoundException e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230818165138917.png" alt="image-20230818165138917"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>MinIo</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>FreeMarker模板引擎</title>
|
||
<url>/posts/29367.html</url>
|
||
<content><![CDATA[<h1 id="一-FreeMarker介绍"><a href="#一-FreeMarker介绍" class="headerlink" title="一.FreeMarker介绍"></a>一.FreeMarker介绍</h1><p> FreeMarker 是一款 模板引擎: 即一种基于模板和要改变的数据, 并用来生成输出文本(HTML网页,电子邮件,配置文件,源代码等)的通用工具。 它不是面向最终用户的,而是一个Java类库,是一款程序员可以嵌入他们所开发产品的组件。</p>
|
||
<p> 模板编写为FreeMarker Template Language (FTL)。它是简单的,专用的语言, <em>不是</em> 像PHP那样成熟的编程语言。 那就意味着要准备数据在真实编程语言中来显示,比如数据库查询和业务运算, 之后模板显示已经准备好的数据。在模板中,你可以专注于如何展现数据, 而在模板之外可以专注于要展示什么数据。</p>
|
||
<p><img src="/pictures/image-20230816145012534.png" alt="image-20230816145012534"></p>
|
||
<p><strong>技术选型对比</strong></p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th><strong>技术</strong></th>
|
||
<th><strong>说明</strong></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>Jsp</td>
|
||
<td>Jsp 为 Servlet 专用,不能单独进行使用</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Velocity</td>
|
||
<td>Velocity从2010年更新完 2.0 版本后,7年没有更新。Spring Boot 官方在 1.4 版本后对此也不在支持</td>
|
||
</tr>
|
||
<tr>
|
||
<td>thmeleaf</td>
|
||
<td>新技术,功能较为强大,但是执行的效率比较低</td>
|
||
</tr>
|
||
<tr>
|
||
<td>freemarker</td>
|
||
<td>性能好,强大的模板语言、轻量</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<h1 id="二-快速入门"><a href="#二-快速入门" class="headerlink" title="二.快速入门"></a>二.快速入门</h1><h2 id="1-环境搭建"><a href="#1-环境搭建" class="headerlink" title="1.环境搭建"></a>1.环境搭建</h2><h3 id="1-1-创建一个demo工程"><a href="#1-1-创建一个demo工程" class="headerlink" title="1.1 创建一个demo工程"></a>1.1 创建一个demo工程</h3><p>此处为了方便建的是子模块,测试使用可以创建一个单独的工程</p>
|
||
<p><img src="/pictures/image-20230816145923876.png" alt="image-20230816145923876"></p>
|
||
<h3 id="1-2-引入依赖"><a href="#1-2-引入依赖" class="headerlink" title="1.2 引入依赖"></a>1.2 引入依赖</h3><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependencies</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-web<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-freemarker<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-test<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"> <span class="comment"><!-- lombok --></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.projectlombok<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>lombok<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- apache 对 java io 的封装工具库 --></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.apache.commons<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>commons-io<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>1.3.2<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependencies</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="1-3-添加配置"><a href="#1-3-添加配置" class="headerlink" title="1.3 添加配置"></a>1.3 添加配置</h3><figure class="highlight yaml"><table><tr><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">8881</span> <span class="comment">#服务端口</span></span><br><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">freemarker-demo</span> <span class="comment">#指定服务名</span></span><br><span class="line"> <span class="attr">freemarker:</span></span><br><span class="line"> <span class="attr">cache:</span> <span class="literal">false</span> <span class="comment">#关闭模板缓存,方便测试</span></span><br><span class="line"> <span class="attr">settings:</span></span><br><span class="line"> <span class="attr">template_update_delay:</span> <span class="number">0</span> <span class="comment">#检查模板更新延迟时间,设置为0表示立即检查,如果时间大于0会有缓存不方便进行模板测试</span></span><br><span class="line"> <span class="attr">suffix:</span> <span class="string">.ftl</span> <span class="comment">#指定Freemarker模板文件的后缀名,通常都是以ftl作为扩展名,也可以为html、xml、jsp等!</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="1-4-创建模板"><a href="#1-4-创建模板" class="headerlink" title="1.4 创建模板"></a>1.4 创建模板</h3><p>在resources下创建<strong>templates</strong>,此目录为freemarker的默认模板存放目录</p>
|
||
<p><img src="/pictures/image-20230816150936881.png" alt="image-20230816150936881"></p>
|
||
<p>在templates下创建模板文件 01-basic.ftl ,模板中的<strong>插值表达式</strong>最终会被freemarker替换成具体的数据</p>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"utf-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>Hello World!<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"><span class="tag"><<span class="name">b</span>></span>普通文本 String 展示:<span class="tag"></<span class="name">b</span>></span><span class="tag"><<span class="name">br</span>></span><span class="tag"><<span class="name">br</span>></span></span><br><span class="line">Hello ${name} <span class="tag"><<span class="name">br</span>></span></span><br><span class="line"><span class="tag"><<span class="name">hr</span>></span></span><br><span class="line"><span class="tag"><<span class="name">b</span>></span>对象Student中的数据展示:<span class="tag"></<span class="name">b</span>></span><span class="tag"><<span class="name">br</span>/></span></span><br><span class="line">姓名:${stu.name}<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line">年龄:${stu.age}</span><br><span class="line"><span class="tag"><<span class="name">hr</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="1-5-创建启动类和模型类"><a href="#1-5-创建启动类和模型类" class="headerlink" title="1.5 创建启动类和模型类"></a>1.5 创建启动类和模型类</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.freemarker;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.SpringApplication;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.autoconfigure.SpringBootApplication;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/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">@SpringBootApplication</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">FreeMarkerDemoApplication</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> SpringApplication.run(FreeMarkerDemoApplication.class,args);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.freemarker.entity;</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.Date;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/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">@Data</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Student</span> {</span><br><span class="line"> <span class="keyword">private</span> String name;<span class="comment">//姓名</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span> age;<span class="comment">//年龄</span></span><br><span class="line"> <span class="keyword">private</span> Date birthday;<span class="comment">//生日</span></span><br><span class="line"> <span class="keyword">private</span> Float money;<span class="comment">//钱包</span></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="1-6-创建Controller"><a href="#1-6-创建Controller" class="headerlink" title="1.6 创建Controller"></a>1.6 创建Controller</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.freemarker.controller;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.heima.freemarker.entity.Student;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Controller;</span><br><span class="line"><span class="keyword">import</span> org.springframework.ui.Model;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.GetMapping;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/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">@Controller</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">HelloController</span> {</span><br><span class="line"></span><br><span class="line"> <span class="meta">@GetMapping("/basic")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">test</span><span class="params">(Model model)</span> {</span><br><span class="line"> <span class="comment">//1.纯文本形式的参数</span></span><br><span class="line"> model.addAttribute(<span class="string">"name"</span>, <span class="string">"freemarker"</span>);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//2.实体类相关的参数</span></span><br><span class="line"> <span class="type">Student</span> <span class="variable">student</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Student</span>();</span><br><span class="line"> student.setName(<span class="string">"小明"</span>);</span><br><span class="line"> student.setAge(<span class="number">18</span>);</span><br><span class="line"> model.addAttribute(<span class="string">"stu"</span>, student);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> <span class="string">"01-basic"</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="1-7-测试访问"><a href="#1-7-测试访问" class="headerlink" title="1.7 测试访问"></a>1.7 测试访问</h3><p>访问 <a href="http://localhost:8881/basic">http://localhost:8881/basic</a></p>
|
||
<p><img src="/pictures/image-20230816152750639.png" alt="image-20230816152750639"></p>
|
||
<h1 id="三-FreeMarker语法基础"><a href="#三-FreeMarker语法基础" class="headerlink" title="三.FreeMarker语法基础"></a>三.FreeMarker语法基础</h1><h2 id="1-基础语法种类"><a href="#1-基础语法种类" class="headerlink" title="1.基础语法种类"></a>1.基础语法种类</h2><p> 1、注释,即<#– –>,介于其之间的内容会被freemarker忽略</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><#--我是一个freemarker注释--></span><br></pre></td></tr></table></figure>
|
||
|
||
<p> 2、插值(Interpolation):即 <strong><code>${..}</code></strong> 部分,freemarker会用真实的值代替**<code>${..}</code>**</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">Hello ${name}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p> 3、FTL指令:和HTML标记类似,名字前加#予以区分,Freemarker会解析标签中的表达式或逻辑。</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><# >FTL指令</#> </span><br></pre></td></tr></table></figure>
|
||
|
||
<p> 4、文本,仅文本信息,这些不是freemarker的注释、插值、FTL指令的内容会被freemarker忽略解析,直接输出内容。</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><#--freemarker中的普通文本--></span><br><span class="line">我是一个普通的文本</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="2-集合指令"><a href="#2-集合指令" class="headerlink" title="2.集合指令"></a>2.集合指令</h2><p><img src="/pictures/image-20230816170028648.png" alt="image-20230816170028648"></p>
|
||
<p><img src="/pictures/image-20230816170704421.png" alt="image-20230816170704421"></p>
|
||
<p>1、数据模型:</p>
|
||
<p>在HelloController中新增如下方法:</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@GetMapping("/list")</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">list</span><span class="params">(Model model)</span>{</span><br><span class="line"></span><br><span class="line"> <span class="comment">//------------------------------------</span></span><br><span class="line"> <span class="type">Student</span> <span class="variable">stu1</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Student</span>();</span><br><span class="line"> stu1.setName(<span class="string">"小强"</span>);</span><br><span class="line"> stu1.setAge(<span class="number">18</span>);</span><br><span class="line"> stu1.setMoney(<span class="number">1000.86f</span>);</span><br><span class="line"> stu1.setBirthday(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"></span><br><span class="line"> <span class="comment">//小红对象模型数据</span></span><br><span class="line"> <span class="type">Student</span> <span class="variable">stu2</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Student</span>();</span><br><span class="line"> stu2.setName(<span class="string">"小红"</span>);</span><br><span class="line"> stu2.setMoney(<span class="number">200.1f</span>);</span><br><span class="line"> stu2.setAge(<span class="number">19</span>);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//将两个对象模型数据存放到List集合中</span></span><br><span class="line"> List<Student> stus = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> stus.add(stu1);</span><br><span class="line"> stus.add(stu2);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//向model中存放List集合数据</span></span><br><span class="line"> model.addAttribute(<span class="string">"stus"</span>,stus);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//------------------------------------</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">//创建Map数据</span></span><br><span class="line"> HashMap<String,Student> stuMap = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> stuMap.put(<span class="string">"stu1"</span>,stu1);</span><br><span class="line"> stuMap.put(<span class="string">"stu2"</span>,stu2);</span><br><span class="line"> <span class="comment">// 3.1 向model中存放Map数据</span></span><br><span class="line"> model.addAttribute(<span class="string">"stuMap"</span>, stuMap);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> <span class="string">"02-list"</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2、模板:</p>
|
||
<p>在templates中新增<code>02-list.ftl</code>文件</p>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"utf-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>Hello World!<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> </span><br><span class="line"><#-- list 数据的展示 --></span><br><span class="line"><span class="tag"><<span class="name">b</span>></span>展示list中的stu数据:<span class="tag"></<span class="name">b</span>></span></span><br><span class="line"><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"><span class="tag"><<span class="name">table</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">tr</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>序号<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>姓名<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>年龄<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>钱包<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">tr</span>></span></span><br><span class="line"><span class="tag"></<span class="name">table</span>></span></span><br><span class="line"><span class="tag"><<span class="name">hr</span>></span></span><br><span class="line"> </span><br><span class="line"><#-- Map 数据的展示 --></span><br><span class="line"><span class="tag"><<span class="name">b</span>></span>map数据的展示:<span class="tag"></<span class="name">b</span>></span></span><br><span class="line"><span class="tag"><<span class="name">br</span>/></span><span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"><span class="tag"><<span class="name">a</span> <span class="attr">href</span>=<span class="string">"###"</span>></span>方式一:通过map['keyname'].property<span class="tag"></<span class="name">a</span>></span><span class="tag"><<span class="name">br</span>/></span></span><br><span class="line">输出stu1的学生信息:<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line">姓名:<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line">年龄:<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"><span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"><span class="tag"><<span class="name">a</span> <span class="attr">href</span>=<span class="string">"###"</span>></span>方式二:通过map.keyname.property<span class="tag"></<span class="name">a</span>></span><span class="tag"><<span class="name">br</span>/></span></span><br><span class="line">输出stu2的学生信息:<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line">姓名:<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line">年龄:<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"><span class="tag"><<span class="name">a</span> <span class="attr">href</span>=<span class="string">"###"</span>></span>遍历map中两个学生信息:<span class="tag"></<span class="name">a</span>></span><span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"><span class="tag"><<span class="name">table</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">tr</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>序号<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>姓名<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>年龄<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>钱包<span class="tag"></<span class="name">td</span>></span> </span><br><span class="line"> <span class="tag"></<span class="name">tr</span>></span></span><br><span class="line"><span class="tag"></<span class="name">table</span>></span></span><br><span class="line"><span class="tag"><<span class="name">hr</span>></span></span><br><span class="line"> </span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>实例代码:</p>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"utf-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>Hello World!<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> </span><br><span class="line"><#-- list 数据的展示 --></span><br><span class="line"><span class="tag"><<span class="name">b</span>></span>展示list中的stu数据:<span class="tag"></<span class="name">b</span>></span></span><br><span class="line"><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"><span class="tag"><<span class="name">table</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">tr</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>序号<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>姓名<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>年龄<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>钱包<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">tr</span>></span></span><br><span class="line"> <#list stus as stu></span><br><span class="line"> <span class="tag"><<span class="name">tr</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>${stu_index+1}<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>${stu.name}<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>${stu.age}<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>${stu.money}<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">tr</span>></span></span><br><span class="line"> </#list></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">table</span>></span></span><br><span class="line"><span class="tag"><<span class="name">hr</span>></span></span><br><span class="line"> </span><br><span class="line"><#-- Map 数据的展示 --></span><br><span class="line"><span class="tag"><<span class="name">b</span>></span>map数据的展示:<span class="tag"></<span class="name">b</span>></span></span><br><span class="line"><span class="tag"><<span class="name">br</span>/></span><span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"><span class="tag"><<span class="name">a</span> <span class="attr">href</span>=<span class="string">"###"</span>></span>方式一:通过map['keyname'].property<span class="tag"></<span class="name">a</span>></span><span class="tag"><<span class="name">br</span>/></span></span><br><span class="line">输出stu1的学生信息:<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line">姓名:${stuMap['stu1'].name}<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line">年龄:${stuMap['stu1'].age}<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"><span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"><span class="tag"><<span class="name">a</span> <span class="attr">href</span>=<span class="string">"###"</span>></span>方式二:通过map.keyname.property<span class="tag"></<span class="name">a</span>></span><span class="tag"><<span class="name">br</span>/></span></span><br><span class="line">输出stu2的学生信息:<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line">姓名:${stuMap.stu2.name}<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line">年龄:${stuMap.stu2.age}<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"><span class="tag"><<span class="name">a</span> <span class="attr">href</span>=<span class="string">"###"</span>></span>遍历map中两个学生信息:<span class="tag"></<span class="name">a</span>></span><span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"><span class="tag"><<span class="name">table</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">tr</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>序号<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>姓名<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>年龄<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>钱包<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">tr</span>></span></span><br><span class="line"> <#list stuMap?keys as key ></span><br><span class="line"> <span class="tag"><<span class="name">tr</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>${key_index}<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>${stuMap[key].name}<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>${stuMap[key].age}<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">td</span>></span>${stuMap[key].money}<span class="tag"></<span class="name">td</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">tr</span>></span></span><br><span class="line"> </#list></span><br><span class="line"><span class="tag"></<span class="name">table</span>></span></span><br><span class="line"><span class="tag"><<span class="name">hr</span>></span></span><br><span class="line"> </span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>上面代码解释:</p>
|
||
<p>${k_index}:index:得到循环的下标,使用方法是在stu后边加”_index”,它的值是从0开始,${stu_index+1}下标从1开始</p>
|
||
<p>展示效果:</p>
|
||
<p><img src="/pictures/image-20230816170550343.png" alt="image-20230816170550343"></p>
|
||
<h2 id="3-if指令"><a href="#3-if指令" class="headerlink" title="3.if指令"></a>3.if指令</h2><p><img src="/pictures/image-20230816170909497.png" alt="image-20230816170909497"></p>
|
||
<p> if 指令即判断指令,是常用的FTL指令,freemarker在解析时遇到if会进行判断,条件为真则输出if中间的内容,否则跳过内容不再输出。</p>
|
||
<ul>
|
||
<li>指令格式</li>
|
||
</ul>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><#if ><span class="tag"></<span class="name">if</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>1、数据模型:</p>
|
||
<p>使用list指令中测试数据模型,判断名称为小红的数据字体显示为红色。</p>
|
||
<p>2、模板:</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><table></span><br><span class="line"> <tr></span><br><span class="line"> <td>姓名</td></span><br><span class="line"> <td>年龄</td></span><br><span class="line"> <td>钱包</td></span><br><span class="line"> </tr></span><br><span class="line"> <#list stus as stu></span><br><span class="line"> <tr></span><br><span class="line"> <td >${stu.name}</td></span><br><span class="line"> <td>${stu.age}</td></span><br><span class="line"> <td >${stu.mondy}</td></span><br><span class="line"> </tr></span><br><span class="line"> </#list></span><br><span class="line"></span><br><span class="line"></table></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>实例代码:</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><table></span><br><span class="line"> <tr></span><br><span class="line"> <td>姓名</td></span><br><span class="line"> <td>年龄</td></span><br><span class="line"> <td>钱包</td></span><br><span class="line"> </tr></span><br><span class="line"> <#list stus as stu ></span><br><span class="line"> <#if stu.name='小红'></span><br><span class="line"> <tr style="color: red"></span><br><span class="line"> <td>${stu_index}</td></span><br><span class="line"> <td>${stu.name}</td></span><br><span class="line"> <td>${stu.age}</td></span><br><span class="line"> <td>${stu.money}</td></span><br><span class="line"> </tr></span><br><span class="line"> <#else ></span><br><span class="line"> <tr></span><br><span class="line"> <td>${stu_index}</td></span><br><span class="line"> <td>${stu.name}</td></span><br><span class="line"> <td>${stu.age}</td></span><br><span class="line"> <td>${stu.money}</td></span><br><span class="line"> </tr></span><br><span class="line"> </#if></span><br><span class="line"> </#list></span><br><span class="line"></table></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3、输出:</p>
|
||
<p><img src="/pictures/image-20230816171119081.png" alt="image-20230816171119081"></p>
|
||
<h2 id="4-运算符"><a href="#4-运算符" class="headerlink" title="4.运算符"></a>4.运算符</h2><p><strong>1、算数运算符</strong></p>
|
||
<p>FreeMarker表达式中完全支持算术运算,FreeMarker支持的算术运算符包括:</p>
|
||
<ul>
|
||
<li>加法: <code>+</code></li>
|
||
<li>减法: <code>-</code></li>
|
||
<li>乘法: <code>*</code></li>
|
||
<li>除法: <code>/</code></li>
|
||
<li>求模 (求余): <code>%</code></li>
|
||
</ul>
|
||
<p>模板代码</p>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">b</span>></span>算数运算符<span class="tag"></<span class="name">b</span>></span></span><br><span class="line"><span class="tag"><<span class="name">br</span>/></span><span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"> 100+5 运算: ${100 + 5 }<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"> 100 - 5 * 5运算:${100 - 5 * 5}<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"> 5 / 2运算:${5 / 2}<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"> 12 % 10运算:${12 % 10}<span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"><span class="tag"><<span class="name">hr</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>除了 + 运算以外,其他的运算只能和 number 数字类型的计算。</p>
|
||
<p><strong>2、比较运算符</strong></p>
|
||
<ul>
|
||
<li><strong><code>=</code><strong>或者</strong><code>==</code></strong>:判断两个值是否相等. </li>
|
||
<li><strong><code>!=</code></strong>:判断两个值是否不等. </li>
|
||
<li><strong><code>></code><strong>或者</strong><code>gt</code></strong>:判断左边值是否大于右边值 </li>
|
||
<li><strong><code>>=</code><strong>或者</strong><code>gte</code></strong>:判断左边值是否大于等于右边值 </li>
|
||
<li><strong><code><</code><strong>或者</strong><code>lt</code></strong>:判断左边值是否小于右边值 </li>
|
||
<li><strong><code><=</code><strong>或者</strong><code>lte</code></strong>:判断左边值是否小于等于右边值</li>
|
||
</ul>
|
||
<p>= 和 == 模板代码</p>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"utf-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>Hello World!<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">b</span>></span>比较运算符<span class="tag"></<span class="name">b</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">dl</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dt</span>></span> =/== 和 != 比较:<span class="tag"></<span class="name">dt</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dd</span>></span></span><br><span class="line"> <#if "xiaoming" == "xiaoming"></span><br><span class="line"> 字符串的比较 "xiaoming" == "xiaoming"</span><br><span class="line"> </#if></span><br><span class="line"> <span class="tag"></<span class="name">dd</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dd</span>></span></span><br><span class="line"> <#if 10 != 100></span><br><span class="line"> 数值的比较 10 != 100</span><br><span class="line"> </#if></span><br><span class="line"> <span class="tag"></<span class="name">dd</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dl</span>></span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">dl</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dt</span>></span>其他比较<span class="tag"></<span class="name">dt</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dd</span>></span></span><br><span class="line"> <#if 10 gt 5 ></span><br><span class="line"> 形式一:使用特殊字符比较数值 10 gt 5</span><br><span class="line"> </#if></span><br><span class="line"> <span class="tag"></<span class="name">dd</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dd</span>></span></span><br><span class="line"> <#-- 日期的比较需要通过?date将属性转为data类型才能进行比较 --></span><br><span class="line"> <#if (date1?date >= date2?date)></span><br><span class="line"> 形式二:使用括号形式比较时间 date1?date >= date2?date</span><br><span class="line"> </#if></span><br><span class="line"> <span class="tag"></<span class="name">dd</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dl</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"><span class="tag"><<span class="name">hr</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>Controller 的 数据模型代码</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@GetMapping("operation")</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">testOperation</span><span class="params">(Model model)</span> {</span><br><span class="line"> <span class="comment">//构建 Date 数据</span></span><br><span class="line"> <span class="type">Date</span> <span class="variable">now</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Date</span>();</span><br><span class="line"> model.addAttribute(<span class="string">"date1"</span>, now);</span><br><span class="line"> model.addAttribute(<span class="string">"date2"</span>, now);</span><br><span class="line"> </span><br><span class="line"> <span class="keyword">return</span> <span class="string">"03-operation"</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>比较运算符注意</strong></p>
|
||
<ul>
|
||
<li><code>=</code>和<code>!=</code>可以用于字符串、数值和日期来比较是否相等</li>
|
||
<li><code>=</code>和<code>!=</code>两边必须是相同类型的值,否则会产生错误</li>
|
||
<li>字符串 <code>"x"</code> 、<code>"x "</code> 、<code>"X"</code>比较是不等的.因为FreeMarker是精确比较</li>
|
||
<li>其它的运行符可以作用于数字和日期,但不能作用于字符串</li>
|
||
<li>使用<code>gt</code>等字母运算符代替<code>></code>会有更好的效果,因为 FreeMarker会把<code>></code>解释成FTL标签的结束字符</li>
|
||
<li>可以使用括号来避免这种情况,如:<code><#if (x>y)></code></li>
|
||
</ul>
|
||
<p><strong>3、逻辑运算符</strong></p>
|
||
<ul>
|
||
<li>逻辑与:&& </li>
|
||
<li>逻辑或:|| </li>
|
||
<li>逻辑非:!</li>
|
||
</ul>
|
||
<p>逻辑运算符只能作用于布尔值,否则将产生错误 。</p>
|
||
<p>模板代码</p>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">b</span>></span>逻辑运算符<span class="tag"></<span class="name">b</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"> <#if (10 lt 12 )&&( 10 gt 5 ) ></span><br><span class="line"> (10 lt 12 )&&( 10 gt 5 ) 显示为 true</span><br><span class="line"> </#if></span><br><span class="line"> <span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">br</span>/></span></span><br><span class="line"> <#if !false></span><br><span class="line"> false 取反为true</span><br><span class="line"> </#if></span><br><span class="line"><span class="tag"><<span class="name">hr</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="5-空值处理"><a href="#5-空值处理" class="headerlink" title="5.空值处理"></a>5.空值处理</h2><p><strong>1、判断某变量是否存在使用 “??”</strong></p>
|
||
<p>用法为:variable??,如果该变量存在,返回true,否则返回false </p>
|
||
<p>例:为防止stus为空报错可以加上判断如下:</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><#if stus??></span><br><span class="line"><#list stus as stu></span><br><span class="line"> ......</span><br><span class="line"></#list></span><br><span class="line"></#if></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>2、缺失变量默认值使用 “!”</strong></p>
|
||
<ul>
|
||
<li><p>使用!要以指定一个默认值,当变量为空时显示默认值</p>
|
||
<p>例: ${name!’’}表示如果name为空显示空字符串。</p>
|
||
</li>
|
||
<li><p>如果是嵌套对象则建议使用()括起来</p>
|
||
<p>例: ${(stu.bestFriend.name)!’’}表示,如果stu或bestFriend或name为空默认显示空字符串。</p>
|
||
</li>
|
||
</ul>
|
||
<h2 id="6-内建函数"><a href="#6-内建函数" class="headerlink" title="6.内建函数"></a>6.内建函数</h2><p>内建函数语法格式: <strong><code>变量+?+函数名称</code></strong> </p>
|
||
<p><strong>1、某个集合的大小</strong></p>
|
||
<p><strong><code>${集合名?size}</code></strong></p>
|
||
<p><strong>2、日期格式化</strong></p>
|
||
<p>显示年月日: <code>${today?date}</code> </p>
|
||
<p>显示时分秒:<code>${today?time}</code> </p>
|
||
<p>显示日期+时间:<code>${today?datetime}</code> </p>
|
||
<p>自定义格式化: <code>${today?string("yyyy年MM月")}</code></p>
|
||
<p><strong>3、内建函数<code>c</code></strong></p>
|
||
<p>model.addAttribute(“point”, 102920122);</p>
|
||
<p>point是数字型,使用${point}会显示这个数字的值,每三位使用逗号分隔。</p>
|
||
<p>如果不想显示为每三位分隔的数字,可以使用c函数将数字型转成字符串输出</p>
|
||
<p><strong><code>${point?c}</code></strong></p>
|
||
<p><strong>4、将json字符串转成对象</strong></p>
|
||
<p>一个例子:</p>
|
||
<p>其中用到了 assign标签,assign的作用是定义一个变量。</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><#assign text="{'bank':'工商银行','account':'10101920201920212'}" /></span><br><span class="line"><#assign data=text?eval /></span><br><span class="line">开户行:${data.bank} 账号:${data.account}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>模板代码:</p>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"utf-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>inner Function<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">b</span>></span>获得集合大小<span class="tag"></<span class="name">b</span>></span><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"></span><br><span class="line"> 集合大小:</span><br><span class="line"> <span class="tag"><<span class="name">hr</span>></span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">b</span>></span>获得日期<span class="tag"></<span class="name">b</span>></span><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"></span><br><span class="line"> 显示年月日: <span class="tag"><<span class="name">br</span>></span></span><br><span class="line"></span><br><span class="line"> 显示时分秒:<span class="tag"><<span class="name">br</span>></span></span><br><span class="line"></span><br><span class="line"> 显示日期+时间:<span class="tag"><<span class="name">br</span>></span></span><br><span class="line"></span><br><span class="line"> 自定义格式化: <span class="tag"><<span class="name">br</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">hr</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">b</span>></span>内建函数C<span class="tag"></<span class="name">b</span>></span><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> 没有C函数显示的数值: <span class="tag"><<span class="name">br</span>></span></span><br><span class="line"></span><br><span class="line"> 有C函数显示的数值:</span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">hr</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">b</span>></span>声明变量assign<span class="tag"></<span class="name">b</span>></span><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">hr</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>内建函数模板页面:</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><!DOCTYPE html></span><br><span class="line"><html></span><br><span class="line"><head></span><br><span class="line"> <meta charset="utf-8"></span><br><span class="line"> <title>inner Function</title></span><br><span class="line"></head></span><br><span class="line"><body></span><br><span class="line"></span><br><span class="line"> <b>获得集合大小</b><br></span><br><span class="line"></span><br><span class="line"> 集合大小:${stus?size}</span><br><span class="line"> <hr></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <b>获得日期</b><br></span><br><span class="line"></span><br><span class="line"> 显示年月日: ${today?date} <br></span><br><span class="line"></span><br><span class="line"> 显示时分秒:${today?time}<br></span><br><span class="line"></span><br><span class="line"> 显示日期+时间:${today?datetime}<br></span><br><span class="line"></span><br><span class="line"> 自定义格式化: ${today?string("yyyy年MM月")}<br></span><br><span class="line"></span><br><span class="line"> <hr></span><br><span class="line"></span><br><span class="line"> <b>内建函数C</b><br></span><br><span class="line"> 没有C函数显示的数值:${point} <br></span><br><span class="line"></span><br><span class="line"> 有C函数显示的数值:${point?c}</span><br><span class="line"></span><br><span class="line"> <hr></span><br><span class="line"></span><br><span class="line"> <b>声明变量assign</b><br></span><br><span class="line"> <#assign text="{'bank':'工商银行','account':'10101920201920212'}" /></span><br><span class="line"> <#assign data=text?eval /></span><br><span class="line"> 开户行:${data.bank} 账号:${data.account}</span><br><span class="line"></span><br><span class="line"><hr></span><br><span class="line"></body></span><br><span class="line"></html></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>内建函数Controller数据模型:</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@GetMapping("innerFunc")</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">testInnerFunc</span><span class="params">(Model model)</span> {</span><br><span class="line"> <span class="comment">//1.1 小强对象模型数据</span></span><br><span class="line"> <span class="type">Student</span> <span class="variable">stu1</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Student</span>();</span><br><span class="line"> stu1.setName(<span class="string">"小强"</span>);</span><br><span class="line"> stu1.setAge(<span class="number">18</span>);</span><br><span class="line"> stu1.setMoney(<span class="number">1000.86f</span>);</span><br><span class="line"> stu1.setBirthday(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"> <span class="comment">//1.2 小红对象模型数据</span></span><br><span class="line"> <span class="type">Student</span> <span class="variable">stu2</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Student</span>();</span><br><span class="line"> stu2.setName(<span class="string">"小红"</span>);</span><br><span class="line"> stu2.setMoney(<span class="number">200.1f</span>);</span><br><span class="line"> stu2.setAge(<span class="number">19</span>);</span><br><span class="line"> <span class="comment">//1.3 将两个对象模型数据存放到List集合中</span></span><br><span class="line"> List<Student> stus = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> stus.add(stu1);</span><br><span class="line"> stus.add(stu2);</span><br><span class="line"> model.addAttribute(<span class="string">"stus"</span>, stus);</span><br><span class="line"> <span class="comment">// 2.1 添加日期</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><br><span class="line"> model.addAttribute(<span class="string">"today"</span>, date);</span><br><span class="line"> <span class="comment">// 3.1 添加数值</span></span><br><span class="line"> model.addAttribute(<span class="string">"point"</span>, <span class="number">102920122</span>);</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"04-innerFunc"</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h1 id="四-静态化测试"><a href="#四-静态化测试" class="headerlink" title="四.静态化测试"></a>四.静态化测试</h1><h2 id="1-思路分析"><a href="#1-思路分析" class="headerlink" title="1.思路分析"></a>1.思路分析</h2><p><img src="/pictures/image-20230816172633599.png" alt="image-20230816172633599"></p>
|
||
<h2 id="2-实现步骤"><a href="#2-实现步骤" class="headerlink" title="2.实现步骤"></a>2.实现步骤</h2><p><strong>根据模板文件生成html文件</strong></p>
|
||
<p>①:修改application.yml文件,添加以下模板存放位置的配置信息,完整配置如下:</p>
|
||
<figure class="highlight yaml"><table><tr><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">8881</span> <span class="comment">#服务端口</span></span><br><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">freemarker-demo</span> <span class="comment">#指定服务名</span></span><br><span class="line"> <span class="attr">freemarker:</span></span><br><span class="line"> <span class="attr">cache:</span> <span class="literal">false</span> <span class="comment">#关闭模板缓存,方便测试</span></span><br><span class="line"> <span class="attr">settings:</span></span><br><span class="line"> <span class="attr">template_update_delay:</span> <span class="number">0</span> <span class="comment">#检查模板更新延迟时间,设置为0表示立即检查,如果时间大于0会有缓存不方便进行模板测试</span></span><br><span class="line"> <span class="attr">suffix:</span> <span class="string">.ftl</span> <span class="comment">#指定Freemarker模板文件的后缀名</span></span><br><span class="line"> <span class="attr">template-loader-path:</span> <span class="string">classpath:/templates</span> <span class="comment">#模板存放位置</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>②:在test下创建测试类</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.heima.freemarker.test;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.heima.freemarker.FreeMarkerDemoApplication;</span><br><span class="line"><span class="keyword">import</span> com.heima.freemarker.entity.Student;</span><br><span class="line"><span class="keyword">import</span> freemarker.template.Configuration;</span><br><span class="line"><span class="keyword">import</span> freemarker.template.Template;</span><br><span class="line"><span class="keyword">import</span> freemarker.template.TemplateException;</span><br><span class="line"><span class="keyword">import</span> org.junit.Test;</span><br><span class="line"><span class="keyword">import</span> org.junit.runner.RunWith;</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.boot.test.context.SpringBootTest;</span><br><span class="line"><span class="keyword">import</span> org.springframework.test.context.junit4.SpringRunner;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.FileWriter;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</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">@website</span> https://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/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">@SpringBootTest(classes = FreeMarkerDemoApplication.class)</span></span><br><span class="line"><span class="meta">@RunWith(SpringRunner.class)</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">FreeMarkerTest</span> {</span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="comment">//freemarker.template.Configuration</span></span><br><span class="line"> <span class="keyword">private</span> Configuration configuration;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">test</span><span class="params">()</span> <span class="keyword">throws</span> IOException, TemplateException {</span><br><span class="line"> <span class="type">Template</span> <span class="variable">template</span> <span class="operator">=</span> configuration.getTemplate(<span class="string">"01-basic.ftl"</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"> template.process(getData(),<span class="keyword">new</span> <span class="title class_">FileWriter</span>(<span class="string">"C:\\Gong\\data\\test.html"</span>));</span><br><span class="line"></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> Map<String,Object> <span class="title function_">getData</span><span class="params">()</span>{</span><br><span class="line"> HashMap<String, Object> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> <span class="comment">//1.纯文本形式的参数</span></span><br><span class="line"> map.put(<span class="string">"name"</span>, <span class="string">"freemarker"</span>);</span><br><span class="line"> <span class="comment">//2.实体类相关的参数</span></span><br><span class="line"> <span class="type">Student</span> <span class="variable">student</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Student</span>();</span><br><span class="line"> student.setName(<span class="string">"小明"</span>);</span><br><span class="line"> student.setAge(<span class="number">18</span>);</span><br><span class="line"> map.put(<span class="string">"stu"</span>, student);</span><br><span class="line"> <span class="keyword">return</span> map;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p> ③ :运行结果</p>
|
||
<p><img src="/pictures/image-20230816174550953.png" alt="image-20230816174550953"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>前端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>FreeMarker</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>接口测试工具</title>
|
||
<url>/posts/35630.html</url>
|
||
<content><![CDATA[<h2 id="一-Postman的使用"><a href="#一-Postman的使用" class="headerlink" title="一 Postman的使用"></a>一 Postman的使用</h2><p><strong>官网网址: <a href="https://www.postman.com/">https://www.postman.com/</a></strong></p>
|
||
<p><strong>Postman的首页</strong></p>
|
||
<p><img src="/pictures/image-20230813162510205.png" alt="image-20230813162510205"></p>
|
||
<h3 id="1-使用教程"><a href="#1-使用教程" class="headerlink" title="1 使用教程"></a>1 使用教程</h3><h4 id="1-1-发送Post请求"><a href="#1-1-发送Post请求" class="headerlink" title="1.1 发送Post请求"></a>1.1 发送Post请求</h4><p><strong>以一个普通的登录操作来演示Postman的使用教程</strong></p>
|
||
<p>发送Post请求的: 1.修改请求的方式 2.设置请求体的数据类型</p>
|
||
<p><img src="/pictures/image-20230813163451814.png" alt="image-20230813163451814"></p>
|
||
<p>请求数据的格式</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"phone"</span><span class="punctuation">:</span><span class="string">"13511223456"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"password"</span><span class="punctuation">:</span><span class="string">"admin"</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>响应数据的格式</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"host"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"code"</span><span class="punctuation">:</span> <span class="number">200</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"errorMessage"</span><span class="punctuation">:</span> <span class="string">"操作成功"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"data"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"user"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"id"</span><span class="punctuation">:</span> <span class="number">4</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"salt"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"admin"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"password"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"phone"</span><span class="punctuation">:</span> <span class="string">"13511223456"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"image"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sex"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"certification"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"identityAuthentication"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"status"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"flag"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"createdTime"</span><span class="punctuation">:</span> <span class="string">"2020-03-30T08:36:32.000+00:00"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"token"</span><span class="punctuation">:</span> <span class="string">"eyJhbGciOiJIUzUxMiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAAADWLQQrDMAzA_uJzc3DnBKe_cRKPpVAIOIWNsb_PPfQmIfSFfXbYgCqlEkmDVI6BHlJCrrWF9IzKiMKNERboMmHDlDFjTMgL2Fn8to9NPa5u5vrSfoibnM1NxnDW97jPvF5n90a_P2LDCJyAAAAA.Rk6wC_YpLmxrqylQxEgz19uKHkrBRV6_JmIqbHrSQENkURtavrzhLzr0D8mQf-wtKivaGGviDGHmdckw8IWi7g"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="二-Swagger的使用"><a href="#二-Swagger的使用" class="headerlink" title="二 Swagger的使用"></a>二 Swagger的使用</h2><p>SpringBoot整合Swagger:<a href="https://qingling.icu/posts/32246.html">https://qingling.icu/posts/32246.html</a></p>
|
||
<p><strong>以一个普通的登录操作来演示Swagger的使用教程</strong></p>
|
||
<p><img src="/pictures/image-20230813170950932.png" alt="image-20230813170950932"></p>
|
||
<p><img src="/pictures/image-20230813171244848.png" alt="image-20230813171244848"></p>
|
||
<h2 id="三-knife4j的使用"><a href="#三-knife4j的使用" class="headerlink" title="三 knife4j的使用"></a>三 knife4j的使用</h2><p><strong>SpringBoot整合Knife4j教程: <a href="https://qingling.icu/posts/855.html">https://qingling.icu/posts/855.html</a></strong></p>
|
||
<p>gitee地址:<a href="https://gitee.com/xiaoym/knife4j">https://gitee.com/xiaoym/knife4j</a> </p>
|
||
<p>官方文档:<a href="https://doc.xiaominfo.com/">https://doc.xiaominfo.com/</a> </p>
|
||
<p><strong>核心功能</strong> :文档说明 在线调试 个性化配置 离线文档 接口排序</p>
|
||
<p><img src="/pictures/image-20230813172211110.png" alt="image-20230813172211110"></p>
|
||
<p><strong>以一个普通的登录操作来演示knife4j的使用教程</strong></p>
|
||
<p><img src="/pictures/image-20230813172355353.png" alt="image-20230813172355353"></p>
|
||
<p><strong>下载离线文档</strong></p>
|
||
<p><img src="/pictures/image-20230813172605624.png" alt="image-20230813172605624"></p>
|
||
<p>下载成功之后打开的效果</p>
|
||
<p><img src="/pictures/image-20230813172720116.png" alt="image-20230813172720116"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>工具</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>SpringBoot入门教程</title>
|
||
<url>/posts/60684.html</url>
|
||
<content><![CDATA[<p>尚硅谷雷丰阳的SpringBoot零基础入门教程</p>
|
||
<p><strong>本视频笔记地址:</strong><a href="https://yuque.com/atguigu/springboot">https://yuque.com/atguigu/springboot</a></p>
|
||
<p><strong>本视频源码地址:</strong><a href="https://gitee.com/leifengyang/springboot2">https://gitee.com/leifengyang/springboot2</a></p>
|
||
<p><strong>Spring官网:</strong> <a href="https://spring.io/">https://spring.io/</a></p>
|
||
<p>SpringBoot2的环境要求</p>
|
||
<p><img src="/pictures/image-20230620092919922.png" alt="image-20230620092919922"></p>
|
||
<h1 id="一-SpringBoot2核心技术-基础入门"><a href="#一-SpringBoot2核心技术-基础入门" class="headerlink" title="一.SpringBoot2核心技术-基础入门"></a>一.SpringBoot2核心技术-基础入门</h1><h2 id="1-Spring能做什么"><a href="#1-Spring能做什么" class="headerlink" title="1.Spring能做什么"></a>1.Spring能做什么</h2><p>这里的Spring指的是整个Spring生态</p>
|
||
<p><img src="/pictures/image-20230620093420150.png" alt="image-20230620093420150"></p>
|
||
<p><strong>微服务 响应式编程 分布式 WEB开发 无服务开发 事件驱动 批处理</strong></p>
|
||
<h2 id="2-SpringBoot"><a href="#2-SpringBoot" class="headerlink" title="2.SpringBoot"></a>2.SpringBoot</h2><p>Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”.</p>
|
||
<p>能快速创建出生产级别的Spring应用</p>
|
||
<p>SpringBoot是整合Spring技术栈的一站式框架</p>
|
||
<p>SpringBoot是简化Spring技术栈的快速开发脚手架</p>
|
||
<h3 id="2-1-SpringBoot的优点"><a href="#2-1-SpringBoot的优点" class="headerlink" title="2.1 SpringBoot的优点"></a>2.1 SpringBoot的优点</h3><p>● Create stand-alone Spring applications<br> ○ 创建独立Spring应用<br>● Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)<br> ○ 内嵌web服务器<br>● Provide opinionated ‘starter’ dependencies to simplify your build configuration<br> ○ 自动starter依赖,简化构建配置<br>● Automatically configure Spring and 3rd party libraries whenever possible<br> ○ 自动配置Spring以及第三方功能<br>● Provide production-ready features such as metrics, health checks, and externalized configuration<br> ○ 提供生产级别的监控、健康检查及外部化配置<br>● Absolutely no code generation and no requirement for XML configuration<br> ○ 无代码生成、无需编写XML</p>
|
||
<h3 id="2-2、SpringBoot缺点"><a href="#2-2、SpringBoot缺点" class="headerlink" title="2.2、SpringBoot缺点"></a>2.2、SpringBoot缺点</h3><ul>
|
||
<li>人称版本帝,迭代快,需要时刻关注变化(说明社区活跃,也是个优点)</li>
|
||
<li>封装太深,内部原理复杂,不容易精通</li>
|
||
</ul>
|
||
<h3 id="2-3-官方文档"><a href="#2-3-官方文档" class="headerlink" title="2.3 官方文档"></a>2.3 官方文档</h3><p>进入官网 找到SpringBoot 点击Reference Doc进入官方文档</p>
|
||
<p><img src="/pictures/image-20230620101533445.png" alt="image-20230620101533445"></p>
|
||
<h2 id="3-SpringBoot入门"><a href="#3-SpringBoot入门" class="headerlink" title="3.SpringBoot入门"></a>3.SpringBoot入门</h2><h3 id="1-系统的要求"><a href="#1-系统的要求" class="headerlink" title="1.系统的要求"></a>1.系统的要求</h3><ul>
|
||
<li><a href="https://www.java.com/">Java 8</a> & 兼容java14 .</li>
|
||
<li>Maven 3.3+</li>
|
||
<li>idea 2019.1.2</li>
|
||
</ul>
|
||
<p>**Maven的配置教程: **</p>
|
||
<p><a href="https://qingling.icu/posts/26768.html">Maven配置文件settings.xml | The Blog (qingling.icu)</a></p>
|
||
<p><a href="https://qingling.icu/posts/63333.html">开发环境的搭建 | The Blog (qingling.icu)</a></p>
|
||
<h3 id="2-HelloWorld"><a href="#2-HelloWorld" class="headerlink" title="2.HelloWorld"></a>2.HelloWorld</h3><p><strong>需求:浏览发送/hello请求,响应 Hello,Spring Boot 2</strong> </p>
|
||
<p>1创建maven工程</p>
|
||
<p><img src="/pictures/image-20230725160846882.png" alt="image-20230725160846882"></p>
|
||
<p>2.引入依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">parent</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-parent<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.3.4.RELEASE<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">parent</span>></span></span><br><span class="line"> <span class="comment"><!-- WEB场景的启动器 --></span></span><br><span class="line"><span class="tag"><<span class="name">dependencies</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-web<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">dependencies</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3.创建主程序</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.SpringApplication;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.autoconfigure.SpringBootApplication;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/7/25</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">@SpringBootApplication</span> <span class="comment">//标注这是一个SpringBoot应用</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MainApplication</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> SpringApplication.run(MainApplication.class,args);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>4.编写Controller</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot.controller;</span><br><span class="line"></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="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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/7/25</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">@RestController</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">HelloController</span> {</span><br><span class="line"></span><br><span class="line"> <span class="meta">@RequestMapping</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">handle01</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"Hello,Spring Boot2"</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<img src="/pictures/image-20230725162201612.png" alt="image-20230725162201612" style="zoom:150%;" />
|
||
|
||
<h3 id="3-简化配置"><a href="#3-简化配置" class="headerlink" title="3.简化配置"></a>3.简化配置</h3><p>官网地址:<a href="https://docs.spring.io/spring-boot/docs/2.7.14/reference/html/application-properties.html#appendix.application-properties">https://docs.spring.io/spring-boot/docs/2.7.14/reference/html/application-properties.html#appendix.application-properties</a></p>
|
||
<figure class="highlight properties"><table><tr><td class="code"><pre><span class="line"><span class="attr">server.port</span>=<span class="string">8888</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-简化部署"><a href="#4-简化部署" class="headerlink" title="4.简化部署"></a>4.简化部署</h3><p>通过在pom.xml文件中插入这个插件,可以直接将项目打成jar包简化部署</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"> <span class="tag"><<span class="name">build</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">plugins</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">plugin</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-maven-plugin<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">plugin</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">plugins</span>></span></span><br><span class="line"><span class="tag"></<span class="name">build</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230725163026091.png" alt="image-20230725163026091"></p>
|
||
<p>可以直接使用cmd切换到target目录下使用<code>java -jar </code>命令运行jar包</p>
|
||
<p><img src="/pictures/image-20230725163212347.png" alt="image-20230725163212347"></p>
|
||
<p><strong>注意点</strong></p>
|
||
<p>去掉cmd的快速编辑模式(不去掉启动的时候点击屏幕会停止)</p>
|
||
<p><img src="/pictures/image-20230725164124574.png" alt="image-20230725164124574"></p>
|
||
<h2 id="4-了解自动装配原理"><a href="#4-了解自动装配原理" class="headerlink" title="4.了解自动装配原理"></a>4.了解自动装配原理</h2><h3 id="4-1-依赖管理"><a href="#4-1-依赖管理" class="headerlink" title="4.1 依赖管理"></a>4.1 依赖管理</h3><h4 id="1-SpringBoot的自动版本仲裁机制"><a href="#1-SpringBoot的自动版本仲裁机制" class="headerlink" title="1.SpringBoot的自动版本仲裁机制"></a><strong>1.SpringBoot的自动版本仲裁机制</strong></h4><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!-- 项目的继承的父项目--></span></span><br><span class="line"><span class="tag"><<span class="name">parent</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-parent<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.3.4.RELEASE<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">parent</span>></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="tag"><<span class="name">parent</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-dependencies<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.3.4.RELEASE<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">parent</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230725165414051.png" alt="image-20230725165414051"></p>
|
||
<p><strong>自定义mysql版本驱动</strong></p>
|
||
<p>在父依赖中mysql是8版本的</p>
|
||
<p><img src="/pictures/image-20230725170329032.png" alt="image-20230725170329032"></p>
|
||
<p>可以在pom.xml中通过自定义properties修改版本</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">properties</span>></span></span><br><span class="line"> <span class="comment"><!--重写mysql的版本号--></span></span><br><span class="line"> <span class="tag"><<span class="name">mysql.version</span>></span>5.1.43<span class="tag"></<span class="name">mysql.version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">properties</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230725170257030.png" alt="image-20230725170257030"></p>
|
||
<h4 id="2-Starters场景启动器"><a href="#2-Starters场景启动器" class="headerlink" title="2.Starters场景启动器"></a>2.Starters场景启动器</h4><p>官网: <a href="https://docs.spring.io/spring-boot/docs/2.7.14/reference/html/using.html#using.build-systems.starters">https://docs.spring.io/spring-boot/docs/2.7.14/reference/html/using.html#using.build-systems.starters</a></p>
|
||
<p><strong>以<code>spring-boot-starter-*</code>起头的starter为官方提供的starter,<code>*-spring-boot-starter</code>为第三方提供的starter</strong></p>
|
||
<p>常见的Starter</p>
|
||
<p><img src="/pictures/image-20230725171130925.png" alt="image-20230725171130925"></p>
|
||
<p>以引入<code>spring-boot-starter-web</code>为例,引入该starter它会帮我们引入以下的其它依赖</p>
|
||
<p><img src="/pictures/image-20230725171550618.png" alt="image-20230725171550618"></p>
|
||
<h3 id="4-2-自动配置"><a href="#4-2-自动配置" class="headerlink" title="4.2 自动配置"></a>4.2 自动配置</h3><ul>
|
||
<li><p><strong>自动配置Tomcat</strong></p>
|
||
<ol>
|
||
<li><p>引入依赖</p>
|
||
<p><img src="/pictures/image-20230725172719608.png" alt="image-20230725172719608"></p>
|
||
</li>
|
||
<li><p>配置Tomcat</p>
|
||
</li>
|
||
</ol>
|
||
</li>
|
||
<li><p><strong>自动配置SpringMvc</strong></p>
|
||
<ol>
|
||
<li><p>引入springMvc全套组件</p>
|
||
</li>
|
||
<li><p>自动配置好springMvc的常用组件(字符编码,文件上传解析器,dispatcherServlet等)</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@SpringBootApplication</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MainApplication</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="comment">//返回ioc容器</span></span><br><span class="line"> <span class="type">ConfigurableApplicationContext</span> <span class="variable">run</span> <span class="operator">=</span> SpringApplication.run(MainApplication.class, args);</span><br><span class="line"> <span class="comment">//获取容器里面组件的名字</span></span><br><span class="line"> String[] beanDefinitionNames = run.getBeanDefinitionNames();</span><br><span class="line"> <span class="keyword">for</span> (String beanDefinitionName : beanDefinitionNames) {</span><br><span class="line"> <span class="comment">//打印容器内的组件</span></span><br><span class="line"> System.out.println(beanDefinitionName);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230725172834666.png" alt="image-20230725172834666"></p>
|
||
</li>
|
||
</ol>
|
||
</li>
|
||
<li><p><strong>默认的包结构</strong></p>
|
||
<p>主程序所在的包以及其的子包都可以被扫描到,无需配置包扫描</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">com</span><br><span class="line"> +- example</span><br><span class="line"> +- myapplication</span><br><span class="line"> +- MyApplication.java #主程序</span><br><span class="line"> |</span><br><span class="line"> +- customer</span><br><span class="line"> | +- Customer.java</span><br><span class="line"> | +- CustomerController.java</span><br><span class="line"> | +- CustomerService.java</span><br><span class="line"> | +- CustomerRepository.java</span><br><span class="line"> |</span><br><span class="line"> +- order</span><br><span class="line"> +- Order.java</span><br><span class="line"> +- OrderController.java</span><br><span class="line"> +- OrderService.java</span><br><span class="line"> +- OrderRepository.java</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>如果需要扫描的文件在主程序的上级目录,我们也想扫描到它,我们需要扩大一下包的扫描范围</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@SpringBootApplication(scanBasePackages = "com.atguigu")</span></span><br><span class="line">或者</span><br><span class="line"><span class="meta">@ComponentScan("com.atguigu")</span></span><br></pre></td></tr></table></figure>
|
||
</li>
|
||
<li><p><strong>各种配置拥有默认值</strong></p>
|
||
<p><img src="/pictures/image-20230725174350129.png" alt="image-20230725174350129"></p>
|
||
</li>
|
||
<li><p><strong>按需加载所有的自动配置项</strong></p>
|
||
<p>spingboot的所有配置存在于下面的这个依赖中</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-autoconfigure<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.3.4.RELEASE<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">scope</span>></span>compile<span class="tag"></<span class="name">scope</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230725175010683.png" alt="image-20230725175010683"></p>
|
||
</li>
|
||
</ul>
|
||
<h3 id="4-3-容器功能"><a href="#4-3-容器功能" class="headerlink" title="4.3 容器功能"></a>4.3 容器功能</h3><h4 id="1-组件添加"><a href="#1-组件添加" class="headerlink" title="1.组件添加"></a>1.组件添加</h4><h5 id="1-1-Configuration"><a href="#1-1-Configuration" class="headerlink" title="1.1 @Configuration"></a>1.1 @Configuration</h5><ul>
|
||
<li><p>基本使用</p>
|
||
</li>
|
||
<li><p><strong>Full模式与Lite模式</strong></p>
|
||
</li>
|
||
<li><ul>
|
||
<li>示例</li>
|
||
<li>最佳实战</li>
|
||
</ul>
|
||
</li>
|
||
<li><ul>
|
||
<li><ul>
|
||
<li>配置 类组件之间无依赖关系用Lite模式加速容器启动过程,减少判断</li>
|
||
<li>配置类组件之间有依赖关系,方法会被调用得到之前单实例组件,用Full模式</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 1、配置类里面使用<span class="doctag">@Bean</span>标注在方法上给容器注册组件,默认也是单实例的</span></span><br><span class="line"><span class="comment"> * 2、配置类本身也是组件</span></span><br><span class="line"><span class="comment"> * 3、proxyBeanMethods:代理bean的方法</span></span><br><span class="line"><span class="comment"> * Full(proxyBeanMethods = true)、【保证每个<span class="doctag">@Bean</span>方法被调用多少次返回的组件都是单实例的】</span></span><br><span class="line"><span class="comment"> * Lite(proxyBeanMethods = false)【每个<span class="doctag">@Bean</span>方法被调用多少次返回的组件都是新创建的】</span></span><br><span class="line"><span class="comment"> * 组件依赖必须使用Full模式默认。其他默认是否Lite模式</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Configuration(proxyBeanMethods = false)</span> <span class="comment">//告诉SpringBoot这是一个配置类 == 配置文件</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MyConfig</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * Full:外部无论对配置类中的这个组件注册方法调用多少次获取的都是之前注册容器中的单实例对象</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">@Bean</span> <span class="comment">//给容器中添加组件。以方法名作为组件的id。返回类型就是组件类型。返回的值,就是组件在容器中的实例</span></span><br><span class="line"> <span class="keyword">public</span> User <span class="title function_">user01</span><span class="params">()</span>{</span><br><span class="line"> <span class="type">User</span> <span class="variable">zhangsan</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"zhangsan"</span>, <span class="number">18</span>);</span><br><span class="line"> <span class="comment">//user组件依赖了Pet组件</span></span><br><span class="line"> zhangsan.setPet(tomcatPet());</span><br><span class="line"> <span class="keyword">return</span> zhangsan;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Bean("tom")</span></span><br><span class="line"> <span class="keyword">public</span> Pet <span class="title function_">tomcatPet</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">Pet</span>(<span class="string">"tomcat"</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@SpringBootConfiguration</span></span><br><span class="line"><span class="meta">@EnableAutoConfiguration</span></span><br><span class="line"><span class="meta">@ComponentScan("com.atguigu.boot")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MainApplication</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="comment">//1、返回我们IOC容器</span></span><br><span class="line"> <span class="type">ConfigurableApplicationContext</span> <span class="variable">run</span> <span class="operator">=</span> SpringApplication.run(MainApplication.class, args);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//2、查看容器里面的组件</span></span><br><span class="line"> String[] names = run.getBeanDefinitionNames();</span><br><span class="line"> <span class="keyword">for</span> (String name : names) {</span><br><span class="line"> System.out.println(name);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//3、从容器中获取组件</span></span><br><span class="line"></span><br><span class="line"> <span class="type">Pet</span> <span class="variable">tom01</span> <span class="operator">=</span> run.getBean(<span class="string">"tom"</span>, Pet.class);</span><br><span class="line"></span><br><span class="line"> <span class="type">Pet</span> <span class="variable">tom02</span> <span class="operator">=</span> run.getBean(<span class="string">"tom"</span>, Pet.class);</span><br><span class="line"></span><br><span class="line"> System.out.println(<span class="string">"组件:"</span>+(tom01 == tom02));</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="comment">//4、com.atguigu.boot.config.MyConfig$$EnhancerBySpringCGLIB$$51f1e1ca@1654a892</span></span><br><span class="line"> <span class="type">MyConfig</span> <span class="variable">bean</span> <span class="operator">=</span> run.getBean(MyConfig.class);</span><br><span class="line"> System.out.println(bean);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//如果@Configuration(proxyBeanMethods = true)代理对象调用方法。SpringBoot总会检查这个组件是否在容器中有。</span></span><br><span class="line"> <span class="comment">//保持组件单实例</span></span><br><span class="line"> <span class="type">User</span> <span class="variable">user</span> <span class="operator">=</span> bean.user01();</span><br><span class="line"> <span class="type">User</span> <span class="variable">user1</span> <span class="operator">=</span> bean.user01();</span><br><span class="line"> System.out.println(user == user1);</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="type">User</span> <span class="variable">user01</span> <span class="operator">=</span> run.getBean(<span class="string">"user01"</span>, User.class);</span><br><span class="line"> <span class="type">Pet</span> <span class="variable">tom</span> <span class="operator">=</span> run.getBean(<span class="string">"tom"</span>, Pet.class);</span><br><span class="line"></span><br><span class="line"> System.out.println(<span class="string">"用户的宠物:"</span>+(user01.getPet() == tom));</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="1-2-Bean-Component-Controller-Service-Repository"><a href="#1-2-Bean-Component-Controller-Service-Repository" class="headerlink" title="1.2 @Bean @Component @Controller @Service @Repository"></a>1.2 @Bean @Component @Controller @Service @Repository</h5><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">//默认是单实例的</span></span><br><span class="line"><span class="meta">@Bean</span><span class="comment">//给容器中添加组件,以方法名作为组件的id(组件名),返回类型就是组件类型,返回的值,就是组件在容器中的实例,@Bean("user") 是自定义组件名为user</span></span><br><span class="line"><span class="keyword">public</span> User <span class="title function_">user01</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"Tom"</span>,<span class="number">100</span>);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="1-3-ComponentScan-Import"><a href="#1-3-ComponentScan-Import" class="headerlink" title="1.3 @ComponentScan @Import"></a>1.3 @ComponentScan @Import</h5><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment"> * @Import({User.class, DBHelper.class}) 给容器中自动创建出这两个类型的组件、默认组件的名字就是全类名</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Import({User.class, DBHelper.class})</span></span><br><span class="line"><span class="meta">@Configuration(proxyBeanMethods = false)</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MyConfig</span> {</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="1-4-Conditional-条件装配:满足Conditional指定的条件,则进行组件注入"><a href="#1-4-Conditional-条件装配:满足Conditional指定的条件,则进行组件注入" class="headerlink" title="1.4 @Conditional 条件装配:满足Conditional指定的条件,则进行组件注入"></a>1.4 @Conditional 条件装配:满足Conditional指定的条件,则进行组件注入</h5><p><img src="/pictures/image-20230802141422751.png" alt="image-20230802141422751"></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">//放在类上面,条件成立,这个类下面的所有配置生效,放在方法上面,条件成立,这个方法下的配置才会成立</span></span><br><span class="line"><span class="meta">@ConditionalOnBean(name = "tom")</span> <span class="comment">//存在一个id为tom的组件的时候才会生效</span></span><br><span class="line"><span class="meta">@ConditionalOnMissingBean(name = "tom")</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="2-原生配置文件的引入"><a href="#2-原生配置文件的引入" class="headerlink" title="2.原生配置文件的引入"></a>2.原生配置文件的引入</h4><h5 id="2-1、-ImportResource"><a href="#2-1、-ImportResource" class="headerlink" title="2.1、@ImportResource"></a>2.1、@ImportResource</h5><p>beans.xml*)</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="meta"><?xml version=<span class="string">"1.0"</span> encoding=<span class="string">"UTF-8"</span>?></span></span><br><span class="line"><span class="tag"><<span class="name">beans</span> <span class="attr">xmlns</span>=<span class="string">"http://www.springframework.org/schema/beans"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">xmlns:xsi</span>=<span class="string">"http://www.w3.org/2001/XMLSchema-instance"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">xmlns:context</span>=<span class="string">"http://www.springframework.org/schema/context"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">xsi:schemaLocation</span>=<span class="string">"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd"</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">bean</span> <span class="attr">id</span>=<span class="string">"haha"</span> <span class="attr">class</span>=<span class="string">"com.atguigu.boot.bean.User"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">property</span> <span class="attr">name</span>=<span class="string">"name"</span> <span class="attr">value</span>=<span class="string">"zhangsan"</span>></span><span class="tag"></<span class="name">property</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">property</span> <span class="attr">name</span>=<span class="string">"age"</span> <span class="attr">value</span>=<span class="string">"18"</span>></span><span class="tag"></<span class="name">property</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">bean</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">bean</span> <span class="attr">id</span>=<span class="string">"hehe"</span> <span class="attr">class</span>=<span class="string">"com.atguigu.boot.bean.Pet"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">property</span> <span class="attr">name</span>=<span class="string">"name"</span> <span class="attr">value</span>=<span class="string">"tomcat"</span>></span><span class="tag"></<span class="name">property</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">bean</span>></span></span><br><span class="line"><span class="tag"></<span class="name">beans</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>在java类中红使用@ImportResource(“classpath:beans.xml”)导入上面的配置文件</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@ImportResource("classpath:beans.xml")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MyConfig</span> {}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-配置绑定"><a href="#3-配置绑定" class="headerlink" title="3.配置绑定"></a>3.配置绑定</h4><h5 id="3-1-ConfigurationProperties"><a href="#3-1-ConfigurationProperties" class="headerlink" title="3.1 @ConfigurationProperties"></a>3.1 @ConfigurationProperties</h5><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 只有在容器中的组件,才会拥有SpringBoot提供的强大功能</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Component</span> <span class="comment">//或者在配置类上添加@EnableConfigurationProperties(Car.class)注解,不使用@Component</span></span><br><span class="line"><span class="meta">@ConfigurationProperties(prefix = "mycar")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Car</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String brand;</span><br><span class="line"> <span class="keyword">private</span> Integer price;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">getBrand</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> brand;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">setBrand</span><span class="params">(String brand)</span> {</span><br><span class="line"> <span class="built_in">this</span>.brand = brand;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> Integer <span class="title function_">getPrice</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> price;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">setPrice</span><span class="params">(Integer price)</span> {</span><br><span class="line"> <span class="built_in">this</span>.price = price;</span><br><span class="line"> }</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> String <span class="title function_">toString</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"Car{"</span> +</span><br><span class="line"> <span class="string">"brand='"</span> + brand + <span class="string">'\''</span> +</span><br><span class="line"> <span class="string">", price="</span> + price +</span><br><span class="line"> <span class="string">'}'</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>配置文件中的值</p>
|
||
<figure class="highlight properties"><table><tr><td class="code"><pre><span class="line"><span class="attr">mycar.brand</span>=<span class="string">BYD</span></span><br><span class="line"><span class="attr">mycar.price</span>=<span class="string">120000</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>编写测试的controller</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Autowired</span></span><br><span class="line"><span class="keyword">private</span> Car car;</span><br><span class="line"><span class="meta">@RequestMapping("/car")</span></span><br><span class="line"><span class="keyword">public</span> Car <span class="title function_">ggetCar</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> car;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<img src="/pictures/image-20230802153951542.png" alt="image-20230802153951542" style="zoom: 150%;" />
|
||
|
||
<h3 id="4-4-自动配置原理入门"><a href="#4-4-自动配置原理入门" class="headerlink" title="4.4 自动配置原理入门"></a>4.4 自动配置原理入门</h3><h4 id="1-引导加载自动配置类"><a href="#1-引导加载自动配置类" class="headerlink" title="1.引导加载自动配置类"></a>1.引导加载自动配置类</h4><p><strong>@SpringBootApplication</strong></p>
|
||
<p><img src="/pictures/image-20230802155222746.png" alt="image-20230802155222746"></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@SpringBootConfiguration</span> <span class="comment">//代表当前是一个配置类</span></span><br><span class="line"><span class="meta">@EnableAutoConfiguration</span> </span><br><span class="line"><span class="meta">@ComponentScan(excludeFilters = { @Filter(type = FilterType.CUSTOM, classes = TypeExcludeFilter.class),</span></span><br><span class="line"><span class="meta"> @Filter(type = FilterType.CUSTOM, classes = AutoConfigurationExcludeFilter.class) })</span><span class="comment">//指定扫描那些spring注解</span></span><br><span class="line"><span class="keyword">public</span> <span class="meta">@interface</span> SpringBootApplication{}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>@EnableAutoConfiguration</strong> </p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@AutoConfigurationPackage</span></span><br><span class="line"><span class="meta">@Import(AutoConfigurationImportSelector.class)</span></span><br><span class="line"><span class="keyword">public</span> <span class="meta">@interface</span> EnableAutoConfiguration {}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>@AutoConfigurationPackage</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Import(AutoConfigurationPackages.Registrar.class)</span></span><br><span class="line"><span class="keyword">public</span> <span class="meta">@interface</span> AutoConfigurationPackage {}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>Registrar.class</strong></p>
|
||
<p><img src="/pictures/image-20230802160618158.png" alt="image-20230802160618158"></p>
|
||
<p><strong>利用Registrar给容器中导入com.atguigu.boot(主程序所在的包)包下的一系列组件</strong></p>
|
||
<p><img src="/pictures/image-20230802161004735.png" alt="image-20230802161004735"></p>
|
||
<p><strong>@Import(AutoConfigurationImportSelector.class)</strong> </p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="number">1</span>、利用getAutoConfigurationEntry(annotationMetadata);给容器中批量导入一些组件</span><br><span class="line"><span class="number">2</span>、调用List<String> configurations = getCandidateConfigurations(annotationMetadata, attributes)获取到所有需要导入到容器中的配置类</span><br><span class="line"><span class="number">3</span>、利用工厂加载 Map<String, List<String>> <span class="title function_">loadSpringFactories</span><span class="params">(<span class="meta">@Nullable</span> ClassLoader classLoader)</span>;得到所有的组件</span><br><span class="line"><span class="number">4</span>、从META-INF/spring.factories位置来加载一个文件。</span><br><span class="line"> 默认扫描我们当前系统里面所有META-INF/spring.factories位置的文件</span><br><span class="line"> spring-boot-autoconfigure-<span class="number">2.3</span><span class="number">.4</span>.RELEASE.jar包里面也有META-INF/spring.factories</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>AutoConfigurationImportSelector.java</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Override</span></span><br><span class="line"><span class="keyword">public</span> String[] selectImports(AnnotationMetadata annotationMetadata) {</span><br><span class="line"> <span class="keyword">if</span> (!isEnabled(annotationMetadata)) {</span><br><span class="line"> <span class="keyword">return</span> NO_IMPORTS;</span><br><span class="line"> }</span><br><span class="line"> <span class="type">AutoConfigurationEntry</span> <span class="variable">autoConfigurationEntry</span> <span class="operator">=</span> getAutoConfigurationEntry(annotationMetadata);</span><br><span class="line"> <span class="keyword">return</span> StringUtils.toStringArray(autoConfigurationEntry.getConfigurations());</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>getAutoConfigurationEntry()方法</strong></p>
|
||
<p>利用getAutoConfigurationEntry(annotationMetadata);给容器中批量导入一些组件</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">protected</span> AutoConfigurationEntry <span class="title function_">getAutoConfigurationEntry</span><span class="params">(AnnotationMetadata annotationMetadata)</span> {</span><br><span class="line"> <span class="keyword">if</span> (!isEnabled(annotationMetadata)) {</span><br><span class="line"> <span class="keyword">return</span> EMPTY_ENTRY;</span><br><span class="line"> }</span><br><span class="line"> <span class="type">AnnotationAttributes</span> <span class="variable">attributes</span> <span class="operator">=</span> getAttributes(annotationMetadata);</span><br><span class="line"> List<String> configurations = getCandidateConfigurations(annotationMetadata, attributes);</span><br><span class="line"> configurations = removeDuplicates(configurations);</span><br><span class="line"> Set<String> exclusions = getExclusions(annotationMetadata, attributes);</span><br><span class="line"> checkExcludedClasses(configurations, exclusions);</span><br><span class="line"> configurations.removeAll(exclusions);</span><br><span class="line"> configurations = getConfigurationClassFilter().filter(configurations);</span><br><span class="line"> fireAutoConfigurationImportEvents(configurations, exclusions);</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">AutoConfigurationEntry</span>(configurations, exclusions);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>**getCandidateConfigurations()**获取所有候选的配置</p>
|
||
<p>调用List<String> configurations = getCandidateConfigurations(annotationMetadata, attributes)获取到所有需要导入到容器中的配置类</p>
|
||
<p><img src="/pictures/image-20230802162236987.png" alt="image-20230802162236987"></p>
|
||
<p><strong>loadSpringFactories()</strong></p>
|
||
<p>利用工厂加载 Map<String, List<String>> loadSpringFactories(@Nullable ClassLoader classLoader);得到所有的组件</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">private</span> <span class="keyword">static</span> Map<String, List<String>> <span class="title function_">loadSpringFactories</span><span class="params">(<span class="meta">@Nullable</span> ClassLoader classLoader)</span> {</span><br><span class="line"> MultiValueMap<String, String> result = (MultiValueMap)cache.get(classLoader);</span><br><span class="line"> <span class="keyword">if</span> (result != <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">return</span> result;</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> Enumeration<URL> urls = classLoader != <span class="literal">null</span> ? classLoader.getResources(<span class="string">"META-INF/spring.factories"</span>) : ClassLoader.getSystemResources(<span class="string">"META-INF/spring.factories"</span>);</span><br><span class="line"> MultiValueMap<String, String> result = <span class="keyword">new</span> <span class="title class_">LinkedMultiValueMap</span>();</span><br><span class="line"></span><br><span class="line"> <span class="keyword">while</span>(urls.hasMoreElements()) {</span><br><span class="line"> <span class="type">URL</span> <span class="variable">url</span> <span class="operator">=</span> (URL)urls.nextElement();</span><br><span class="line"> <span class="type">UrlResource</span> <span class="variable">resource</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">UrlResource</span>(url);</span><br><span class="line"> <span class="type">Properties</span> <span class="variable">properties</span> <span class="operator">=</span> PropertiesLoaderUtils.loadProperties(resource);</span><br><span class="line"> <span class="type">Iterator</span> <span class="variable">var6</span> <span class="operator">=</span> properties.entrySet().iterator();</span><br><span class="line"></span><br><span class="line"> <span class="keyword">while</span>(var6.hasNext()) {</span><br><span class="line"> Map.Entry<?, ?> entry = (Map.Entry)var6.next();</span><br><span class="line"> <span class="type">String</span> <span class="variable">factoryTypeName</span> <span class="operator">=</span> ((String)entry.getKey()).trim();</span><br><span class="line"> String[] var9 = StringUtils.commaDelimitedListToStringArray((String)entry.getValue());</span><br><span class="line"> <span class="type">int</span> <span class="variable">var10</span> <span class="operator">=</span> var9.length;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">for</span>(<span class="type">int</span> <span class="variable">var11</span> <span class="operator">=</span> <span class="number">0</span>; var11 < var10; ++var11) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">factoryImplementationName</span> <span class="operator">=</span> var9[var11];</span><br><span class="line"> result.add(factoryTypeName, factoryImplementationName.trim());</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> cache.put(classLoader, result);</span><br><span class="line"> <span class="keyword">return</span> result;</span><br><span class="line"> } <span class="keyword">catch</span> (IOException var13) {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">IllegalArgumentException</span>(<span class="string">"Unable to load factories from location [META-INF/spring.factories]"</span>, var13);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>从META-INF/spring.factories位置来加载一个文件。默认扫描我们当前系统里面所有META-INF/spring.factories位置的文件,spring-boot-autoconfigure-2.3.4.RELEASE.jar包里面也有META-INF/spring.factories</strong></p>
|
||
<p><img src="/pictures/image-20230802163429366.png" alt="image-20230802163429366"></p>
|
||
<p><strong>在spring.factories这个配置文件中写死了springBoot一启动就要给容器加载的所有配置类,一共127个</strong></p>
|
||
<p><img src="/pictures/image-20230802163708198.png" alt="image-20230802163708198"></p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"># Initializers</span><br><span class="line">org.springframework.context.ApplicationContextInitializer=\</span><br><span class="line">org.springframework.boot.autoconfigure.SharedMetadataReaderFactoryContextInitializer,\</span><br><span class="line">org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener</span><br><span class="line"></span><br><span class="line"># Application Listeners</span><br><span class="line">org.springframework.context.ApplicationListener=\</span><br><span class="line">org.springframework.boot.autoconfigure.BackgroundPreinitializer</span><br><span class="line"></span><br><span class="line"># Auto Configuration Import Listeners</span><br><span class="line">org.springframework.boot.autoconfigure.AutoConfigurationImportListener=\</span><br><span class="line">org.springframework.boot.autoconfigure.condition.ConditionEvaluationReportAutoConfigurationImportListener</span><br><span class="line"></span><br><span class="line"># Auto Configuration Import Filters</span><br><span class="line">org.springframework.boot.autoconfigure.AutoConfigurationImportFilter=\</span><br><span class="line">org.springframework.boot.autoconfigure.condition.OnBeanCondition,\</span><br><span class="line">org.springframework.boot.autoconfigure.condition.OnClassCondition,\</span><br><span class="line">org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition</span><br><span class="line"></span><br><span class="line"># Auto Configure</span><br><span class="line">org.springframework.boot.autoconfigure.EnableAutoConfiguration=\</span><br><span class="line">org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.aop.AopAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.context.LifecycleAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.couchbase.CouchbaseAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.cassandra.CassandraReactiveDataAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.cassandra.CassandraReactiveRepositoriesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.cassandra.CassandraRepositoriesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.couchbase.CouchbaseDataAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.couchbase.CouchbaseReactiveDataAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.couchbase.CouchbaseReactiveRepositoriesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.couchbase.CouchbaseRepositoriesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.elasticsearch.ReactiveElasticsearchRepositoriesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.elasticsearch.ReactiveElasticsearchRestClientAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.jdbc.JdbcRepositoriesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.ldap.LdapRepositoriesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.mongo.MongoReactiveRepositoriesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.mongo.MongoRepositoriesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.neo4j.Neo4jRepositoriesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.solr.SolrRepositoriesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.r2dbc.R2dbcDataAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.r2dbc.R2dbcRepositoriesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.r2dbc.R2dbcTransactionManagerAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.redis.RedisReactiveAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.hazelcast.HazelcastJpaDependencyAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.influx.InfluxDbAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.jdbc.JndiDataSourceAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.jdbc.XADataSourceAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.jms.JndiConnectionFactoryAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.jms.artemis.ArtemisAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.jsonb.JsonbAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.ldap.embedded.EmbeddedLdapAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.mail.MailSenderValidatorAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.rsocket.RSocketMessagingAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.rsocket.RSocketRequesterAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.rsocket.RSocketServerAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.rsocket.RSocketStrategiesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.security.reactive.ReactiveSecurityAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.security.reactive.ReactiveUserDetailsServiceAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.security.rsocket.RSocketSecurityAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.security.saml2.Saml2RelyingPartyAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.sendgrid.SendGridAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.session.SessionAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.security.oauth2.client.reactive.ReactiveOAuth2ClientAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.security.oauth2.resource.reactive.ReactiveOAuth2ResourceServerAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.task.TaskSchedulingAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.transaction.jta.JtaAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.web.reactive.HttpHandlerAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.web.reactive.ReactiveWebServerFactoryAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.web.reactive.function.client.ClientHttpConnectorAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.websocket.reactive.WebSocketReactiveAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.websocket.servlet.WebSocketMessagingAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.webservices.WebServicesAutoConfiguration,\</span><br><span class="line">org.springframework.boot.autoconfigure.webservices.client.WebServiceTemplateAutoConfiguration</span><br><span class="line"></span><br><span class="line"># Failure analyzers</span><br><span class="line">org.springframework.boot.diagnostics.FailureAnalyzer=\</span><br><span class="line">org.springframework.boot.autoconfigure.data.redis.RedisUrlSyntaxFailureAnalyzer,\</span><br><span class="line">org.springframework.boot.autoconfigure.diagnostics.analyzer.NoSuchBeanDefinitionFailureAnalyzer,\</span><br><span class="line">org.springframework.boot.autoconfigure.flyway.FlywayMigrationScriptMissingFailureAnalyzer,\</span><br><span class="line">org.springframework.boot.autoconfigure.jdbc.DataSourceBeanCreationFailureAnalyzer,\</span><br><span class="line">org.springframework.boot.autoconfigure.jdbc.HikariDriverConfigurationFailureAnalyzer,\</span><br><span class="line">org.springframework.boot.autoconfigure.r2dbc.ConnectionFactoryBeanCreationFailureAnalyzer,\</span><br><span class="line">org.springframework.boot.autoconfigure.session.NonUniqueSessionRepositoryFailureAnalyzer</span><br><span class="line"></span><br><span class="line"># Template availability providers</span><br><span class="line">org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider=\</span><br><span class="line">org.springframework.boot.autoconfigure.freemarker.FreeMarkerTemplateAvailabilityProvider,\</span><br><span class="line">org.springframework.boot.autoconfigure.mustache.MustacheTemplateAvailabilityProvider,\</span><br><span class="line">org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAvailabilityProvider,\</span><br><span class="line">org.springframework.boot.autoconfigure.thymeleaf.ThymeleafTemplateAvailabilityProvider,\</span><br><span class="line">org.springframework.boot.autoconfigure.web.servlet.JspTemplateAvailabilityProvider</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="2-按需开启自动配置项"><a href="#2-按需开启自动配置项" class="headerlink" title="2.按需开启自动配置项"></a>2.按需开启自动配置项</h4><p> 虽然我们127个场景的所有自动配置启动的时候默认全部加载。xxxxAutoConfiguration,按照条件装配规则(@Conditional),最终会按需配置,比如下面的配置是否生效还要通过@Conditional的条件判断。</p>
|
||
<p><strong>简单的一句话:启动的时候加载所有,使用的时候按照条件(@Conditional)进行装配</strong></p>
|
||
<p><img src="/pictures/image-20230802164424689.png" alt="image-20230802164424689"></p>
|
||
<h4 id="3-修改默认配置"><a href="#3-修改默认配置" class="headerlink" title="3.修改默认配置"></a>3.修改默认配置</h4><p> 相当于当我们在容器中注入了类型为MultipartResolver但是id不为multipartResolver的组件的时候,会帮我们规范一下命名,命名为multipartResolver。</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Bean</span></span><br><span class="line"><span class="meta">@ConditionalOnBean(MultipartResolver.class)</span> <span class="comment">//存在MultipartResolver类型的组件</span></span><br><span class="line"><span class="meta">@ConditionalOnMissingBean(name = DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME)</span><span class="comment">//不存在以multipartResolver为id的组件</span></span><br><span class="line"><span class="keyword">public</span> MultipartResolver <span class="title function_">multipartResolver</span><span class="params">(MultipartResolver resolver)</span> {</span><br><span class="line"> <span class="comment">// Detect if the user has created a MultipartResolver but named it incorrectly</span></span><br><span class="line"> <span class="keyword">return</span> resolver;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>SpringBoot默认会在底层配好所有的组件。但是如果用户自己配置了以用户的优先</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Bean</span></span><br><span class="line"><span class="meta">@ConditionalOnMissingBean</span> <span class="comment">//没有的话就将这个配置注入到容器中</span></span><br><span class="line"><span class="keyword">public</span> CharacterEncodingFilter <span class="title function_">characterEncodingFilter</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">CharacterEncodingFilter</span> <span class="variable">filter</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">OrderedCharacterEncodingFilter</span>();</span><br><span class="line"> filter.setEncoding(<span class="built_in">this</span>.properties.getCharset().name());</span><br><span class="line"> filter.setForceRequestEncoding(<span class="built_in">this</span>.properties.shouldForce(Encoding.Type.REQUEST));</span><br><span class="line"> filter.setForceResponseEncoding(<span class="built_in">this</span>.properties.shouldForce(Encoding.Type.RESPONSE));</span><br><span class="line"> <span class="keyword">return</span> filter;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>总结:</p>
|
||
<ul>
|
||
<li><p>SpringBoot先加载所有的自动配置类 xxxxxAutoConfiguration</p>
|
||
</li>
|
||
<li><p>每个自动配置类按照条件进行生效,默认都会绑定配置文件指定的值。xxxxProperties里面拿。xxxProperties和配置文件进行了绑定</p>
|
||
</li>
|
||
<li><p>生效的配置类就会给容器中装配很多组件</p>
|
||
</li>
|
||
<li><p>只要容器中有这些组件,相当于这些功能就有了</p>
|
||
</li>
|
||
<li><p>定制化配置</p>
|
||
</li>
|
||
<li><ul>
|
||
<li>用户直接自己@Bean替换底层的组件</li>
|
||
<li>用户去看这个组件是获取的配置文件什么值就去修改。</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<p>xxxxxAutoConfiguration —> 组件 —> xxxxProperties取值 —-> application.properties</p>
|
||
<h4 id="3-4-最佳实践"><a href="#3-4-最佳实践" class="headerlink" title="3.4.最佳实践"></a>3.4.最佳实践</h4><ul>
|
||
<li><p>引入场景依赖</p>
|
||
</li>
|
||
<li><ul>
|
||
<li><a href="https://docs.spring.io/spring-boot/docs/current/reference/html/using-spring-boot.html#using-boot-starter">https://docs.spring.io/spring-boot/docs/current/reference/html/using-spring-boot.html#using-boot-starter</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><p>查看自动配置了哪些(选做)</p>
|
||
</li>
|
||
<li><ul>
|
||
<li>自己分析,引入场景对应的自动配置一般都生效了</li>
|
||
<li>配置文件中<strong>debug=true开启自动配置报告</strong>。Negative(不生效)\Positive(生效)</li>
|
||
</ul>
|
||
</li>
|
||
<li><p>是否需要修改</p>
|
||
</li>
|
||
<li><ul>
|
||
<li>参照文档修改配置项</li>
|
||
</ul>
|
||
</li>
|
||
<li><ul>
|
||
<li><ul>
|
||
<li><a href="https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html#common-application-properties">https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html#common-application-properties</a></li>
|
||
<li>自己分析。xxxxProperties绑定了配置文件的哪些。</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li><ul>
|
||
<li>自定义加入或者替换组件</li>
|
||
</ul>
|
||
</li>
|
||
<li><ul>
|
||
<li><ul>
|
||
<li>@Bean、@Component。。。</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li><ul>
|
||
<li>自定义器 <strong>XXXXXCustomizer</strong>;</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<h3 id="4-5-简化开发"><a href="#4-5-简化开发" class="headerlink" title="4.5 简化开发"></a>4.5 简化开发</h3><h4 id="1-Lombok"><a href="#1-Lombok" class="headerlink" title="1.Lombok"></a>1.Lombok</h4><p>引入依赖(使用前需要安装插件)</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.projectlombok<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>lombok<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>注解</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@NoArgsConstructor</span> <span class="comment">//无参构造器</span></span><br><span class="line"><span class="meta">@AllArgsConstructor</span> <span class="comment">//有参构造器</span></span><br><span class="line"><span class="meta">@Data</span> <span class="comment">//getter和setter方法</span></span><br><span class="line"><span class="meta">@ToString</span> </span><br><span class="line"><span class="meta">@EqualsAndHashCode</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="2-简化日志开发"><a href="#2-简化日志开发" class="headerlink" title="2.简化日志开发"></a>2.简化日志开发</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Slf4j</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-dev-tools"><a href="#3-dev-tools" class="headerlink" title="3.dev-tools"></a>3.dev-tools</h3><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-devtools<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">optional</span>></span>true<span class="tag"></<span class="name">optional</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>项目或者页面修改以后:Ctrl+F9;</p>
|
||
<h3 id="4-Spring-Initailizr(项目初始化向导)"><a href="#4-Spring-Initailizr(项目初始化向导)" class="headerlink" title="4.Spring Initailizr(项目初始化向导)"></a>4.Spring Initailizr(项目初始化向导)</h3><p><img src="/pictures/image-20230803103657995.png" alt="image-20230803103657995"></p>
|
||
<p><img src="/pictures/image-20230803104032505.png" alt="image-20230803104032505"></p>
|
||
<p><img src="/pictures/image-20230803104655578.png" alt="image-20230803104655578"></p>
|
||
<h1 id=""><a href="#" class="headerlink" title=""></a></h1><h1 id="二-SpringBoot2核心技术-核心功能"><a href="#二-SpringBoot2核心技术-核心功能" class="headerlink" title="二.SpringBoot2核心技术-核心功能"></a>二.SpringBoot2核心技术-核心功能</h1><p><img src="/pictures/image-20230803104919434.png" alt="image-20230803104919434"></p>
|
||
<h2 id="一-配置文件"><a href="#一-配置文件" class="headerlink" title="一.配置文件"></a>一.配置文件</h2><h3 id="1、文件类型"><a href="#1、文件类型" class="headerlink" title="1、文件类型"></a>1、文件类型</h3><h4 id="1-1、properties"><a href="#1-1、properties" class="headerlink" title="1.1、properties"></a>1.1、properties</h4><p>同以前的properties用法</p>
|
||
<h4 id="1-2、yaml"><a href="#1-2、yaml" class="headerlink" title="1.2、yaml"></a>1.2、yaml</h4><h5 id="1-2-1、简介"><a href="#1-2-1、简介" class="headerlink" title="1.2.1、简介"></a>1.2.1、简介</h5><p>YAML 是 “YAML Ain’t Markup Language”(YAML 不是一种标记语言)的递归缩写。在开发的这种语言时,YAML 的意思其实是:”Yet Another Markup Language”(仍是一种标记语言)。 </p>
|
||
<p>非常适合用来做以数据为中心的配置文件</p>
|
||
<h5 id="1-2-2、基本语法"><a href="#1-2-2、基本语法" class="headerlink" title="1.2.2、基本语法"></a>1.2.2、基本语法</h5><ul>
|
||
<li>key: value;kv之间有空格</li>
|
||
<li>大小写敏感</li>
|
||
<li>使用缩进表示层级关系</li>
|
||
<li>缩进不允许使用tab,只允许空格</li>
|
||
<li>缩进的空格数不重要,只要相同层级的元素左对齐即可</li>
|
||
<li>‘#’表示注释</li>
|
||
<li>字符串无需加引号,如果要加,’’与””表示字符串内容 会被 转义/不转义</li>
|
||
</ul>
|
||
<h5 id="1-2-3、数据类型"><a href="#1-2-3、数据类型" class="headerlink" title="1.2.3、数据类型"></a>1.2.3、数据类型</h5><ul>
|
||
<li>字面量:单个的、不可再分的值。date、boolean、string、number、null</li>
|
||
</ul>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">k:</span> <span class="string">v</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<ul>
|
||
<li>对象:键值对的集合。map、hash、set、object</li>
|
||
</ul>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="string">行内写法:</span> <span class="attr">k:</span> {<span class="string">k1:v1</span>,<span class="string">k2:v2</span>,<span class="string">k3:v3</span>}</span><br><span class="line"><span class="comment">#或</span></span><br><span class="line"><span class="attr">k:</span> </span><br><span class="line"> <span class="attr">k1:</span> <span class="string">v1</span></span><br><span class="line"> <span class="attr">k2:</span> <span class="string">v2</span></span><br><span class="line"> <span class="attr">k3:</span> <span class="string">v3</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<ul>
|
||
<li>数组:一组按次序排列的值。array、list、queue</li>
|
||
</ul>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="string">行内写法:</span> <span class="attr">k:</span> [<span class="string">v1</span>,<span class="string">v2</span>,<span class="string">v3</span>]</span><br><span class="line"><span class="comment">#或者</span></span><br><span class="line"><span class="attr">k:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">v1</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">v2</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">v3</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="1-2-4、示例"><a href="#1-2-4、示例" class="headerlink" title="1.2.4、示例"></a>1.2.4、示例</h5><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@ConfigurationProperties(prefix="person")</span><span class="comment">//和以person开头的配置文件绑定</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_">Person</span> {</span><br><span class="line"> </span><br><span class="line"> <span class="keyword">private</span> String userName;</span><br><span class="line"> <span class="keyword">private</span> Boolean boss;</span><br><span class="line"> <span class="keyword">private</span> Date birth;</span><br><span class="line"> <span class="keyword">private</span> Integer age;</span><br><span class="line"> <span class="keyword">private</span> Pet pet;</span><br><span class="line"> <span class="keyword">private</span> String[] interests;</span><br><span class="line"> <span class="keyword">private</span> List<String> animal;</span><br><span class="line"> <span class="keyword">private</span> Map<String, Object> score;</span><br><span class="line"> <span class="keyword">private</span> Set<Double> salarys;</span><br><span class="line"> <span class="keyword">private</span> Map<String, List<Pet>> allPets;</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">class</span> <span class="title class_">Pet</span> {</span><br><span class="line"> <span class="keyword">private</span> String name;</span><br><span class="line"> <span class="keyword">private</span> Double weight;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="comment"># yaml表示以上对象</span></span><br><span class="line"><span class="attr">person:</span></span><br><span class="line"><span class="comment"># 单引号会将 \n作为字符串输出 双引号会将\n 作为换行输出</span></span><br><span class="line"><span class="comment"># 双引号不会转义,单引号会转义</span></span><br><span class="line"> <span class="attr">userName:</span> <span class="string">zhangsan</span></span><br><span class="line"> <span class="attr">boss:</span> <span class="literal">false</span></span><br><span class="line"> <span class="attr">birth:</span> <span class="number">2019</span><span class="string">/12/12</span> <span class="number">20</span><span class="string">:12:33</span></span><br><span class="line"> <span class="attr">age:</span> <span class="number">18</span></span><br><span class="line"> <span class="attr">pet:</span> </span><br><span class="line"> <span class="attr">name:</span> <span class="string">tomcat</span></span><br><span class="line"> <span class="attr">weight:</span> <span class="number">23.4</span></span><br><span class="line"> <span class="attr">interests:</span> [<span class="string">篮球</span>,<span class="string">游泳</span>]</span><br><span class="line"> <span class="attr">animal:</span> </span><br><span class="line"> <span class="bullet">-</span> <span class="string">jerry</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">mario</span></span><br><span class="line"> <span class="attr">score:</span></span><br><span class="line"> <span class="attr">english:</span> </span><br><span class="line"> <span class="attr">first:</span> <span class="number">30</span></span><br><span class="line"> <span class="attr">second:</span> <span class="number">40</span></span><br><span class="line"> <span class="attr">third:</span> <span class="number">50</span></span><br><span class="line"> <span class="attr">math:</span> [<span class="number">131</span>,<span class="number">140</span>,<span class="number">148</span>]</span><br><span class="line"> <span class="attr">chinese:</span> {<span class="attr">first:</span> <span class="number">128</span>,<span class="attr">second:</span> <span class="number">136</span>}</span><br><span class="line"> <span class="attr">salarys:</span> [<span class="number">3999</span>,<span class="number">4999.98</span>,<span class="number">5999.99</span>]</span><br><span class="line"> <span class="attr">allPets:</span></span><br><span class="line"> <span class="attr">sick:</span></span><br><span class="line"> <span class="bullet">-</span> {<span class="attr">name:</span> <span class="string">tom</span>}</span><br><span class="line"> <span class="bullet">-</span> {<span class="attr">name:</span> <span class="string">jerry</span>,<span class="attr">weight:</span> <span class="number">47</span>}</span><br><span class="line"> <span class="attr">health:</span> [{<span class="attr">name:</span> <span class="string">mario</span>,<span class="attr">weight:</span> <span class="number">47</span>}]</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2、配置提示"><a href="#2、配置提示" class="headerlink" title="2、配置提示"></a>2、配置提示</h3><p>自定义的类和配置文件绑定一般没有提示</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-configuration-processor<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">optional</span>></span>true<span class="tag"></<span class="name">optional</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"><span class="comment"><!--打包的时候去除这个配置提示器--></span></span><br><span class="line"><span class="tag"><<span class="name">build</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">plugins</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">plugin</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-maven-plugin<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">configuration</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">excludes</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">exclude</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-configuration-processor<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">exclude</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">excludes</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">configuration</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">plugin</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">plugins</span>></span></span><br><span class="line"><span class="tag"></<span class="name">build</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="二-Web开发"><a href="#二-Web开发" class="headerlink" title="二.Web开发"></a>二.Web开发</h2><p><img src="/pictures/image-20230803134143859.png" alt="image-20230803134143859"></p>
|
||
<h3 id="1-简单的功能分析"><a href="#1-简单的功能分析" class="headerlink" title="1.简单的功能分析"></a>1.简单的功能分析</h3><h4 id="1-1-静态资源访问"><a href="#1-1-静态资源访问" class="headerlink" title="1.1 静态资源访问"></a>1.1 静态资源访问</h4><h5 id="1-静态资源目录"><a href="#1-静态资源目录" class="headerlink" title="1.静态资源目录"></a>1.静态资源目录</h5><p>只要静态资源放在类路径下: <code>/static</code> (or <code>/public</code> or <code>/resources</code> or <code>/META-INF/resources</code></p>
|
||
<p>访问 : 当前项目根路径/ + 静态资源名 </p>
|
||
<p>原理: 静态映射/**</p>
|
||
<p>请求进来,先去找Controller看能不能处理,不能处理的所有请求又都交给<strong>静态资源处理器</strong>,静态资源也找不到则响应<strong>404页面</strong></p>
|
||
<p><strong>改变默认的静态资源路径</strong></p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">spring:</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:/haha/</span>] <span class="comment">#静态资源的目录</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="2-静态资源访问前缀"><a href="#2-静态资源访问前缀" class="headerlink" title="2.静态资源访问前缀"></a>2.静态资源访问前缀</h5><p>默认无前缀</p>
|
||
<p>默认的访问路径: <code>localhost:8080/xxx.png</code></p>
|
||
<p>设置访问前缀之后: <code>localhost:8080/res/xxx.png</code> (文件在目录中的位置没有改变,只是访问的时候加上了res这一层路径)</p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">spring:</span></span><br><span class="line"> <span class="attr">mvc:</span></span><br><span class="line"> <span class="attr">static-path-pattern:</span> <span class="string">/res/**</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>当前项目 + static-path-pattern + 静态资源名 = 静态资源文件夹下找</p>
|
||
<h5 id="3-webjar"><a href="#3-webjar" class="headerlink" title="3.webjar"></a>3.webjar</h5><p>自动映射 /<a href="http://localhost:8080/webjars/jquery/3.5.1/jquery.js">webjars</a>/**</p>
|
||
<p><a href="https://www.webjars.org/">https://www.webjars.org/</a></p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.webjars<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>jquery<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>3.5.1<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>访问地址:<a href="http://localhost:8080/webjars/jquery/3.5.1/jquery.js">http://localhost:8080/webjars/jquery/3.5.1/jquery.js</a> 后面地址要按照依赖里面的包路径</p>
|
||
<h4 id="1-2-欢迎页支持"><a href="#1-2-欢迎页支持" class="headerlink" title="1.2 欢迎页支持"></a>1.2 欢迎页支持</h4><ul>
|
||
<li><p>静态资源路径下 index.html</p>
|
||
</li>
|
||
<li><ul>
|
||
<li>可以配置静态资源路径</li>
|
||
<li>但是不可以配置静态资源的访问前缀。否则导致 index.html不能被默认访问</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">spring:</span></span><br><span class="line"><span class="comment"># mvc:</span></span><br><span class="line"><span class="comment"># static-path-pattern: /res/** 这个会导致welcome page功能失效</span></span><br><span class="line"></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:/haha/</span>]</span><br></pre></td></tr></table></figure>
|
||
|
||
<ul>
|
||
<li>controller能处理/index</li>
|
||
</ul>
|
||
<h4 id="1-3-自定义-Favicon"><a href="#1-3-自定义-Favicon" class="headerlink" title="1.3 自定义 Favicon"></a>1.3 自定义 <code>Favicon</code></h4><p>favicon.ico 放在静态资源目录下即可(名称为favicon.ico)</p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">spring:</span></span><br><span class="line"><span class="comment"># mvc:</span></span><br><span class="line"><span class="comment"># static-path-pattern: /res/** 这个会导致 Favicon 功能失效</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-4-静态资源配置原理"><a href="#1-4-静态资源配置原理" class="headerlink" title="1.4 静态资源配置原理"></a>1.4 静态资源配置原理</h4><p><strong>1.SpringMvc的自动配置类WebMvcAutoConfiguration</strong></p>
|
||
<p><img src="/pictures/image-20230803165113057.png" alt="image-20230803165113057"></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Configuration(proxyBeanMethods = false)</span></span><br><span class="line"><span class="meta">@ConditionalOnWebApplication(type = Type.SERVLET)</span></span><br><span class="line"><span class="meta">@ConditionalOnClass({ Servlet.class, DispatcherServlet.class, WebMvcConfigurer.class })</span></span><br><span class="line"><span class="meta">@ConditionalOnMissingBean(WebMvcConfigurationSupport.class)</span></span><br><span class="line"><span class="meta">@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE + 10)</span></span><br><span class="line"><span class="meta">@AutoConfigureAfter({ DispatcherServletAutoConfiguration.class, TaskExecutionAutoConfiguration.class,</span></span><br><span class="line"><span class="meta"> ValidationAutoConfiguration.class })</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WebMvcAutoConfiguration</span> {}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>2.SpringMvc给容器中配置的组件</strong></p>
|
||
<p><img src="/pictures/image-20230803180257123.png" alt="image-20230803180257123"></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Configuration(proxyBeanMethods = false)</span></span><br><span class="line"><span class="meta">@Import(EnableWebMvcConfiguration.class)</span></span><br><span class="line"><span class="meta">@EnableConfigurationProperties({ WebMvcProperties.class, ResourceProperties.class })</span></span><br><span class="line"><span class="meta">@Order(0)</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_">WebMvcAutoConfigurationAdapter</span> <span class="keyword">implements</span> <span class="title class_">WebMvcConfigurer</span> {}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>3.绑定的配置</strong></p>
|
||
<p><strong>@EnableConfigurationProperties({ WebMvcProperties.class, ResourceProperties.class })</strong></p>
|
||
<p>WebMvcProperties.class</p>
|
||
<p><img src="/pictures/image-20230803180600438.png" alt="image-20230803180600438"></p>
|
||
<p>ResourceProperties.class </p>
|
||
<p><img src="/pictures/image-20230803180633611.png" alt="image-20230803180633611"></p>
|
||
<h3 id="2-请求参数处理与数据响应"><a href="#2-请求参数处理与数据响应" class="headerlink" title="2.请求参数处理与数据响应"></a>2.请求参数处理与数据响应</h3><h4 id="2-1、请求映射"><a href="#2-1、请求映射" class="headerlink" title="2.1、请求映射"></a>2.1、请求映射</h4><h5 id="1、rest使用与原理"><a href="#1、rest使用与原理" class="headerlink" title="1、rest使用与原理"></a>1、rest使用与原理</h5><ul>
|
||
<li><p>@xxxMapping;</p>
|
||
</li>
|
||
<li><p>Rest风格支持(<em>使用<strong>HTTP</strong>请求方式动词来表示对资源的操作</em>)</p>
|
||
</li>
|
||
<li><ul>
|
||
<li>以前:/getUser 获取用户 /deleteUser 删除用户 /editUser 修改用户 /saveUser 保存用户</li>
|
||
<li>现在: /user GET-获取用户 DELETE-删除用户 PUT-修改用户 POST-保存用户</li>
|
||
<li>核心Filter;HiddenHttpMethodFilter</li>
|
||
</ul>
|
||
</li>
|
||
<li><ul>
|
||
<li><ul>
|
||
<li>用法: 表单method=post,隐藏域 _method=put</li>
|
||
<li>SpringBoot中手动开启</li>
|
||
</ul>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="comment">#开启使用rest风格的注解</span></span><br><span class="line"><span class="attr">spring:</span></span><br><span class="line"> <span class="attr">mvc:</span></span><br><span class="line"> <span class="attr">hiddenmethod:</span></span><br><span class="line"> <span class="attr">filter:</span></span><br><span class="line"> <span class="attr">enabled:</span> <span class="literal">true</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!--发送put或者delete请求--></span></span><br><span class="line"><span class="tag"><<span class="name">form</span> <span class="attr">action</span>=<span class="string">"/user"</span> <span class="attr">method</span>=<span class="string">"post"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">name</span>=<span class="string">"_method"</span> <span class="attr">type</span>=<span class="string">"hidden"</span> <span class="attr">value</span>=<span class="string">"delete"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">name</span>=<span class="string">"_m"</span> <span class="attr">type</span>=<span class="string">"hidden"</span> <span class="attr">value</span>=<span class="string">"delete"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">value</span>=<span class="string">"REST-DELETE 提交"</span> <span class="attr">type</span>=<span class="string">"submit"</span>/></span></span><br><span class="line"><span class="tag"></<span class="name">form</span>></span></span><br><span class="line"><span class="tag"><<span class="name">form</span> <span class="attr">action</span>=<span class="string">"/user"</span> <span class="attr">method</span>=<span class="string">"post"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">name</span>=<span class="string">"_method"</span> <span class="attr">type</span>=<span class="string">"hidden"</span> <span class="attr">value</span>=<span class="string">"PUT"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">value</span>=<span class="string">"REST-PUT 提交"</span> <span class="attr">type</span>=<span class="string">"submit"</span>/></span></span><br><span class="line"><span class="tag"></<span class="name">form</span>></span></span><br></pre></td></tr></table></figure></li>
|
||
</ul>
|
||
</li>
|
||
<li><ul>
|
||
<li>扩展:如何把_method 这个名字换成我们自己喜欢的。</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@RequestMapping(value = "/user",method = RequestMethod.GET)</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">getUser</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"GET-张三"</span>;</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="meta">@RequestMapping(value = "/user",method = RequestMethod.POST)</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">saveUser</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"POST-张三"</span>;</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="meta">@RequestMapping(value = "/user",method = RequestMethod.PUT)</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">putUser</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"PUT-张三"</span>;</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="meta">@RequestMapping(value = "/user",method = RequestMethod.DELETE)</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">deleteUser</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"DELETE-张三"</span>;</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">//自定义filter</span></span><br><span class="line"><span class="meta">@Bean</span></span><br><span class="line"><span class="keyword">public</span> HiddenHttpMethodFilter <span class="title function_">hiddenHttpMethodFilter</span><span class="params">()</span>{</span><br><span class="line"> <span class="type">HiddenHttpMethodFilter</span> <span class="variable">methodFilter</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">HiddenHttpMethodFilter</span>();</span><br><span class="line"> methodFilter.setMethodParam(<span class="string">"_m"</span>);</span><br><span class="line"> <span class="keyword">return</span> methodFilter;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>Rest原理(表单提交要使用REST的时候)</p>
|
||
<ul>
|
||
<li><p>表单提交会带上_method=PUT</p>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!--发送put或者delete请求--></span></span><br><span class="line"><span class="tag"><<span class="name">form</span> <span class="attr">action</span>=<span class="string">"/user"</span> <span class="attr">method</span>=<span class="string">"post"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">name</span>=<span class="string">"_method"</span> <span class="attr">type</span>=<span class="string">"hidden"</span> <span class="attr">value</span>=<span class="string">"delete"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">name</span>=<span class="string">"_m"</span> <span class="attr">type</span>=<span class="string">"hidden"</span> <span class="attr">value</span>=<span class="string">"delete"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">value</span>=<span class="string">"REST-DELETE 提交"</span> <span class="attr">type</span>=<span class="string">"submit"</span>/></span></span><br><span class="line"><span class="tag"></<span class="name">form</span>></span></span><br><span class="line"><span class="tag"><<span class="name">form</span> <span class="attr">action</span>=<span class="string">"/user"</span> <span class="attr">method</span>=<span class="string">"post"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">name</span>=<span class="string">"_method"</span> <span class="attr">type</span>=<span class="string">"hidden"</span> <span class="attr">value</span>=<span class="string">"PUT"</span>/></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">value</span>=<span class="string">"REST-PUT 提交"</span> <span class="attr">type</span>=<span class="string">"submit"</span>/></span></span><br><span class="line"><span class="tag"></<span class="name">form</span>></span></span><br></pre></td></tr></table></figure>
|
||
</li>
|
||
<li><p>请求过来被HiddenHttpMethodFilter拦截</p>
|
||
<p>WebMvcAutoConfiguration</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Bean</span></span><br><span class="line"><span class="meta">@ConditionalOnMissingBean(HiddenHttpMethodFilter.class)</span></span><br><span class="line"><span class="meta">@ConditionalOnProperty(prefix = "spring.mvc.hiddenmethod.filter", name = "enabled", matchIfMissing = false)</span></span><br><span class="line"><span class="keyword">public</span> OrderedHiddenHttpMethodFilter <span class="title function_">hiddenHttpMethodFilter</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">OrderedHiddenHttpMethodFilter</span>();</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
</li>
|
||
<li><ul>
|
||
<li>请求是否正常,并且是POST</li>
|
||
</ul>
|
||
</li>
|
||
<li><ul>
|
||
<li><ul>
|
||
<li><p>获取到_method的值。</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Override</span></span><br><span class="line"><span class="keyword">protected</span> <span class="keyword">void</span> <span class="title function_">doFilterInternal</span><span class="params">(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)</span></span><br><span class="line"> <span class="keyword">throws</span> ServletException, IOException {</span><br><span class="line"></span><br><span class="line"> <span class="type">HttpServletRequest</span> <span class="variable">requestToUse</span> <span class="operator">=</span> request;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span> (<span class="string">"POST"</span>.equals(request.getMethod()) && request.getAttribute(WebUtils.ERROR_EXCEPTION_ATTRIBUTE) == <span class="literal">null</span>) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">paramValue</span> <span class="operator">=</span> request.getParameter(<span class="built_in">this</span>.methodParam);</span><br><span class="line"> <span class="keyword">if</span> (StringUtils.hasLength(paramValue)) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">method</span> <span class="operator">=</span> paramValue.toUpperCase(Locale.ENGLISH);</span><br><span class="line"> <span class="keyword">if</span> (ALLOWED_METHODS.contains(method)) {</span><br><span class="line"> requestToUse = <span class="keyword">new</span> <span class="title class_">HttpMethodRequestWrapper</span>(request, method);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> filterChain.doFilter(requestToUse, response);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
</li>
|
||
<li><p>兼容以下请求;PUT.DELETE.PATCH</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> List<String> ALLOWED_METHODS =</span><br><span class="line"> Collections.unmodifiableList(Arrays.asList(HttpMethod.PUT.name(),</span><br><span class="line"> HttpMethod.DELETE.name(), HttpMethod.PATCH.name()));</span><br></pre></td></tr></table></figure>
|
||
</li>
|
||
<li><p>原生request(post),包装模式requesWrapper重写了getMethod方法,返回的是传入的值</p>
|
||
</li>
|
||
<li><p>过滤器链放行的时候用wrapper,以后的方法调用getMethod是调用requesWrapper的</p>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<p><strong>Tips</strong>:</p>
|
||
<p>Rest使用客户端工具:如PostMan直接发送put、delete等方式请求,无需Filter,不需要转换</p>
|
||
<p><strong>扩展点:</strong></p>
|
||
<p>如何将<code><input name="_method" type="hidden" value="delete"/></code>中的name值_method改为自定义的值?</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Configuration(proxyBeanMethods = false)</span> <span class="comment">//组件中没有依赖关系,设置成false直接放</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WebConfig</span>{</span><br><span class="line"> <span class="meta">@Bean</span></span><br><span class="line"> <span class="keyword">public</span> HiddenHttpMethodFilter <span class="title function_">hiddenHttpMethodFilter</span><span class="params">()</span>{</span><br><span class="line"> <span class="type">HiddenHttpMethodFilter</span> <span class="variable">methodFilter</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">HiddenHttpMethodFilter</span>();</span><br><span class="line"> methodFilter.setMethodParam(<span class="string">"_m"</span>); <span class="comment">//将name="_method"改成name="_m"</span></span><br><span class="line"> <span class="keyword">return</span> methodFilter;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="2、请求映射原理"><a href="#2、请求映射原理" class="headerlink" title="2、请求映射原理"></a>2、请求映射原理</h5><p><strong>DispatcherServlet 继承 FrameworkServlet</strong> </p>
|
||
<p><strong>FrameworkServlet 继承 HttpServletBean</strong></p>
|
||
<p><strong>FrameworkServlet 重写了doGet和doPost方法</strong></p>
|
||
<p><img src="/pictures/image-20230809133846464.png" alt="image-20230809133846464"></p>
|
||
<p><strong>DispatcherServlet的doDispatch方法</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">protected</span> <span class="keyword">void</span> <span class="title function_">doDispatch</span><span class="params">(HttpServletRequest request, HttpServletResponse response)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> <span class="type">HttpServletRequest</span> <span class="variable">processedRequest</span> <span class="operator">=</span> request;</span><br><span class="line"> <span class="type">HandlerExecutionChain</span> <span class="variable">mappedHandler</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">multipartRequestParsed</span> <span class="operator">=</span> <span class="literal">false</span>;</span><br><span class="line"></span><br><span class="line"> <span class="type">WebAsyncManager</span> <span class="variable">asyncManager</span> <span class="operator">=</span> WebAsyncUtils.getAsyncManager(request);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">ModelAndView</span> <span class="variable">mv</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> <span class="type">Exception</span> <span class="variable">dispatchException</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> processedRequest = checkMultipart(request);</span><br><span class="line"> multipartRequestParsed = (processedRequest != request);</span><br><span class="line"></span><br><span class="line"> <span class="comment">// Determine handler for the current request.</span></span><br><span class="line"> <span class="comment">//找到请求使用那个hander(contrller)处理</span></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * getHandler()方法</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> mappedHandler = getHandler(processedRequest);</span><br><span class="line"> <span class="keyword">if</span> (mappedHandler == <span class="literal">null</span>) {</span><br><span class="line"> noHandlerFound(processedRequest, response);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">// Determine handler adapter for the current request.</span></span><br><span class="line"> <span class="type">HandlerAdapter</span> <span class="variable">ha</span> <span class="operator">=</span> getHandlerAdapter(mappedHandler.getHandler());</span><br><span class="line"></span><br><span class="line"> <span class="comment">// Process last-modified header, if supported by the handler.</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">method</span> <span class="operator">=</span> request.getMethod();</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isGet</span> <span class="operator">=</span> <span class="string">"GET"</span>.equals(method);</span><br><span class="line"> <span class="keyword">if</span> (isGet || <span class="string">"HEAD"</span>.equals(method)) {</span><br><span class="line"> <span class="type">long</span> <span class="variable">lastModified</span> <span class="operator">=</span> ha.getLastModified(request, mappedHandler.getHandler());</span><br><span class="line"> <span class="keyword">if</span> (<span class="keyword">new</span> <span class="title class_">ServletWebRequest</span>(request, response).checkNotModified(lastModified) && isGet) {</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span> (!mappedHandler.applyPreHandle(processedRequest, response)) {</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">// Actually invoke the handler.</span></span><br><span class="line"> mv = ha.handle(processedRequest, response, mappedHandler.getHandler());</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span> (asyncManager.isConcurrentHandlingStarted()) {</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> applyDefaultViewName(processedRequest, mv);</span><br><span class="line"> mappedHandler.applyPostHandle(processedRequest, response, mv);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">catch</span> (Exception ex) {</span><br><span class="line"> dispatchException = ex;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">catch</span> (Throwable err) {</span><br><span class="line"> <span class="comment">// As of 4.3, we're processing Errors thrown from handler methods as well,</span></span><br><span class="line"> <span class="comment">// making them available for @ExceptionHandler methods and other scenarios.</span></span><br><span class="line"> dispatchException = <span class="keyword">new</span> <span class="title class_">NestedServletException</span>(<span class="string">"Handler dispatch failed"</span>, err);</span><br><span class="line"> }</span><br><span class="line"> processDispatchResult(processedRequest, response, mappedHandler, mv, dispatchException);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">catch</span> (Exception ex) {</span><br><span class="line"> triggerAfterCompletion(processedRequest, response, mappedHandler, ex);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">catch</span> (Throwable err) {</span><br><span class="line"> triggerAfterCompletion(processedRequest, response, mappedHandler,</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">NestedServletException</span>(<span class="string">"Handler processing failed"</span>, err));</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">finally</span> {</span><br><span class="line"> <span class="keyword">if</span> (asyncManager.isConcurrentHandlingStarted()) {</span><br><span class="line"> <span class="comment">// Instead of postHandle and afterCompletion</span></span><br><span class="line"> <span class="keyword">if</span> (mappedHandler != <span class="literal">null</span>) {</span><br><span class="line"> mappedHandler.applyAfterConcurrentHandlingStarted(processedRequest, response);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">// Clean up any resources used by a multipart request.</span></span><br><span class="line"> <span class="keyword">if</span> (multipartRequestParsed) {</span><br><span class="line"> cleanupMultipart(processedRequest);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>getHandler()方法</strong> 遍历查找可以处理请求的方法</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Nullable</span></span><br><span class="line"><span class="keyword">protected</span> HandlerExecutionChain <span class="title function_">getHandler</span><span class="params">(HttpServletRequest request)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> <span class="keyword">if</span> (<span class="built_in">this</span>.handlerMappings != <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">for</span> (HandlerMapping mapping : <span class="built_in">this</span>.handlerMappings) {</span><br><span class="line"> <span class="type">HandlerExecutionChain</span> <span class="variable">handler</span> <span class="operator">=</span> mapping.getHandler(request);</span><br><span class="line"> <span class="keyword">if</span> (handler != <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">return</span> handler;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>**HandlerMapping ** 处理器映射</p>
|
||
<p>默认有5个HandlerMapping</p>
|
||
<p><img src="/pictures/image-20230809150915450.png" alt="image-20230809150915450"></p>
|
||
<p><strong>RequestMappingHandlerMapping</strong>:保存了所有@RequestMapping 和handler的映射规则</p>
|
||
<p><img src="/pictures/image-20230809151427867.png" alt="image-20230809151427867"></p>
|
||
<p>所有的请求映射都在HandlerMapping中</p>
|
||
<ul>
|
||
<li><p>SpringBoot自动配置欢迎页的 WelcomePageHandlerMapping 访问 /能访问到index.html;</p>
|
||
</li>
|
||
<li><p>SpringBoot自动配置了默认的 RequestMappingHandlerMapping</p>
|
||
</li>
|
||
<li><p>请求进来,挨个尝试所有的HandlerMapping看是否有请求信息</p>
|
||
</li>
|
||
<li><ul>
|
||
<li>如果有就找到这个请求对应的handler</li>
|
||
<li>如果没有就是下一个 HandlerMapping</li>
|
||
</ul>
|
||
</li>
|
||
<li><p>我们需要一些自定义的映射处理,我们也可以自己给容器中放<strong>HandlerMapping</strong> 自定义 <strong>HandlerMapping</strong></p>
|
||
</li>
|
||
</ul>
|
||
<h4 id="2-2、普通参数与基本注解"><a href="#2-2、普通参数与基本注解" class="headerlink" title="2.2、普通参数与基本注解"></a>2.2、普通参数与基本注解</h4><h5 id="1-注解"><a href="#1-注解" class="headerlink" title="1.注解"></a>1.注解</h5><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@PathVariable</span> <span class="comment">//获取路径中的参数信息(restful风格)</span></span><br><span class="line"><span class="meta">@RequestHeader</span> <span class="comment">//获取请求头的信息</span></span><br><span class="line"><span class="meta">@RequestAttribute</span> <span class="comment">//获取请求域中的数据</span></span><br><span class="line"><span class="meta">@RequestParam</span> <span class="comment">//获取路径中拼接的请求参数(/info?age=12&name=lisi)</span></span><br><span class="line"><span class="meta">@MatrixVariable</span> <span class="comment">//矩阵变量 /cars/sell;low=34;brand=byd,audi,yd </span></span><br><span class="line"><span class="meta">@CookieValue</span> <span class="comment">//获取cookie的值</span></span><br><span class="line"><span class="meta">@RequestBody</span> <span class="comment">//获取请求体的值(Post请求)</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>@PathVariable</strong></p>
|
||
<p>接受路径中的参数也可以使用map集合接受,但是map集合必须是Map<String, String>的形式</p>
|
||
<p><img src="/pictures/image-20230809155753715.png" alt="image-20230809155753715"></p>
|
||
<p><strong>@RequestHeader</strong></p>
|
||
<p>获取指定的请求头或者所有的请求头信息</p>
|
||
<p><img src="/pictures/image-20230809160406516.png" alt="image-20230809160406516"></p>
|
||
<p><img src="/pictures/image-20230809160846527.png" alt="image-20230809160846527"></p>
|
||
<p><strong>@RequestParam</strong></p>
|
||
<p>可以使用map接受所有的请求参数</p>
|
||
<p><img src="/pictures/image-20230809161533834.png" alt="image-20230809161533834"></p>
|
||
<p><strong>@CookieValue</strong></p>
|
||
<p>获取cookie的值,可以直接获取字符串的值也可以封装成cookie的对象</p>
|
||
<p><img src="/pictures/image-20230809164101374.png" alt="image-20230809164101374"></p>
|
||
<p><strong>@RequestBody</strong></p>
|
||
<p>这里用一个字符串接收表单数据和平时使用的不一样,开发中使用一个对象接受表单的数据</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * ·<span class="doctag">@RequestBody</span>注解</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@PostMapping("/save")</span></span><br><span class="line"><span class="keyword">public</span> Map <span class="title function_">postMethod</span><span class="params">(<span class="meta">@RequestBody</span> String content)</span>{</span><br><span class="line"> Map<String,Object> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> map.put(<span class="string">"content"</span>,content);</span><br><span class="line"> <span class="keyword">return</span> map;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230809165149278.png" alt="image-20230809165149278"></p>
|
||
<p><strong>@RequestAttribute</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot.controller;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Controller;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.GetMapping;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RequestAttribute;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.ResponseBody;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletRequest;</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">@website</span> https://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/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 class="meta">@Controller</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">RequestController</span> {</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="meta">@GetMapping("/goto")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">goToPage</span><span class="params">(HttpServletRequest request)</span>{</span><br><span class="line"></span><br><span class="line"> request.setAttribute(<span class="string">"msg"</span>,<span class="string">"获取请求域中的数据成功"</span>);</span><br><span class="line"> request.setAttribute(<span class="string">"code"</span>,<span class="number">200</span>);</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"forward:/success"</span>; <span class="comment">//转发到下面的/success请求</span></span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@ResponseBody</span></span><br><span class="line"> <span class="meta">@GetMapping("/success")</span></span><br><span class="line"> <span class="keyword">public</span> Map <span class="title function_">success</span><span class="params">(<span class="meta">@RequestAttribute(value = "msg",required = false)</span> String msg,</span></span><br><span class="line"><span class="params"> <span class="meta">@RequestAttribute(value = "code",required = false)</span>Integer code,//通过注解的方式获取上面请求域的值</span></span><br><span class="line"><span class="params"> HttpServletRequest request)</span>{<span class="comment">//通过原生的request获取</span></span><br><span class="line"> <span class="comment">//Object msg1 = request.getAttribute("msg");</span></span><br><span class="line"> Map<String,Object> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> map.put(<span class="string">"msg"</span>,msg);</span><br><span class="line"> map.put(<span class="string">"code"</span>,code);</span><br><span class="line"> <span class="keyword">return</span> map;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230811092618793.png" alt="image-20230811092618793"></p>
|
||
<p><strong>@MatrixVariable</strong></p>
|
||
<p>开启SpringBoot的矩阵变量功能</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Bean</span></span><br><span class="line"><span class="keyword">public</span> WebMvcConfigurer <span class="title function_">webMvcConfigurer</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">WebMvcConfigurer</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_">configurePathMatch</span><span class="params">(PathMatchConfigurer configurer)</span> {</span><br><span class="line"> <span class="type">UrlPathHelper</span> <span class="variable">urlPathHelper</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">UrlPathHelper</span>();</span><br><span class="line"> <span class="comment">// 不移除 后面的内容 矩阵变量功能就可以生效</span></span><br><span class="line"> urlPathHelper.setRemoveSemicolonContent(<span class="literal">false</span>);</span><br><span class="line"> configurer.setUrlPathHelper(urlPathHelper);</span><br><span class="line"> }</span><br><span class="line"> };</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>测试</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">//1、语法: 请求路径:/cars/sell;low=34;brand=byd,audi,yd</span></span><br><span class="line"><span class="comment">//2、SpringBoot默认是禁用了矩阵变量的功能</span></span><br><span class="line"><span class="comment">// 手动开启:原理。对于路径的处理。UrlPathHelper进行解析。</span></span><br><span class="line"><span class="comment">// removeSemicolonContent(移除分号内容)支持矩阵变量的</span></span><br><span class="line"><span class="comment">//3、矩阵变量必须有url路径变量才能被解析</span></span><br><span class="line"><span class="meta">@GetMapping("/cars/{path}")</span></span><br><span class="line"><span class="keyword">public</span> Map <span class="title function_">carsSell</span><span class="params">(<span class="meta">@MatrixVariable("low")</span> Integer low,</span></span><br><span class="line"><span class="params"> <span class="meta">@MatrixVariable("brand")</span> List<String> brand,</span></span><br><span class="line"><span class="params"> <span class="meta">@PathVariable("path")</span> String path)</span>{</span><br><span class="line"> Map<String,Object> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"></span><br><span class="line"> map.put(<span class="string">"low"</span>,low);</span><br><span class="line"> map.put(<span class="string">"brand"</span>,brand);</span><br><span class="line"> map.put(<span class="string">"path"</span>,path);</span><br><span class="line"> <span class="keyword">return</span> map;</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment">// /boss/1;age=20/2;age=10</span></span><br><span class="line"><span class="meta">@GetMapping("/boss/{bossId}/{empId}")</span></span><br><span class="line"><span class="keyword">public</span> Map <span class="title function_">boss</span><span class="params">(<span class="meta">@MatrixVariable(value = "age",pathVar = "bossId")</span> Integer bossAge,</span></span><br><span class="line"><span class="params"> <span class="meta">@MatrixVariable(value = "age",pathVar = "empId")</span> Integer empAge)</span>{</span><br><span class="line"> Map<String,Object> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> map.put(<span class="string">"bossAge"</span>,bossAge);</span><br><span class="line"> map.put(<span class="string">"empAge"</span>,empAge);</span><br><span class="line"> <span class="keyword">return</span> map;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230811095858532.png" alt="image-20230811095858532"></p>
|
||
<p><img src="/pictures/image-20230811095834803.png" alt="image-20230811095834803"></p>
|
||
<h5 id="2-Servlet-API"><a href="#2-Servlet-API" class="headerlink" title="2.Servlet API"></a>2.Servlet API</h5><p>WebRequest、ServletRequest、MultipartRequest、 HttpSession、javax.servlet.http.PushBuilder、Principal、InputStream、Reader、HttpMethod、Locale、TimeZone、ZoneId</p>
|
||
<p>ServletRequestMethodArgumentResolver 以上的部分参数</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="type">boolean</span> <span class="title function_">supportsParameter</span><span class="params">(MethodParameter parameter)</span> {</span><br><span class="line"> Class<?> paramType = parameter.getParameterType();</span><br><span class="line"> <span class="keyword">return</span> (WebRequest.class.isAssignableFrom(paramType) ||</span><br><span class="line"> ServletRequest.class.isAssignableFrom(paramType) ||</span><br><span class="line"> MultipartRequest.class.isAssignableFrom(paramType) ||</span><br><span class="line"> HttpSession.class.isAssignableFrom(paramType) ||</span><br><span class="line"> (pushBuilder != <span class="literal">null</span> && pushBuilder.isAssignableFrom(paramType)) ||</span><br><span class="line"> Principal.class.isAssignableFrom(paramType) ||</span><br><span class="line"> InputStream.class.isAssignableFrom(paramType) ||</span><br><span class="line"> Reader.class.isAssignableFrom(paramType) ||</span><br><span class="line"> HttpMethod.class == paramType ||</span><br><span class="line"> Locale.class == paramType ||</span><br><span class="line"> TimeZone.class == paramType ||</span><br><span class="line"> ZoneId.class == paramType);</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="3-复杂参数:"><a href="#3-复杂参数:" class="headerlink" title="3.复杂参数:"></a>3.复杂参数:</h5><p>Map、Model(map、model里面的数据会被放在request的请求域 request.setAttribute)、Errors/BindingResult、RedirectAttributes( 重定向携带数据)、ServletResponse(response)、SessionStatus、UriComponentsBuilder、ServletUriComponentsBuilder</p>
|
||
<p>向请求域中共享数据</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * ra数据通过 map model HttpServletRequest HttpServletResponse 等方式共享到请求域中,在success页面中取出来</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@GetMapping("/params")</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">testParam</span><span class="params">(Map<String,Object> map,</span></span><br><span class="line"><span class="params"> Model model,</span></span><br><span class="line"><span class="params"> HttpServletRequest request,</span></span><br><span class="line"><span class="params"> HttpServletResponse response)</span>{</span><br><span class="line"> map.put(<span class="string">"hello"</span>,<span class="string">"world666"</span>);</span><br><span class="line"> model.addAttribute(<span class="string">"world"</span>,<span class="string">"hello666"</span>);</span><br><span class="line"> request.setAttribute(<span class="string">"message"</span>,<span class="string">"HelloWorld"</span>);</span><br><span class="line"></span><br><span class="line"> <span class="type">Cookie</span> <span class="variable">cookie</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Cookie</span>(<span class="string">"c1"</span>,<span class="string">"v1"</span>);</span><br><span class="line"> response.addCookie(cookie);</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"forward:/success"</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="4-自定义对象参数"><a href="#4-自定义对象参数" class="headerlink" title="4.自定义对象参数"></a>4.自定义对象参数</h5><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 姓名: <input name="userName"/> <br/></span></span><br><span class="line"><span class="comment"> * 年龄: <input name="age"/> <br/></span></span><br><span class="line"><span class="comment"> * 生日: <input name="birth"/> <br/></span></span><br><span class="line"><span class="comment"> * 宠物姓名:<input name="pet.name"/><br/></span></span><br><span class="line"><span class="comment"> * 宠物年龄:<input name="pet.age"/></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_">Person</span> {</span><br><span class="line"> </span><br><span class="line"> <span class="keyword">private</span> String userName;</span><br><span class="line"> <span class="keyword">private</span> Integer age;</span><br><span class="line"> <span class="keyword">private</span> Date birth;</span><br><span class="line"> <span class="keyword">private</span> Pet pet;</span><br><span class="line"> </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">class</span> <span class="title class_">Pet</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String name;</span><br><span class="line"> <span class="keyword">private</span> String age;</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>页面测试代码</strong></p>
|
||
<p>index.html</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><!DOCTYPE html></span><br><span class="line"><html lang=<span class="string">"en"</span>></span><br><span class="line"><head></span><br><span class="line"> <meta charset=<span class="string">"UTF-8"</span>></span><br><span class="line"> <title>Title</title></span><br><span class="line"></head></span><br><span class="line"><body></span><br><span class="line"><h1>atguigu,欢迎您</h1></span><br><span class="line">测试REST风格;</span><br><span class="line"><form action=<span class="string">"/user"</span> method=<span class="string">"get"</span>></span><br><span class="line"> <input value=<span class="string">"REST-GET 提交"</span> type=<span class="string">"submit"</span>/></span><br><span class="line"></form></span><br><span class="line"><form action=<span class="string">"/user"</span> method=<span class="string">"post"</span>></span><br><span class="line"> <input value=<span class="string">"REST-POST 提交"</span> type=<span class="string">"submit"</span>/></span><br><span class="line"></form></span><br><span class="line"><form action=<span class="string">"/user"</span> method=<span class="string">"post"</span>></span><br><span class="line"> <input name=<span class="string">"_method"</span> type=<span class="string">"hidden"</span> value=<span class="string">"delete"</span>/></span><br><span class="line"> <input name=<span class="string">"_m"</span> type=<span class="string">"hidden"</span> value=<span class="string">"delete"</span>/></span><br><span class="line"> <input value=<span class="string">"REST-DELETE 提交"</span> type=<span class="string">"submit"</span>/></span><br><span class="line"></form></span><br><span class="line"><form action=<span class="string">"/user"</span> method=<span class="string">"post"</span>></span><br><span class="line"> <input name=<span class="string">"_method"</span> type=<span class="string">"hidden"</span> value=<span class="string">"PUT"</span>/></span><br><span class="line"> <input value=<span class="string">"REST-PUT 提交"</span> type=<span class="string">"submit"</span>/></span><br><span class="line"></form></span><br><span class="line"><hr/></span><br><span class="line">测试基本注解:</span><br><span class="line"><ul></span><br><span class="line"> <a href=<span class="string">"car/3/owner/lisi?age=18&inters=basketball&inters=game"</span>>car/{id}/owner/{username}</a></span><br><span class="line"> <li><span class="meta">@PathVariable</span>(路径变量)</li></span><br><span class="line"> <li><span class="meta">@RequestHeader</span>(获取请求头)</li></span><br><span class="line"> <li><span class="meta">@RequestParam</span>(获取请求参数)</li></span><br><span class="line"> <li><span class="meta">@CookieValue</span>(获取cookie值)</li></span><br><span class="line"> <li><span class="meta">@RequestBody</span>(获取请求体[POST])</li></span><br><span class="line"></span><br><span class="line"> <li><span class="meta">@RequestAttribute</span>(获取request域属性)</li></span><br><span class="line"> <li><span class="meta">@MatrixVariable</span>(矩阵变量)</li></span><br><span class="line"></ul></span><br><span class="line"></span><br><span class="line">/cars/{path}?xxx=xxx&aaa=ccc queryString 查询字符串。<span class="meta">@RequestParam</span>;<br/></span><br><span class="line">/cars/sell;low=<span class="number">34</span>;brand=byd,audi,yd ;矩阵变量 <br/></span><br><span class="line">页面开发,cookie禁用了,session里面的内容怎么使用;</span><br><span class="line">session.set(a,b)---> jsessionid ---> cookie ----> 每次发请求携带。</span><br><span class="line">url重写:/abc;jsesssionid=xxxx 把cookie的值使用矩阵变量的方式进行传递.</span><br><span class="line"></span><br><span class="line">/boss/<span class="number">1</span>/<span class="number">2</span></span><br><span class="line"></span><br><span class="line">/boss/<span class="number">1</span>;age=<span class="number">20</span>/<span class="number">2</span>;age=<span class="number">20</span></span><br><span class="line"></span><br><span class="line"><a href=<span class="string">"/cars/sell;low=34;brand=byd,audi,yd"</span>><span class="meta">@MatrixVariable</span>(矩阵变量)</a></span><br><span class="line"><a href=<span class="string">"/cars/sell;low=34;brand=byd;brand=audi;brand=yd"</span>><span class="meta">@MatrixVariable</span>(矩阵变量)</a></span><br><span class="line"><a href=<span class="string">"/boss/1;age=20/2;age=10"</span>><span class="meta">@MatrixVariable</span>(矩阵变量)/boss/{bossId}/{empId}</a></span><br><span class="line"><br/></span><br><span class="line"><form action=<span class="string">"/save"</span> method=<span class="string">"post"</span>></span><br><span class="line"> 测试<span class="meta">@RequestBody</span>获取数据 <br/></span><br><span class="line"> 用户名:<input name=<span class="string">"userName"</span>/> <br></span><br><span class="line"> 邮箱:<input name=<span class="string">"email"</span>/></span><br><span class="line"> <input type=<span class="string">"submit"</span> value=<span class="string">"提交"</span>/></span><br><span class="line"></form></span><br><span class="line"><ol></span><br><span class="line"> <li>矩阵变量需要在SpringBoot中手动开启</li></span><br><span class="line"> <li>根据RFC3986的规范,矩阵变量应当绑定在路径变量中!</li></span><br><span class="line"> <li>若是有多个矩阵变量,应当使用英文符号;进行分隔。</li></span><br><span class="line"> <li>若是一个矩阵变量有多个值,应当使用英文符号,进行分隔,或之命名多个重复的key即可。</li></span><br><span class="line"> <li>如:/cars/sell;low=<span class="number">34</span>;brand=byd,audi,yd</li></span><br><span class="line"></ol></span><br><span class="line"><hr/></span><br><span class="line">测试原生API:</span><br><span class="line"><a href=<span class="string">"/testapi"</span>>测试原生API</a></span><br><span class="line"><hr/></span><br><span class="line">测试复杂类型:<hr/></span><br><span class="line">测试封装POJO;</span><br><span class="line"><form action=<span class="string">"/saveuser"</span> method=<span class="string">"post"</span>></span><br><span class="line"> 姓名: <input name=<span class="string">"userName"</span> value=<span class="string">"zhangsan"</span>/> <br/></span><br><span class="line"> 年龄: <input name=<span class="string">"age"</span> value=<span class="string">"18"</span>/> <br/></span><br><span class="line"> 生日: <input name=<span class="string">"birth"</span> value=<span class="string">"2019/12/10"</span>/> <br/></span><br><span class="line"><!-- 宠物姓名:<input name=<span class="string">"pet.name"</span> value=<span class="string">"阿猫"</span>/><br/>--></span><br><span class="line"><!-- 宠物年龄:<input name=<span class="string">"pet.age"</span> value=<span class="string">"5"</span>/>--></span><br><span class="line"> 宠物: <input name=<span class="string">"pet"</span> value=<span class="string">"小猫"</span>/></span><br><span class="line"> <input type=<span class="string">"submit"</span> value=<span class="string">"保存"</span>/></span><br><span class="line"></form></span><br><span class="line"><br></span><br><span class="line"></body></span><br><span class="line"></html></span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
<h4 id="2-3-参数处理原理"><a href="#2-3-参数处理原理" class="headerlink" title="2.3 参数处理原理"></a>2.3 参数处理原理</h4><p><strong>1.页面发送请求</strong></p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">http://localhost:8080/car/3/owner/lisi </span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>2.进入DispatcherServlet的doDispatch( )方法</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">protected</span> <span class="keyword">void</span> <span class="title function_">doDispatch</span><span class="params">(HttpServletRequest request, HttpServletResponse response)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> <span class="type">HttpServletRequest</span> <span class="variable">processedRequest</span> <span class="operator">=</span> request;</span><br><span class="line"> <span class="type">HandlerExecutionChain</span> <span class="variable">mappedHandler</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">multipartRequestParsed</span> <span class="operator">=</span> <span class="literal">false</span>;</span><br><span class="line"></span><br><span class="line"> <span class="type">WebAsyncManager</span> <span class="variable">asyncManager</span> <span class="operator">=</span> WebAsyncUtils.getAsyncManager(request);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">ModelAndView</span> <span class="variable">mv</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> <span class="type">Exception</span> <span class="variable">dispatchException</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> processedRequest = checkMultipart(request);</span><br><span class="line"> multipartRequestParsed = (processedRequest != request);</span><br><span class="line"></span><br><span class="line"> <span class="comment">// Determine handler for the current request.</span></span><br><span class="line"> mappedHandler = getHandler(processedRequest);</span><br><span class="line"> <span class="keyword">if</span> (mappedHandler == <span class="literal">null</span>) {</span><br><span class="line"> noHandlerFound(processedRequest, response);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">// Determine handler adapter for the current request.</span></span><br><span class="line"> <span class="type">HandlerAdapter</span> <span class="variable">ha</span> <span class="operator">=</span> getHandlerAdapter(mappedHandler.getHandler());</span><br><span class="line"></span><br><span class="line"> <span class="comment">// Process last-modified header, if supported by the handler.</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">method</span> <span class="operator">=</span> request.getMethod();</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isGet</span> <span class="operator">=</span> <span class="string">"GET"</span>.equals(method);</span><br><span class="line"> <span class="keyword">if</span> (isGet || <span class="string">"HEAD"</span>.equals(method)) {</span><br><span class="line"> <span class="type">long</span> <span class="variable">lastModified</span> <span class="operator">=</span> ha.getLastModified(request, mappedHandler.getHandler());</span><br><span class="line"> <span class="keyword">if</span> (<span class="keyword">new</span> <span class="title class_">ServletWebRequest</span>(request, response).checkNotModified(lastModified) && isGet) {</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span> (!mappedHandler.applyPreHandle(processedRequest, response)) {</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">// Actually invoke the handler.</span></span><br><span class="line"> mv = ha.handle(processedRequest, response, mappedHandler.getHandler());</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span> (asyncManager.isConcurrentHandlingStarted()) {</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> applyDefaultViewName(processedRequest, mv);</span><br><span class="line"> mappedHandler.applyPostHandle(processedRequest, response, mv);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">catch</span> (Exception ex) {</span><br><span class="line"> dispatchException = ex;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">catch</span> (Throwable err) {</span><br><span class="line"> <span class="comment">// As of 4.3, we're processing Errors thrown from handler methods as well,</span></span><br><span class="line"> <span class="comment">// making them available for @ExceptionHandler methods and other scenarios.</span></span><br><span class="line"> dispatchException = <span class="keyword">new</span> <span class="title class_">NestedServletException</span>(<span class="string">"Handler dispatch failed"</span>, err);</span><br><span class="line"> }</span><br><span class="line"> processDispatchResult(processedRequest, response, mappedHandler, mv, dispatchException);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">catch</span> (Exception ex) {</span><br><span class="line"> triggerAfterCompletion(processedRequest, response, mappedHandler, ex);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">catch</span> (Throwable err) {</span><br><span class="line"> triggerAfterCompletion(processedRequest, response, mappedHandler,</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">NestedServletException</span>(<span class="string">"Handler processing failed"</span>, err));</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">finally</span> {</span><br><span class="line"> <span class="keyword">if</span> (asyncManager.isConcurrentHandlingStarted()) {</span><br><span class="line"> <span class="comment">// Instead of postHandle and afterCompletion</span></span><br><span class="line"> <span class="keyword">if</span> (mappedHandler != <span class="literal">null</span>) {</span><br><span class="line"> mappedHandler.applyAfterConcurrentHandlingStarted(processedRequest, response);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">// Clean up any resources used by a multipart request.</span></span><br><span class="line"> <span class="keyword">if</span> (multipartRequestParsed) {</span><br><span class="line"> cleanupMultipart(processedRequest);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>3.封装一个方法获取对应的处理器适配器</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">//方法的调用</span></span><br><span class="line"><span class="type">HandlerAdapter</span> <span class="variable">ha</span> <span class="operator">=</span> getHandlerAdapter(mappedHandler.getHandler());</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>4.遍历所有的处理器适配器(一共有四种,如下图)找到支持的适配器</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">protected</span> HandlerAdapter <span class="title function_">getHandlerAdapter</span><span class="params">(Object handler)</span> <span class="keyword">throws</span> ServletException {</span><br><span class="line"> <span class="keyword">if</span> (<span class="built_in">this</span>.handlerAdapters != <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">for</span> (HandlerAdapter adapter : <span class="built_in">this</span>.handlerAdapters) {</span><br><span class="line"> <span class="keyword">if</span> (adapter.supports(handler)) {</span><br><span class="line"> <span class="keyword">return</span> adapter;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">ServletException</span>(<span class="string">"No adapter for handler ["</span> + handler +</span><br><span class="line"> <span class="string">"]: The DispatcherServlet configuration needs to include a HandlerAdapter that supports this handler"</span>);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230812091950114.png" alt="image-20230812091950114"></p>
|
||
<p>上图中四个处理器适配器中前两个是常用的处理器适配器: 0 - 支持方法上标注@RequestMapping 1 - 支持函数式编程的</p>
|
||
<p><strong>5.查看当前的处理器适配器是否支持的方法</strong></p>
|
||
<figure class="highlight java"><table><tr><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">final</span> <span class="type">boolean</span> <span class="title function_">supports</span><span class="params">(Object handler)</span> {</span><br><span class="line"> <span class="comment">//条件一 handler instanceof HandlerMethod</span></span><br><span class="line"> <span class="comment">//条件二 supportsInternal((HandlerMethod) handler)</span></span><br><span class="line"> <span class="keyword">return</span> (handler <span class="keyword">instanceof</span> HandlerMethod && supportsInternal((HandlerMethod) handler));</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>遍历查找之后返回的适配器是RequestMappingHandlerAdapter</p>
|
||
<p><img src="/pictures/image-20230812092825385.png" alt="image-20230812092825385"></p>
|
||
<p><strong>6.回到DispatcherServlet执行下面的方法</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">//根据上面获取到的处理器适配器真正的执行处理器方法</span></span><br><span class="line"><span class="comment">// Actually invoke the handler.</span></span><br><span class="line">mv = ha.handle(processedRequest, response, mappedHandler.getHandler());</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>7.内部的处理过程</strong></p>
|
||
<p>handle( )方法</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Override</span></span><br><span class="line"><span class="meta">@Nullable</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">final</span> ModelAndView <span class="title function_">handle</span><span class="params">(HttpServletRequest request, HttpServletResponse response, Object handler)</span></span><br><span class="line"><span class="keyword">throws</span> Exception {</span><br><span class="line"> <span class="keyword">return</span> handleInternal(request, response, (HandlerMethod) handler);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>进入当前处理器适配器的handleInternal( )方法</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Override</span></span><br><span class="line"><span class="keyword">protected</span> ModelAndView <span class="title function_">handleInternal</span><span class="params">(HttpServletRequest request,</span></span><br><span class="line"><span class="params"> HttpServletResponse response, HandlerMethod handlerMethod)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"></span><br><span class="line"> ModelAndView mav;</span><br><span class="line"> checkRequest(request);</span><br><span class="line"></span><br><span class="line"> <span class="comment">// Execute invokeHandlerMethod in synchronized block if required.</span></span><br><span class="line"> <span class="keyword">if</span> (<span class="built_in">this</span>.synchronizeOnSession) {</span><br><span class="line"> <span class="type">HttpSession</span> <span class="variable">session</span> <span class="operator">=</span> request.getSession(<span class="literal">false</span>);</span><br><span class="line"> <span class="keyword">if</span> (session != <span class="literal">null</span>) {</span><br><span class="line"> <span class="type">Object</span> <span class="variable">mutex</span> <span class="operator">=</span> WebUtils.getSessionMutex(session);</span><br><span class="line"> <span class="keyword">synchronized</span> (mutex) {</span><br><span class="line"> mav = invokeHandlerMethod(request, response, handlerMethod);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">// No HttpSession available -> no mutex necessary</span></span><br><span class="line"> mav = invokeHandlerMethod(request, response, handlerMethod);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">// No synchronization on session demanded at all...</span></span><br><span class="line"> mav = invokeHandlerMethod(request, response, handlerMethod);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span> (!response.containsHeader(HEADER_CACHE_CONTROL)) {</span><br><span class="line"> <span class="keyword">if</span> (getSessionAttributesHandler(handlerMethod).hasSessionAttributes()) {</span><br><span class="line"> applyCacheSeconds(response, <span class="built_in">this</span>.cacheSecondsForSessionAttributeHandlers);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">else</span> {</span><br><span class="line"> prepareResponse(response);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> mav;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>执行invokeHandlerMethod( )方法</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line">mav = invokeHandlerMethod(request, response, handlerMethod);</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>进入invokeHandlerMethod()方法</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Nullable</span></span><br><span class="line"><span class="keyword">protected</span> ModelAndView <span class="title function_">invokeHandlerMethod</span><span class="params">(HttpServletRequest request,</span></span><br><span class="line"><span class="params"> HttpServletResponse response, HandlerMethod handlerMethod)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"></span><br><span class="line"> <span class="type">ServletWebRequest</span> <span class="variable">webRequest</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ServletWebRequest</span>(request, response);</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">WebDataBinderFactory</span> <span class="variable">binderFactory</span> <span class="operator">=</span> getDataBinderFactory(handlerMethod);</span><br><span class="line"> <span class="type">ModelFactory</span> <span class="variable">modelFactory</span> <span class="operator">=</span> getModelFactory(handlerMethod, binderFactory);</span><br><span class="line"></span><br><span class="line"> <span class="type">ServletInvocableHandlerMethod</span> <span class="variable">invocableMethod</span> <span class="operator">=</span> createInvocableHandlerMethod(handlerMethod);</span><br><span class="line"> <span class="keyword">if</span> (<span class="built_in">this</span>.argumentResolvers != <span class="literal">null</span>) {</span><br><span class="line"> invocableMethod.setHandlerMethodArgumentResolvers(<span class="built_in">this</span>.argumentResolvers);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (<span class="built_in">this</span>.returnValueHandlers != <span class="literal">null</span>) {</span><br><span class="line"> invocableMethod.setHandlerMethodReturnValueHandlers(<span class="built_in">this</span>.returnValueHandlers);</span><br><span class="line"> }</span><br><span class="line"> invocableMethod.setDataBinderFactory(binderFactory);</span><br><span class="line"> invocableMethod.setParameterNameDiscoverer(<span class="built_in">this</span>.parameterNameDiscoverer);</span><br><span class="line"></span><br><span class="line"> <span class="type">ModelAndViewContainer</span> <span class="variable">mavContainer</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ModelAndViewContainer</span>();</span><br><span class="line"> mavContainer.addAllAttributes(RequestContextUtils.getInputFlashMap(request));</span><br><span class="line"> modelFactory.initModel(webRequest, mavContainer, invocableMethod);</span><br><span class="line"> mavContainer.setIgnoreDefaultModelOnRedirect(<span class="built_in">this</span>.ignoreDefaultModelOnRedirect);</span><br><span class="line"></span><br><span class="line"> <span class="type">AsyncWebRequest</span> <span class="variable">asyncWebRequest</span> <span class="operator">=</span> WebAsyncUtils.createAsyncWebRequest(request, response);</span><br><span class="line"> asyncWebRequest.setTimeout(<span class="built_in">this</span>.asyncRequestTimeout);</span><br><span class="line"></span><br><span class="line"> <span class="type">WebAsyncManager</span> <span class="variable">asyncManager</span> <span class="operator">=</span> WebAsyncUtils.getAsyncManager(request);</span><br><span class="line"> asyncManager.setTaskExecutor(<span class="built_in">this</span>.taskExecutor);</span><br><span class="line"> asyncManager.setAsyncWebRequest(asyncWebRequest);</span><br><span class="line"> asyncManager.registerCallableInterceptors(<span class="built_in">this</span>.callableInterceptors);</span><br><span class="line"> asyncManager.registerDeferredResultInterceptors(<span class="built_in">this</span>.deferredResultInterceptors);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span> (asyncManager.hasConcurrentResult()) {</span><br><span class="line"> <span class="type">Object</span> <span class="variable">result</span> <span class="operator">=</span> asyncManager.getConcurrentResult();</span><br><span class="line"> mavContainer = (ModelAndViewContainer) asyncManager.getConcurrentResultContext()[<span class="number">0</span>];</span><br><span class="line"> asyncManager.clearConcurrentResult();</span><br><span class="line"> LogFormatUtils.traceDebug(logger, traceOn -> {</span><br><span class="line"> <span class="type">String</span> <span class="variable">formatted</span> <span class="operator">=</span> LogFormatUtils.formatValue(result, !traceOn);</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"Resume with async result ["</span> + formatted + <span class="string">"]"</span>;</span><br><span class="line"> });</span><br><span class="line"> invocableMethod = invocableMethod.wrapConcurrentResult(result);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> invocableMethod.invokeAndHandle(webRequest, mavContainer);</span><br><span class="line"> <span class="keyword">if</span> (asyncManager.isConcurrentHandlingStarted()) {</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> getModelAndView(mavContainer, modelFactory, webRequest);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">finally</span> {</span><br><span class="line"> webRequest.requestCompleted();</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>注意这里的26个参数解析器,参数解析器的作用是确定将要执行的目标方法的每一个参数的值是什么</p>
|
||
<p>这里的每一个参数解析器都对应了我们标注在参数上的注解</p>
|
||
<p>SpringMVC目标方法能写多少种参数类型取决于参数解析器</p>
|
||
<p><img src="/pictures/image-20230812094224699.png" alt="image-20230812094224699"></p>
|
||
<p>参数解析器的接口设计</p>
|
||
<p><img src="/pictures/image-20230812094755583.png" alt="image-20230812094755583"></p>
|
||
<ul>
|
||
<li>当前解析器是否支持解析这种参数</li>
|
||
<li>支持就调用 resolveArgument</li>
|
||
</ul>
|
||
<p>返回值处理器</p>
|
||
<p>定义了controller返回值的类型</p>
|
||
<img src="/pictures/image-20230812095137195.png" alt="image-20230812095137195" style="zoom:150%;" />
|
||
|
||
<p>RequestMappingHandlerAdapter的invokeAndHandle( )方法真正的执行请求</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line">invocableMethod.invokeAndHandle(webRequest, mavContainer);</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">invokeAndHandle</span><span class="params">(ServletWebRequest webRequest, ModelAndViewContainer mavContainer,</span></span><br><span class="line"><span class="params"> Object... providedArgs)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"></span><br><span class="line"> <span class="type">Object</span> <span class="variable">returnValue</span> <span class="operator">=</span> invokeForRequest(webRequest, mavContainer, providedArgs);</span><br><span class="line"> <span class="comment">//上面一行代码执行完毕之后会直接跳到controller方法,然后执行下面的代码</span></span><br><span class="line"> setResponseStatus(webRequest);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span> (returnValue == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">if</span> (isRequestNotModified(webRequest) || getResponseStatus() != <span class="literal">null</span> || mavContainer.isRequestHandled()) {</span><br><span class="line"> disableContentCachingIfNecessary(webRequest);</span><br><span class="line"> mavContainer.setRequestHandled(<span class="literal">true</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">else</span> <span class="keyword">if</span> (StringUtils.hasText(getResponseStatusReason())) {</span><br><span class="line"> mavContainer.setRequestHandled(<span class="literal">true</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> mavContainer.setRequestHandled(<span class="literal">false</span>);</span><br><span class="line"> Assert.state(<span class="built_in">this</span>.returnValueHandlers != <span class="literal">null</span>, <span class="string">"No return value handlers"</span>);</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="built_in">this</span>.returnValueHandlers.handleReturnValue(</span><br><span class="line"> returnValue, getReturnValueType(returnValue), mavContainer, webRequest);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">catch</span> (Exception ex) {</span><br><span class="line"> <span class="keyword">if</span> (logger.isTraceEnabled()) {</span><br><span class="line"> logger.trace(formatErrorForReturnValue(returnValue), ex);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">throw</span> ex;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>执行的过程</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="type">Object</span> <span class="variable">returnValue</span> <span class="operator">=</span> invokeForRequest(webRequest, mavContainer, providedArgs);</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Nullable</span></span><br><span class="line"><span class="keyword">public</span> Object <span class="title function_">invokeForRequest</span><span class="params">(NativeWebRequest request, <span class="meta">@Nullable</span> ModelAndViewContainer mavContainer,</span></span><br><span class="line"><span class="params"> Object... providedArgs)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"></span><br><span class="line"> Object[] args = getMethodArgumentValues(request, mavContainer, providedArgs);</span><br><span class="line"> <span class="comment">//这个args就记录了方法上所有的参数</span></span><br><span class="line"> <span class="keyword">if</span> (logger.isTraceEnabled()) {</span><br><span class="line"> logger.trace(<span class="string">"Arguments: "</span> + Arrays.toString(args));</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> doInvoke(args);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230812100059378.png" alt="image-20230812100059378"></p>
|
||
<p>获取方法参数值的过程</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line">Object[] args = getMethodArgumentValues(request, mavContainer, providedArgs);</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">protected</span> Object[] getMethodArgumentValues(NativeWebRequest request, <span class="meta">@Nullable</span> ModelAndViewContainer mavContainer,</span><br><span class="line"> Object... providedArgs) <span class="keyword">throws</span> Exception {</span><br><span class="line"></span><br><span class="line"> </span><br><span class="line"> <span class="comment">//获取所有参数的参数声明 参数类型 标注的注解 </span></span><br><span class="line"> MethodParameter[] parameters = getMethodParameters();</span><br><span class="line"> <span class="keyword">if</span> (ObjectUtils.isEmpty(parameters)) {</span><br><span class="line"> <span class="keyword">return</span> EMPTY_ARGS;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> Object[] args = <span class="keyword">new</span> <span class="title class_">Object</span>[parameters.length];</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < parameters.length; i++) {</span><br><span class="line"> <span class="type">MethodParameter</span> <span class="variable">parameter</span> <span class="operator">=</span> parameters[i];</span><br><span class="line"> parameter.initParameterNameDiscovery(<span class="built_in">this</span>.parameterNameDiscoverer);</span><br><span class="line"> args[i] = findProvidedArgument(parameter, providedArgs);</span><br><span class="line"> <span class="keyword">if</span> (args[i] != <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">continue</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (!<span class="built_in">this</span>.resolvers.supportsParameter(parameter)) {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">IllegalStateException</span>(formatArgumentError(parameter, <span class="string">"No suitable resolver"</span>));</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> args[i] = <span class="built_in">this</span>.resolvers.resolveArgument(parameter, mavContainer, request, <span class="built_in">this</span>.dataBinderFactory);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">catch</span> (Exception ex) {</span><br><span class="line"> <span class="comment">// Leave stack trace for later, exception may actually be resolved and handled...</span></span><br><span class="line"> <span class="keyword">if</span> (logger.isDebugEnabled()) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">exMsg</span> <span class="operator">=</span> ex.getMessage();</span><br><span class="line"> <span class="keyword">if</span> (exMsg != <span class="literal">null</span> && !exMsg.contains(parameter.getExecutable().toGenericString())) {</span><br><span class="line"> logger.debug(formatArgumentError(parameter, exMsg));</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">throw</span> ex;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> args;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>遍历判断获取支持解析该参数的参数解析器</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Nullable</span></span><br><span class="line"><span class="keyword">private</span> HandlerMethodArgumentResolver <span class="title function_">getArgumentResolver</span><span class="params">(MethodParameter parameter)</span> {</span><br><span class="line"> <span class="type">HandlerMethodArgumentResolver</span> <span class="variable">result</span> <span class="operator">=</span> <span class="built_in">this</span>.argumentResolverCache.get(parameter);</span><br><span class="line"> <span class="keyword">if</span> (result == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">for</span> (HandlerMethodArgumentResolver resolver : <span class="built_in">this</span>.argumentResolvers) {</span><br><span class="line"> <span class="keyword">if</span> (resolver.supportsParameter(parameter)) {</span><br><span class="line"> result = resolver;</span><br><span class="line"> <span class="built_in">this</span>.argumentResolverCache.put(parameter, result);</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> result;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>解析参数的值通过调用各自 HandlerMethodArgumentResolver 的 resolveArgument 方法</p>
|
||
<h4 id="2-4-数据响应与内容协商"><a href="#2-4-数据响应与内容协商" class="headerlink" title="2.4 数据响应与内容协商"></a>2.4 数据响应与内容协商</h4><p>返回值的处理逻辑</p>
|
||
<h5 id="2-4-1-相关依赖的引入"><a href="#2-4-1-相关依赖的引入" class="headerlink" title="2.4.1 相关依赖的引入"></a>2.4.1 相关依赖的引入</h5><p>创建springBoot项目的时候导入了spring-boot-starter-web依赖会自动的帮我们导入相关的json依赖,便于json数据的前后端传递</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-web<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>自动的帮我们导入相关的json的starter</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-json<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.3.4.RELEASE<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">scope</span>></span>compile<span class="tag"></<span class="name">scope</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>在spring-boot-starter-json中引入了jackson相关的依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.fasterxml.jackson.core<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>jackson-databind<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.11.2<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">scope</span>></span>compile<span class="tag"></<span class="name">scope</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.fasterxml.jackson.datatype<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>jackson-datatype-jdk8<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.11.2<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">scope</span>></span>compile<span class="tag"></<span class="name">scope</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.fasterxml.jackson.datatype<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>jackson-datatype-jsr310<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.11.2<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">scope</span>></span>compile<span class="tag"></<span class="name">scope</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.fasterxml.jackson.module<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>jackson-module-parameter-names<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.11.2<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">scope</span>></span>compile<span class="tag"></<span class="name">scope</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>返回值解析器的原理</strong></p>
|
||
<ul>
|
||
<li><p>1、返回值处理器判断是否支持这种类型返回值 supportsReturnType</p>
|
||
</li>
|
||
<li><p>2、返回值处理器调用 handleReturnValue 进行处理</p>
|
||
</li>
|
||
<li><p>3、RequestResponseBodyMethodProcessor 可以处理返回值标了@ResponseBody 注解的。</p>
|
||
</li>
|
||
<li><ul>
|
||
<li><ol>
|
||
<li>利用 MessageConverters 进行处理 将数据写为json</li>
|
||
</ol>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li><ul>
|
||
<li><ul>
|
||
<li>1、内容协商(浏览器默认会以请求头的方式告诉服务器他能接受什么样的内容类型)</li>
|
||
<li>2、服务器最终根据自己自身的能力,决定服务器能生产出什么样内容类型的数据,</li>
|
||
<li>3、SpringMVC会挨个遍历所有容器底层的 HttpMessageConverter ,看谁能处理?</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li><ul>
|
||
<li><ul>
|
||
<li><ul>
|
||
<li>1、得到MappingJackson2HttpMessageConverter可以将对象写为json</li>
|
||
<li>2、利用MappingJackson2HttpMessageConverter将对象转为json再写出去。</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<h5 id="2-4-2-内容协商原理"><a href="#2-4-2-内容协商原理" class="headerlink" title="2.4.2 内容协商原理"></a>2.4.2 内容协商原理</h5><p>引入jackson-dataformat-xml,测试返回是xml格式的数据</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.fasterxml.jackson.dataformat<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>jackson-dataformat-xml<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>开启基于请求参数的内容协商功能</p>
|
||
<p>发请求: <a href="http://localhost:8080/test/person?format=json">http://localhost:8080/test/person?format=json</a> //指定格式是json </p>
|
||
<p> <a href="http://localhost:8080/test/person?format=xml">http://localhost:8080/test/person?format=xml</a> //指定格式是xml</p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">spring:</span></span><br><span class="line"> <span class="attr">contentnegotiation:</span></span><br><span class="line"> <span class="attr">favor-parameter:</span> <span class="literal">true</span> <span class="comment">#开启请求参数内容协商模式</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>1、Parameter策略优先确定是要返回json数据(获取请求头中的format的值)</p>
|
||
<p>2、最终进行内容协商返回给客户端json即可</p>
|
||
<p>3、遍历循环所有当前系统的 MessageConverter,看谁支持操作这个对象(Person)</p>
|
||
<p>4、找到支持操作Person的converter,把converter支持的媒体类型统计出来。</p>
|
||
<p>5、客户端需要【application/xml】。服务端能力【10种、json、xml】</p>
|
||
<p>6、进行内容协商的最佳匹配媒体类型</p>
|
||
<p>7、用 支持 将对象转为 最佳匹配媒体类型 的converter。调用它进行转化 。</p>
|
||
<h5 id="2-4-3-自定义MessageConverter"><a href="#2-4-3-自定义MessageConverter" class="headerlink" title="2.4.3 自定义MessageConverter"></a>2.4.3 自定义MessageConverter</h5><p>1、@ResponseBody 响应数据出去 调用 RequestResponseBodyMethodProcessor 处理</p>
|
||
<p>2、Processor 处理方法返回值。通过 MessageConverter 处理</p>
|
||
<p>3、所有 MessageConverter 合起来可以支持各种媒体类型数据的操作(读、写)</p>
|
||
<p>4、内容协商找到最终的 messageConverter;</p>
|
||
<p> <strong>步骤:</strong><br>1、添加自定义的MessageConverter进系统底层</p>
|
||
<p>2、系统底层就会统计出所有MessageConverter能操作哪些类型</p>
|
||
<p>3、客户端内容协商 [guigu—>guigu]</p>
|
||
<p>编写自定义的的converter</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot.converter;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.atguigu.boot.bean.Person;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.HttpInputMessage;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.HttpOutputMessage;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.MediaType;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.converter.HttpMessageConverter;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.converter.HttpMessageNotReadableException;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.converter.HttpMessageNotWritableException;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.io.OutputStream;</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"> * 自定义的Converter</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">GuiguMessageConverter</span> <span class="keyword">implements</span> <span class="title class_">HttpMessageConverter</span><Person> {</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> <span class="type">boolean</span> <span class="title function_">canRead</span><span class="params">(Class<?> clazz, MediaType mediaType)</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"> }</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> <span class="type">boolean</span> <span class="title function_">canWrite</span><span class="params">(Class<?> clazz, MediaType mediaType)</span> {</span><br><span class="line"> <span class="keyword">return</span> clazz.isAssignableFrom(Person.class);</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"> * 服务器要统计所有MessageConverter都能写出哪些内容类型</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * application/x-guigu</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<MediaType> <span class="title function_">getSupportedMediaTypes</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> MediaType.parseMediaTypes(<span class="string">"application/x-guigu"</span>);</span><br><span class="line"> }</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> Person <span class="title function_">read</span><span class="params">(Class<? extends Person> clazz, HttpInputMessage inputMessage)</span> <span class="keyword">throws</span> IOException, HttpMessageNotReadableException {</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</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> <span class="keyword">void</span> <span class="title function_">write</span><span class="params">(Person person, MediaType contentType, HttpOutputMessage outputMessage)</span> <span class="keyword">throws</span> IOException, HttpMessageNotWritableException {</span><br><span class="line"> <span class="comment">//自定义协议数据的写出</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">data</span> <span class="operator">=</span> person.getUserName()+<span class="string">";"</span>+person.getAge()+<span class="string">";"</span>+person.getBirth();</span><br><span class="line"> <span class="comment">//写出去</span></span><br><span class="line"> <span class="type">OutputStream</span> <span class="variable">body</span> <span class="operator">=</span> outputMessage.getBody();</span><br><span class="line"> body.write(data.getBytes());</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>在配置文件中加入自定义的converter</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot.config;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.atguigu.boot.bean.Person;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.boot.bean.Pet;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.boot.converter.GuiguMessageConverter;</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.core.convert.converter.Converter;</span><br><span class="line"><span class="keyword">import</span> org.springframework.format.FormatterRegistry;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.HttpInputMessage;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.HttpOutputMessage;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.MediaType;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.converter.HttpMessageConverter;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.converter.HttpMessageNotReadableException;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.converter.HttpMessageNotWritableException;</span><br><span class="line"><span class="keyword">import</span> org.springframework.util.StringUtils;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.accept.HeaderContentNegotiationStrategy;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.accept.ParameterContentNegotiationStrategy;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.filter.HiddenHttpMethodFilter;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.servlet.config.annotation.PathMatchConfigurer;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.servlet.config.annotation.WebMvcConfigurer;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.util.UrlPathHelper;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.io.OutputStream;</span><br><span class="line"><span class="keyword">import</span> java.util.*;</span><br><span class="line"></span><br><span class="line"><span class="meta">@Configuration(proxyBeanMethods = false)</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WebConfig</span> {</span><br><span class="line"> <span class="meta">@Bean</span></span><br><span class="line"> <span class="keyword">public</span> WebMvcConfigurer <span class="title function_">webMvcConfigurer</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">WebMvcConfigurer</span>() {</span><br><span class="line"> <span class="comment">//加入自定义的converter</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_">extendMessageConverters</span><span class="params">(List<HttpMessageConverter<?>> converters)</span> {</span><br><span class="line"> converters.add(<span class="keyword">new</span> <span class="title class_">GuiguMessageConverter</span>());</span><br><span class="line"> }</span><br><span class="line"> };</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>在浏览器url上拼接参数的形式实现内容协商</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot.config;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.atguigu.boot.bean.Person;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.boot.bean.Pet;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.boot.converter.GuiguMessageConverter;</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.core.convert.converter.Converter;</span><br><span class="line"><span class="keyword">import</span> org.springframework.format.FormatterRegistry;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.HttpInputMessage;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.HttpOutputMessage;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.MediaType;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.converter.HttpMessageConverter;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.converter.HttpMessageNotReadableException;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.converter.HttpMessageNotWritableException;</span><br><span class="line"><span class="keyword">import</span> org.springframework.util.StringUtils;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.accept.HeaderContentNegotiationStrategy;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.accept.ParameterContentNegotiationStrategy;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.filter.HiddenHttpMethodFilter;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.servlet.config.annotation.PathMatchConfigurer;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.servlet.config.annotation.WebMvcConfigurer;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.util.UrlPathHelper;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.io.OutputStream;</span><br><span class="line"><span class="keyword">import</span> java.util.*;</span><br><span class="line"></span><br><span class="line"><span class="meta">@Configuration(proxyBeanMethods = false)</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WebConfig</span>{</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> WebMvcConfigurer <span class="title function_">webMvcConfigurer</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">WebMvcConfigurer</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 class="doctag">@param</span> configurer</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_">configureContentNegotiation</span><span class="params">(ContentNegotiationConfigurer configurer)</span> {</span><br><span class="line"> Map<String, MediaType> mediaTypes = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> mediaTypes.put(<span class="string">"json"</span>,MediaType.APPLICATION_JSON);</span><br><span class="line"> mediaTypes.put(<span class="string">"xml"</span>,MediaType.APPLICATION_XML);</span><br><span class="line"> <span class="comment">//在浏览器url上拼接参数的形式实现内容协商</span></span><br><span class="line"> <span class="comment">//http://localhost:8080/test/person?format=gg</span></span><br><span class="line"> mediaTypes.put(<span class="string">"gg"</span>,MediaType.parseMediaType(<span class="string">"application/x-guigu"</span>));</span><br><span class="line"> <span class="comment">//指定支持解析哪些参数对应的哪些媒体类型</span></span><br><span class="line"> <span class="type">ParameterContentNegotiationStrategy</span> <span class="variable">parameterStrategy</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ParameterContentNegotiationStrategy</span>(mediaTypes);</span><br><span class="line"> <span class="comment">//parameterStrategy.setParameterName("ff");</span></span><br><span class="line"></span><br><span class="line"> <span class="type">HeaderContentNegotiationStrategy</span> <span class="variable">headeStrategy</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">HeaderContentNegotiationStrategy</span>();</span><br><span class="line"></span><br><span class="line"> configurer.strategies(Arrays.asList(parameterStrategy,headeStrategy));</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//加入自定义的converter</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_">extendMessageConverters</span><span class="params">(List<HttpMessageConverter<?>> converters)</span> {</span><br><span class="line"> converters.add(<span class="keyword">new</span> <span class="title class_">GuiguMessageConverter</span>());</span><br><span class="line"> }</span><br><span class="line"> };</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-视图解析与模板引擎"><a href="#3-视图解析与模板引擎" class="headerlink" title="3.视图解析与模板引擎"></a>3.视图解析与模板引擎</h3><p>视图解析:SpringBoot默认不支持 JSP,需要引入第三方模板引擎技术实现页面渲染</p>
|
||
<h4 id="3-1-视图解析"><a href="#3-1-视图解析" class="headerlink" title="3.1 视图解析"></a>3.1 视图解析</h4><p><img src="/pictures/image-20230815091741019.png" alt="image-20230815091741019"></p>
|
||
<h4 id="3-2-模板引擎-Thymeleaf"><a href="#3-2-模板引擎-Thymeleaf" class="headerlink" title="3.2 模板引擎-Thymeleaf"></a>3.2 模板引擎-Thymeleaf</h4><p>详细的使用教程: <a href="https://qingling.icu/posts/54835.html">https://qingling.icu/posts/54835.html</a></p>
|
||
<h5 id="3-2-1-Thymeleaf的使用"><a href="#3-2-1-Thymeleaf的使用" class="headerlink" title="3.2.1 Thymeleaf的使用"></a>3.2.1 Thymeleaf的使用</h5><p>1.引入依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-thymeleaf<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.编写测试controller</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Controller</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ViewTestController</span> {</span><br><span class="line"> <span class="meta">@GetMapping("/view")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">hello</span><span class="params">(Model model)</span>{</span><br><span class="line"> <span class="comment">//向请求域中共享数据</span></span><br><span class="line"> model.addAttribute(<span class="string">"keys"</span>,<span class="string">"Thymeleaf"</span>);</span><br><span class="line"> <span class="comment">//转发到success页面中</span></span><br><span class="line"> <span class="keyword">return</span> <span class="string">"success"</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3.页面上渲染</p>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">xmlns:th</span>=<span class="string">"http://www.thymeleaf.org"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>Title<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"><span class="tag"><<span class="name">h1</span> <span class="attr">th:text</span>=<span class="string">"${keys}"</span>></span>Hello<span class="tag"></<span class="name">h1</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230815153318041.png" alt="image-20230815153318041"></p>
|
||
<h4 id="3-3-后台管理系统注意点"><a href="#3-3-后台管理系统注意点" class="headerlink" title="3.3 后台管理系统注意点"></a>3.3 后台管理系统注意点</h4><p><strong>templates目录的访问规则</strong></p>
|
||
<p>templates目录下的所有页面资源只能通过请求访问到</p>
|
||
<p><strong>表单重复提交的问题</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.admin.controller;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="meta">@Slf4j</span></span><br><span class="line"><span class="meta">@Controller</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">IndexController</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 class="doctag">@return</span></span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@GetMapping(value = {"/","/login"})</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">loginPage</span><span class="params">()</span>{</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> <span class="string">"login"</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="meta">@PostMapping("/login")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">main</span><span class="params">(String username, String password)</span>{</span><br><span class="line"> <span class="comment">//登录成功重定向到main.html; 重定向防止表单重复提交</span></span><br><span class="line"> <span class="comment">//这里如果直接写 return "main"的话,页面在mian.html的情况下,url路径还是localhost:8080/login,如果再次刷新页面会重复提交表单</span></span><br><span class="line"> <span class="comment">//使用下面这个写法,执行"/login"这个请求之后,路径的url会变成localhost:8080/main.html</span></span><br><span class="line"> <span class="keyword">return</span> <span class="string">"redirect:/main.html"</span>;</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"> * 去main页面</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("/main.html")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">mainPage</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"main"</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-拦截器"><a href="#4-拦截器" class="headerlink" title="4.拦截器"></a>4.拦截器</h3><h4 id="1-HandlerInterceptor接口"><a href="#1-HandlerInterceptor接口" class="headerlink" title="1.HandlerInterceptor接口"></a>1.HandlerInterceptor接口</h4><p>自定义拦截器需要实现的接口,以及需要实现接口中的方法</p>
|
||
<p><img src="/pictures/image-20230821105529796.png" alt="image-20230821105529796"></p>
|
||
<h4 id="2-拦截器实现登录检查操作"><a href="#2-拦截器实现登录检查操作" class="headerlink" title="2.拦截器实现登录检查操作"></a>2.拦截器实现登录检查操作</h4><p><strong>登录检查的业务逻辑</strong></p>
|
||
<figure class="highlight java"><table><tr><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"> * 1、配置好拦截器要拦截哪些请求</span></span><br><span class="line"><span class="comment"> * 2、把这些配置放在容器中</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="keyword">public</span> <span class="keyword">class</span> <span class="title class_">LoginInterceptor</span> <span class="keyword">implements</span> <span class="title class_">HandlerInterceptor</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 class="doctag">@param</span> request</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> response</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> handler</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span></span></span><br><span class="line"><span class="comment"> * <span class="doctag">@throws</span> Exception</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="type">boolean</span> <span class="title function_">preHandle</span><span class="params">(HttpServletRequest request, HttpServletResponse response, Object handler)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"></span><br><span class="line"> <span class="type">String</span> <span class="variable">requestURI</span> <span class="operator">=</span> request.getRequestURI();</span><br><span class="line"> log.info(<span class="string">"preHandle拦截的请求路径是{}"</span>,requestURI);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//登录检查逻辑</span></span><br><span class="line"> <span class="type">HttpSession</span> <span class="variable">session</span> <span class="operator">=</span> request.getSession();</span><br><span class="line"></span><br><span class="line"> <span class="type">Object</span> <span class="variable">loginUser</span> <span class="operator">=</span> session.getAttribute(<span class="string">"loginUser"</span>);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span>(loginUser != <span class="literal">null</span>){</span><br><span class="line"> <span class="comment">//放行</span></span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//拦截住 未登录 跳转到登录页</span></span><br><span class="line"> request.setAttribute(<span class="string">"msg"</span>,<span class="string">"请先登录"</span>);</span><br><span class="line"> request.getRequestDispatcher(<span class="string">"/"</span>).forward(request,response);</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">false</span>;</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 class="doctag">@param</span> request</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> response</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> handler</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> modelAndView</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@throws</span> Exception</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_">postHandle</span><span class="params">(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> log.info(<span class="string">"postHandle执行{}"</span>,modelAndView);</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 class="doctag">@param</span> request</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> response</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> handler</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> ex</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@throws</span> Exception</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_">afterCompletion</span><span class="params">(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> log.info(<span class="string">"afterCompletion执行异常{}"</span>,ex);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>拦截器的配置</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 1、编写一个拦截器实现HandlerInterceptor接口</span></span><br><span class="line"><span class="comment"> * 2、拦截器注册到容器中(实现WebMvcConfigurer的addInterceptors)</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"><span class="meta">@Configuration</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">AdminWebConfig</span> <span class="keyword">implements</span> <span class="title class_">WebMvcConfigurer</span> {</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> <span class="keyword">void</span> <span class="title function_">addInterceptors</span><span class="params">(InterceptorRegistry registry)</span> {</span><br><span class="line"> registry.addInterceptor(<span class="keyword">new</span> <span class="title class_">LoginInterceptor</span>())</span><br><span class="line"> .addPathPatterns(<span class="string">"/**"</span>) <span class="comment">//所有请求都被拦截包括静态资源</span></span><br><span class="line"> .excludePathPatterns(<span class="string">"/"</span>,<span class="string">"/login"</span>,<span class="string">"/css/**"</span>,<span class="string">"/fonts/**"</span>,<span class="string">"/images/**"</span>,<span class="string">"/js/**"</span>); <span class="comment">//放行的请求</span></span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-拦截器原理"><a href="#3-拦截器原理" class="headerlink" title="3.拦截器原理"></a>3.拦截器原理</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * preHandle() :该方法在控制器方法之前执行,如果返回false,说明拦截器不放行该请求,自己处理或者结束该请求</span></span><br><span class="line"><span class="comment"> * 如果返回true,说明拦截器放该请求,由其它匹配的拦截器或者控制器继续处理</span></span><br><span class="line"><span class="comment"> * postHandle():该方法在控制器方法调用之后,且解析视图之前执行,可以通过此方法对请求域中的模型和视图做出进一步的修改</span></span><br><span class="line"><span class="comment"> * afterCompletion(): 该方法会在整个请求完成,即视图渲染结束之后执行,多用于资源的清理工作</span></span><br><span class="line"><span class="comment"> */</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>1、根据当前请求,找到HandlerExecutionChain[可以处理请求的handler以及handler的所有 拦截器]</p>
|
||
<p>2、先来顺序执行 所有拦截器的 preHandle方法</p>
|
||
<ul>
|
||
<li>1、如果当前拦截器prehandler返回为true,则执行下一个拦截器的preHandle</li>
|
||
<li>2、如果当前拦截器返回为false。直接倒序执行所有已经执行了的拦截器的afterCompletion方法</li>
|
||
</ul>
|
||
<p>3、如果任何一个拦截器返回false,直接跳出不执行目标方法</p>
|
||
<p>4、所有拦截器都返回true,执行目标方法</p>
|
||
<p>5、倒序执行所有拦截器的postHandle方法</p>
|
||
<p>6、前面的步骤有任何异常都会直接倒序触发 afterCompletion</p>
|
||
<p>7、页面成功渲染完成以后,也会倒序触发 afterCompletion</p>
|
||
<p><img src="/pictures/image-20230821112246355.png" alt="image-20230821112246355"></p>
|
||
<h3 id="5-文件上传"><a href="#5-文件上传" class="headerlink" title="5.文件上传"></a>5.文件上传</h3><h4 id="1-页面表单"><a href="#1-页面表单" class="headerlink" title="1.页面表单"></a>1.页面表单</h4><figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">form</span> <span class="attr">method</span>=<span class="string">"post"</span> <span class="attr">action</span>=<span class="string">"/upload"</span> <span class="attr">enctype</span>=<span class="string">"multipart/form-data"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"file"</span> <span class="attr">name</span>=<span class="string">"file"</span>></span><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"submit"</span> <span class="attr">value</span>=<span class="string">"提交"</span>></span></span><br><span class="line"><span class="tag"></<span class="name">form</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="2-文件上传代码"><a href="#2-文件上传代码" class="headerlink" title="2.文件上传代码"></a>2.文件上传代码</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * MultipartFile 自动封装上传过来的文件</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@PostMapping("/upload")</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">upload</span><span class="params">(<span class="meta">@RequestParam("email")</span> String email,</span></span><br><span class="line"><span class="params"> <span class="meta">@RequestParam("username")</span> String username,</span></span><br><span class="line"><span class="params"> <span class="meta">@RequestPart("headerImg")</span> MultipartFile headerImg,//单个文件</span></span><br><span class="line"><span class="params"> <span class="meta">@RequestPart("photos")</span> MultipartFile[] photos)</span> <span class="keyword">throws</span> IOException {<span class="comment">//多个文件</span></span><br><span class="line"></span><br><span class="line"> log.info(<span class="string">"上传的信息:email={},username={},headerImg={},photos={}"</span>,</span><br><span class="line"> email, username, headerImg.getSize(), photos.length);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span> (!headerImg.isEmpty()) {</span><br><span class="line"> <span class="comment">//保存到文件服务器,OSS服务器</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">originalFilename</span> <span class="operator">=</span> headerImg.getOriginalFilename();</span><br><span class="line"> headerImg.transferTo(<span class="keyword">new</span> <span class="title class_">File</span>(<span class="string">"H:\\cache\\"</span> + originalFilename));</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span> (photos.length > <span class="number">0</span>) {</span><br><span class="line"> <span class="keyword">for</span> (MultipartFile photo : photos) {</span><br><span class="line"> <span class="keyword">if</span> (!photo.isEmpty()) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">originalFilename</span> <span class="operator">=</span> photo.getOriginalFilename();</span><br><span class="line"> photo.transferTo(<span class="keyword">new</span> <span class="title class_">File</span>(<span class="string">"H:\\cache\\"</span> + originalFilename));</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"main"</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-MultipartAutoConfiguration"><a href="#3-MultipartAutoConfiguration" class="headerlink" title="3.MultipartAutoConfiguration"></a>3.MultipartAutoConfiguration</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Configuration(proxyBeanMethods = false)</span></span><br><span class="line"><span class="meta">@ConditionalOnClass({ Servlet.class, StandardServletMultipartResolver.class, MultipartConfigElement.class })</span></span><br><span class="line"><span class="meta">@ConditionalOnProperty(prefix = "spring.servlet.multipart", name = "enabled", matchIfMissing = true)</span></span><br><span class="line"><span class="meta">@ConditionalOnWebApplication(type = Type.SERVLET)</span></span><br><span class="line"><span class="meta">@EnableConfigurationProperties(MultipartProperties.class)</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MultipartAutoConfiguration</span> {}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="6-异常处理"><a href="#6-异常处理" class="headerlink" title="6.异常处理"></a>6.异常处理</h3><p>开发中异常处理方法: <a href="https://qingling.icu/posts/31385.html">https://qingling.icu/posts/31385.html</a></p>
|
||
<h4 id="1-默认规则"><a href="#1-默认规则" class="headerlink" title="1.默认规则"></a>1.默认规则</h4><ul>
|
||
<li>默认情况下,Spring Boot提供<code>/error</code>处理所有错误的映射</li>
|
||
<li>对于机器客户端,它将生成JSON响应,其中包含错误,HTTP状态和异常消息的详细信息。对于浏览器客户端,响应一个“ whitelabel”错误视图,以HTML格式呈现相同的数据</li>
|
||
</ul>
|
||
<h4 id="2-自定义错误页面"><a href="#2-自定义错误页面" class="headerlink" title="2.自定义错误页面"></a>2.自定义错误页面</h4><p>templates/error/下的4xx,5xx页面会被自动解析</p>
|
||
<h3 id="7-Web原生组件注入(Servlet、Filter、Listener)"><a href="#7-Web原生组件注入(Servlet、Filter、Listener)" class="headerlink" title="7.Web原生组件注入(Servlet、Filter、Listener)"></a>7.Web原生组件注入(Servlet、Filter、Listener)</h3><h4 id="7-1-使用Servlet-Api"><a href="#7-1-使用Servlet-Api" class="headerlink" title="7.1 使用Servlet Api"></a>7.1 使用Servlet Api</h4><h5 id="1-原生的Servlet的使用"><a href="#1-原生的Servlet的使用" class="headerlink" title="1.原生的Servlet的使用"></a>1.原生的Servlet的使用</h5><p>1.编写自定义的servlet继承HttpServlet</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot.servlet;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.servlet.ServletException;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.annotation.WebServlet;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServlet;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletRequest;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletResponse;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/26</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">@WebServlet(urlPatterns = "/my")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MyServlet</span> <span class="keyword">extends</span> <span class="title class_">HttpServlet</span> {</span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">protected</span> <span class="keyword">void</span> <span class="title function_">doGet</span><span class="params">(HttpServletRequest req, HttpServletResponse resp)</span> <span class="keyword">throws</span> ServletException, IOException {</span><br><span class="line"> resp.getWriter().write(<span class="string">"6666"</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.在启动类上添加自定义servlet的包扫描注解</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.SpringApplication;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.autoconfigure.SpringBootApplication;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.web.servlet.ServletComponentScan;</span><br><span class="line"></span><br><span class="line"><span class="meta">@ServletComponentScan("com.atguigu.boot")</span> <span class="comment">//指定原生的servlet的位置</span></span><br><span class="line"><span class="meta">@SpringBootApplication</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Boot05Web01Application</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> SpringApplication.run(Boot05Web01Application.class, args);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3.启动程序测试</p>
|
||
<p><img src="/pictures/image-20230826211541424.png" alt="image-20230826211541424"></p>
|
||
<h5 id="2-原生的Filter的使用"><a href="#2-原生的Filter的使用" class="headerlink" title="2.原生的Filter的使用"></a>2.原生的Filter的使用</h5><p>1.编写自定义的Filter实现Filter接口</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot.servlet;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> lombok.extern.slf4j.Slf4j;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.servlet.*;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.annotation.WebFilter;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/26</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">@WebFilter(urlPatterns={"/css/*","/images/*","/my"})</span> <span class="comment">//设置拦截的路径</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MyFilter</span> <span class="keyword">implements</span> <span class="title class_">Filter</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_">init</span><span class="params">(FilterConfig filterConfig)</span> <span class="keyword">throws</span> ServletException {</span><br><span class="line"> log.info(<span class="string">"MyFilter初始化完成"</span>);</span><br><span class="line"> }</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> <span class="keyword">void</span> <span class="title function_">doFilter</span><span class="params">(ServletRequest request, ServletResponse response, FilterChain chain)</span> <span class="keyword">throws</span> IOException, ServletException {</span><br><span class="line"> log.info(<span class="string">"MyFilter工作"</span>);</span><br><span class="line"> chain.doFilter(request,response);</span><br><span class="line"> }</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> <span class="keyword">void</span> <span class="title function_">destroy</span><span class="params">()</span> {</span><br><span class="line"> log.info(<span class="string">"MyFilter销毁"</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.启动程序测试</p>
|
||
<p><img src="/pictures/image-20230826212400849.png" alt="image-20230826212400849"></p>
|
||
<h5 id="3-原生的Listener的使用"><a href="#3-原生的Listener的使用" class="headerlink" title="3.原生的Listener的使用"></a>3.原生的Listener的使用</h5><p>1.编写自定义的MyServletContextListener实现ServletContextListener</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot.servlet;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> lombok.extern.slf4j.Slf4j;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.servlet.ServletContextEvent;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.ServletContextListener;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.annotation.WebListener;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/26</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">@WebListener</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MyServletContextListener</span> <span class="keyword">implements</span> <span class="title class_">ServletContextListener</span> {</span><br><span class="line"></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> <span class="keyword">void</span> <span class="title function_">contextInitialized</span><span class="params">(ServletContextEvent sce)</span> {</span><br><span class="line"> log.info(<span class="string">"MyServletContextListener监听到项目初始化完成"</span>);</span><br><span class="line"> }</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> <span class="keyword">void</span> <span class="title function_">contextDestroyed</span><span class="params">(ServletContextEvent sce)</span> {</span><br><span class="line"> log.info(<span class="string">"MyServletContextListener监听到项目销毁"</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.启动程序测试</p>
|
||
<p><img src="/pictures/image-20230826213125490.png" alt="image-20230826213125490"></p>
|
||
<h4 id="7-2-使用RegistrationBean"><a href="#7-2-使用RegistrationBean" class="headerlink" title="7.2 使用RegistrationBean"></a>7.2 使用RegistrationBean</h4><p>不使用@WebServlet、@WebFilter、@WebListener注解的方式(注释掉自定义servlet、Filter、Listener上的注解)</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot.servlet;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.web.servlet.FilterRegistrationBean;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.web.servlet.ServletListenerRegistrationBean;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.web.servlet.ServletRegistrationBean;</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.util.Arrays;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/26</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_">MyRegisterConfig</span> {</span><br><span class="line"> <span class="meta">@Bean</span></span><br><span class="line"> <span class="keyword">public</span> ServletRegistrationBean <span class="title function_">myServlet</span><span class="params">()</span>{</span><br><span class="line"> <span class="type">MyServlet</span> <span class="variable">myServlet</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">MyServlet</span>();</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">ServletRegistrationBean</span>(myServlet,<span class="string">"/my"</span>,<span class="string">"/my02"</span>);</span><br><span class="line"> }</span><br><span class="line"></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> FilterRegistrationBean <span class="title function_">myFilter</span><span class="params">()</span>{</span><br><span class="line"></span><br><span class="line"> <span class="type">MyFilter</span> <span class="variable">myFilter</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">MyFilter</span>();</span><br><span class="line"> <span class="comment">//return new FilterRegistrationBean(myFilter,myServlet());</span></span><br><span class="line"> <span class="type">FilterRegistrationBean</span> <span class="variable">filterRegistrationBean</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">FilterRegistrationBean</span>(myFilter);</span><br><span class="line"> filterRegistrationBean.setUrlPatterns(Arrays.asList(<span class="string">"/my"</span>,<span class="string">"/css/*"</span>));</span><br><span class="line"> <span class="keyword">return</span> filterRegistrationBean;</span><br><span class="line"> }</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> ServletListenerRegistrationBean <span class="title function_">myListener</span><span class="params">()</span>{</span><br><span class="line"> <span class="type">MyServletContextListener</span> <span class="variable">mySwervletContextListener</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">MyServletContextListener</span>();</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">ServletListenerRegistrationBean</span>(mySwervletContextListener);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>重新启动项目我们可以看到依然生效</p>
|
||
<p><img src="/pictures/image-20230826214253187.png" alt="image-20230826214253187"></p>
|
||
<h3 id="8-嵌入式Servlet容器"><a href="#8-嵌入式Servlet容器" class="headerlink" title="8.嵌入式Servlet容器"></a>8.嵌入式Servlet容器</h3><h4 id="8-1-切换嵌入式Servlet容器"><a href="#8-1-切换嵌入式Servlet容器" class="headerlink" title="8.1 切换嵌入式Servlet容器"></a>8.1 切换嵌入式Servlet容器</h4><ul>
|
||
<li><p>默认支持的webServer</p>
|
||
</li>
|
||
<li><ul>
|
||
<li><code>Tomcat</code>, <code>Jetty</code>, or <code>Undertow</code></li>
|
||
<li><code>ServletWebServerApplicationContext 容器启动寻找ServletWebServerFactory 并引导创建服务器</code></li>
|
||
</ul>
|
||
</li>
|
||
<li><p>切换服务器</p>
|
||
<p>1.排除tomcat的依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-web<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">exclusions</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">exclusion</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-tomcat<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">exclusion</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">exclusions</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.引入需要的服务器场景</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-undertow<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3.重启项目,可以看到服务器由tomcat变成了undertow</p>
|
||
<p><img src="/pictures/image-20230826221229898.png" alt="image-20230826221229898"></p>
|
||
</li>
|
||
<li><p>原理</p>
|
||
</li>
|
||
<li><ul>
|
||
<li>SpringBoot应用启动发现当前是Web应用。web场景包-导入tomcat</li>
|
||
<li>web应用会创建一个web版的ioc容器 <code>ServletWebServerApplicationContext</code> </li>
|
||
<li><code>ServletWebServerApplicationContext</code> 启动的时候寻找 <code>**ServletWebServerFactory**``(Servlet 的web服务器工厂---> Servlet 的web服务器)</code> </li>
|
||
<li>SpringBoot底层默认有很多的WebServer工厂;<code>TomcatServletWebServerFactory</code>, <code>JettyServletWebServerFactory</code>, or <code>UndertowServletWebServerFactory</code></li>
|
||
<li><code>底层直接会有一个自动配置类ServletWebServerFactoryAutoConfiguration</code></li>
|
||
<li><code>ServletWebServerFactoryAutoConfiguration导入了ServletWebServerFactoryConfiguration(配置类)</code></li>
|
||
<li><code>ServletWebServerFactoryConfiguration 配置类 根据动态判断系统中到底导入了那个Web服务器的包(默认是web-starter导入tomcat包),容器中就有 TomcatServletWebServerFactory</code></li>
|
||
<li><code>TomcatServletWebServerFactory 创建出Tomcat服务器并启动;TomcatWebServer 的构造器拥有初始化方法initialize---this.tomcat.start();</code></li>
|
||
<li><code>内嵌服务器,就是手动把启动服务器的代码调用(tomcat核心jar包存在)</code></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<h4 id="8-2-定制Servlet容器"><a href="#8-2-定制Servlet容器" class="headerlink" title="8.2 定制Servlet容器"></a>8.2 定制Servlet容器</h4><p>修改配置文件中以server.xxx打头的属性信息</p>
|
||
<p><img src="/pictures/image-20230826222050817.png" alt="image-20230826222050817"></p>
|
||
<h2 id="三-数据访问"><a href="#三-数据访问" class="headerlink" title="三.数据访问"></a>三.数据访问</h2><h3 id="1-SQL"><a href="#1-SQL" class="headerlink" title="1.SQL"></a>1.SQL</h3><h4 id="1-1-JDBC的使用"><a href="#1-1-JDBC的使用" class="headerlink" title="1.1 JDBC的使用"></a>1.1 JDBC的使用</h4><p>1.导入JDBC的场景</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-data-jdbc<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.导入自己使用的数据库的驱动(Mysql或者Oracle)版本号不写也可以,官方做了版本仲裁(但是要与实际安装的版本对应)</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line">想要修改版本</span><br><span class="line">1、直接依赖引入具体版本(maven的就近依赖原则)</span><br><span class="line">2、重新声明版本(maven的属性的就近优先原则)</span><br><span class="line"><span class="tag"><<span class="name">properties</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">java.version</span>></span>1.8<span class="tag"></<span class="name">java.version</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">mysql.version</span>></span>5.1.45<span class="tag"></<span class="name">mysql.version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">properties</span>></span></span><br><span class="line">或者</span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>mysql<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>mysql-connector-java<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>5.1.45<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3.添加配置</p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><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://localhost:3306/db_account</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="number">123456</span></span><br><span class="line"> <span class="attr">driver-class-name:</span> <span class="string">com.mysql.jdbc.Driver</span></span><br><span class="line"> <span class="comment"># type: com.zaxxer.hikari.HikariDataSource #配置数据源</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>4.测试</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot;</span><br><span class="line"></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.junit.jupiter.api.Test;</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.boot.test.context.SpringBootTest;</span><br><span class="line"><span class="keyword">import</span> org.springframework.jdbc.core.JdbcTemplate;</span><br><span class="line"></span><br><span class="line"><span class="meta">@Slf4j</span></span><br><span class="line"><span class="meta">@SpringBootTest</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">Boot05Web01ApplicationTests</span> {</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> JdbcTemplate jdbcTemplate;</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_">contextLoads</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">Long</span> <span class="variable">count</span> <span class="operator">=</span> jdbcTemplate.queryForObject(<span class="string">"select count(*) from `role` "</span>, Long.class);</span><br><span class="line"> log.info(<span class="string">"记录数:{}"</span>,count);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-2-分析自动配置"><a href="#1-2-分析自动配置" class="headerlink" title="1.2 分析自动配置"></a>1.2 分析自动配置</h4><p><strong>自动配置的类</strong></p>
|
||
<p><img src="/pictures/image-20230826224503510.png" alt="image-20230826224503510"></p>
|
||
<ul>
|
||
<li><p>DataSourceAutoConfiguration : 数据源的自动配置</p>
|
||
</li>
|
||
<li><ul>
|
||
<li>修改数据源相关的配置:spring.datasource</li>
|
||
<li>数据库连接池的配置,是自己容器中没有DataSource才自动配置的</li>
|
||
<li>底层配置好的连接池是:HikariDataSource</li>
|
||
</ul>
|
||
</li>
|
||
<li><p>DataSourceTransactionManagerAutoConfiguration: 事务管理器的自动配置</p>
|
||
</li>
|
||
<li><p>JdbcTemplateAutoConfiguration: JdbcTemplate的自动配置,可以来对数据库进行crud</p>
|
||
</li>
|
||
<li><ul>
|
||
<li>可以修改这个配置项@ConfigurationProperties(prefix = “spring.jdbc”) 来修改JdbcTemplate</li>
|
||
</ul>
|
||
</li>
|
||
<li><p>JndiDataSourceAutoConfiguration: jndi的自动配置</p>
|
||
</li>
|
||
<li><p>XADataSourceAutoConfiguration: 分布式事务相关的</p>
|
||
</li>
|
||
</ul>
|
||
<h2 id="四-单元测试"><a href="#四-单元测试" class="headerlink" title="四.单元测试"></a>四.单元测试</h2><h3 id="1-JUnit5的变化"><a href="#1-JUnit5的变化" class="headerlink" title="1.JUnit5的变化"></a>1.JUnit5的变化</h3><p><strong>Spring Boot 2.2.0 版本开始引入 JUnit 5 作为单元测试默认库</strong></p>
|
||
<p>作为最新版本的JUnit框架,JUnit5与之前版本的Junit框架有很大的不同。由三个不同子项目的几个不同模块组成</p>
|
||
<p>JUnit 5 = JUnit Platform + JUnit Jupiter + JUnit Vintage</p>
|
||
<p>JUnit Platform: Junit Platform是在JVM上启动测试框架的基础,不仅支持Junit自制的测试引擎,其他测试引擎也都可以接入</p>
|
||
<p>JUnit Jupiter: JUnit Jupiter提供了JUnit5的新的编程模型,是JUnit5新特性的核心。内部 包含了一个测试引擎,用于在Junit Platform上运行</p>
|
||
<p>JUnit Vintage: 由于JUint已经发展多年,为了照顾老的项目,JUnit Vintage提供了兼容JUnit4.x,Junit3.x的测试引擎</p>
|
||
<p><strong>注意:</strong></p>
|
||
<p>SpringBoot 2.4 以上版本移除了默认对 Vintage 的依赖。如果需要兼容junit4需要自行引入(不能使用junit4的功能 @Test)</p>
|
||
<p><strong>以前的版本</strong></p>
|
||
<p>兼容以前的版本(junit4)需要额外导入的依赖(SpringBoot 2.4 以上版本移除了默认对 Vintage 的依赖)</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-test<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">scope</span>></span>test<span class="tag"></<span class="name">scope</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.junit.vintage<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>junit-vintage-engine<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">scope</span>></span>test<span class="tag"></<span class="name">scope</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">exclusions</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">exclusion</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.hamcrest<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>hamcrest-core<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">exclusion</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">exclusions</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>标注的注解</p>
|
||
<p>@SpringBootTest + @RunWith(SpringRunner.class)+@Test(4版本的@Test)</p>
|
||
<p><strong>现在的版本</strong></p>
|
||
<p>需要导入的依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-test<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">scope</span>></span>test<span class="tag"></<span class="name">scope</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>标注的注解</p>
|
||
<p>@SpringBootTest + @Test</p>
|
||
<p><strong>两个不同版本的 @Test 注解</strong></p>
|
||
<p><img src="/pictures/image-20230827112742347.png" alt="image-20230827112742347"></p>
|
||
<h3 id="2-JUnit5常用注解"><a href="#2-JUnit5常用注解" class="headerlink" title="2.JUnit5常用注解"></a>2.JUnit5常用注解</h3><p>JUnit5的注解与JUnit4的注解有所变化</p>
|
||
<p><a href="https://junit.org/junit5/docs/current/user-guide/#writing-tests-annotations">https://junit.org/junit5/docs/current/user-guide/#writing-tests-annotations</a></p>
|
||
<ul>
|
||
<li>@Test :表示方法是测试方法。但是与JUnit4的@Test不同,他的职责非常单一不能声明任何属性,拓展的测试将会由Jupiter提供额外测试</li>
|
||
<li>@ParameterizedTest :表示方法是参数化测试,下方会有详细介绍</li>
|
||
<li>@RepeatedTest :表示方法可重复执行,下方会有详细介绍</li>
|
||
<li>@DisplayName :为测试类或者测试方法设置展示名称</li>
|
||
</ul>
|
||
<p><img src="/pictures/image-20230827114256749.png" alt="image-20230827114256749"></p>
|
||
<ul>
|
||
<li><p>@BeforeEach :表示在每个单元测试之前执行</p>
|
||
</li>
|
||
<li><p>@AfterEach :表示在每个单元测试之后执行</p>
|
||
</li>
|
||
<li><p>@BeforeAll :表示在所有单元测试之前执行</p>
|
||
</li>
|
||
<li><p>@AfterAll :表示在所有单元测试之后执行</p>
|
||
</li>
|
||
</ul>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot;</span><br><span class="line"></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.junit.jupiter.api.*;</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.boot.test.context.SpringBootTest;</span><br><span class="line"><span class="keyword">import</span> org.springframework.jdbc.core.JdbcTemplate;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/27</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 测试junit5的相关注解</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">@DisplayName("Junit5Test测试类")</span></span><br><span class="line"><span class="meta">@SpringBootTest</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Junit5Test</span> {</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@DisplayName</span> 加在方法或者类上,为测试类或者测试方法设置展示名称</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Disabled</span></span><br><span class="line"> <span class="meta">@DisplayName("测试@DisplayName注解")</span></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testDisplayName</span><span class="params">()</span>{</span><br><span class="line"> log.info(<span class="string">"@DisplayName注解的测试"</span>);</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="meta">@BeforeEach</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testBeforeEach</span><span class="params">()</span>{</span><br><span class="line"> log.info(<span class="string">"执行了testBeforeEach()方法"</span>);</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="meta">@AfterEach</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testAfterEach</span><span class="params">()</span> {</span><br><span class="line"> log.info(<span class="string">"执行了testAfterEach()方法"</span>);</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">@BeforeAll</span></span><br><span class="line"> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">testBeforeAll</span><span class="params">()</span> {</span><br><span class="line"> log.info(<span class="string">"执行了testBeforeAll()方法"</span>);</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">@AfterAll</span></span><br><span class="line"> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">testAfterAll</span><span class="params">()</span> {</span><br><span class="line"> log.info(<span class="string">"执行了testAfterAll()方法"</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<ul>
|
||
<li>@Tag :表示单元测试类别,类似于JUnit4中的@Categories</li>
|
||
<li>@Disabled :表示测试类或测试方法不执行,类似于JUnit4中的@Ignore</li>
|
||
</ul>
|
||
<p><img src="/pictures/image-20230827115900097.png" alt="image-20230827115900097"></p>
|
||
<ul>
|
||
<li>@Timeout :表示测试方法运行如果超过了指定时间将会返回错误</li>
|
||
</ul>
|
||
<figure class="highlight java"><table><tr><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">@Timeout(value = 500, unit = TimeUnit.MILLISECONDS)</span></span><br><span class="line"><span class="meta">@Test</span></span><br><span class="line"><span class="keyword">void</span> <span class="title function_">testTimeout</span><span class="params">()</span> <span class="keyword">throws</span> InterruptedException {</span><br><span class="line"> Thread.sleep(<span class="number">600</span>);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<ul>
|
||
<li>@ExtendWith :为测试类或测试方法提供扩展类引用</li>
|
||
</ul>
|
||
<figure class="highlight java"><table><tr><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">@RepeatedTest(5)</span></span><br><span class="line"><span class="meta">@Test</span></span><br><span class="line"><span class="keyword">void</span> <span class="title function_">testRepeatedTest</span><span class="params">()</span> {</span><br><span class="line"> log.info(<span class="string">"重复测试中"</span>);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230828095915653.png" alt="image-20230828095915653"></p>
|
||
<p><strong>全部的代码</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot;</span><br><span class="line"></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.junit.jupiter.api.*;</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.boot.test.context.SpringBootTest;</span><br><span class="line"><span class="keyword">import</span> org.springframework.jdbc.core.JdbcTemplate;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.concurrent.TimeUnit;</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://qingling.icu</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/8/27</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 测试junit5的相关注解</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">@DisplayName("Junit5Test测试类")</span></span><br><span class="line"><span class="meta">@SpringBootTest</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Junit5Test</span> {</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@DisplayName</span> 加在方法或者类上,为测试类或者测试方法设置展示名称</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Disabled</span></span><br><span class="line"> <span class="meta">@DisplayName("测试@DisplayName注解")</span></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testDisplayName</span><span class="params">()</span>{</span><br><span class="line"> log.info(<span class="string">"@DisplayName注解的测试"</span>);</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="meta">@BeforeEach</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testBeforeEach</span><span class="params">()</span>{</span><br><span class="line"> log.info(<span class="string">"执行了testBeforeEach()方法"</span>);</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="meta">@AfterEach</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testAfterEach</span><span class="params">()</span> {</span><br><span class="line"> log.info(<span class="string">"执行了testAfterEach()方法"</span>);</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">@BeforeAll</span></span><br><span class="line"> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">testBeforeAll</span><span class="params">()</span> {</span><br><span class="line"> log.info(<span class="string">"执行了testBeforeAll()方法"</span>);</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">@AfterAll</span></span><br><span class="line"> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">testAfterAll</span><span class="params">()</span> {</span><br><span class="line"> log.info(<span class="string">"执行了testAfterAll()方法"</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="meta">@Timeout(value = 500, unit = TimeUnit.MILLISECONDS)</span></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testTimeout</span><span class="params">()</span> <span class="keyword">throws</span> InterruptedException {</span><br><span class="line"> Thread.sleep(<span class="number">600</span>);</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="meta">@RepeatedTest(5)</span></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testRepeatedTest</span><span class="params">()</span> {</span><br><span class="line"> log.info(<span class="string">"重复测试中"</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-断言"><a href="#3-断言" class="headerlink" title="3.断言"></a>3.断言</h3><p> 断言(assertions)是测试方法中的核心部分,用来对测试需要满足的条件进行验证。这些断言方法都是 org.junit.jupiter.api.Assertions 的静态方法。检查业务逻辑返回的数据是否合理。所有的测试运行结束以后,会有一个详细的测试报告。</p>
|
||
<h4 id="3-1-简单断言"><a href="#3-1-简单断言" class="headerlink" title="3.1 简单断言"></a>3.1 简单断言</h4><p>用来对单个值进行简单的验证</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>方法</th>
|
||
<th>说明</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>assertEquals</td>
|
||
<td>判断两个对象或两个原始类型是否相等</td>
|
||
</tr>
|
||
<tr>
|
||
<td>assertNotEquals</td>
|
||
<td>判断两个对象或两个原始类型是否不相等</td>
|
||
</tr>
|
||
<tr>
|
||
<td>assertSame</td>
|
||
<td>判断两个对象引用是否指向同一个对象</td>
|
||
</tr>
|
||
<tr>
|
||
<td>assertNotSame</td>
|
||
<td>判断两个对象引用是否指向不同的对象</td>
|
||
</tr>
|
||
<tr>
|
||
<td>assertTrue</td>
|
||
<td>判断给定的布尔值是否为 true</td>
|
||
</tr>
|
||
<tr>
|
||
<td>assertFalse</td>
|
||
<td>判断给定的布尔值是否为 false</td>
|
||
</tr>
|
||
<tr>
|
||
<td>assertNull</td>
|
||
<td>判断给定的对象引用是否为 null</td>
|
||
</tr>
|
||
<tr>
|
||
<td>assertNotNull</td>
|
||
<td>判断给定的对象引用是否不为 null</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Test</span></span><br><span class="line"><span class="meta">@DisplayName("简单断言")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">simple</span><span class="params">()</span> {</span><br><span class="line"> assertEquals(<span class="number">3</span>, <span class="number">1</span> + <span class="number">2</span>, <span class="string">"simple math"</span>);</span><br><span class="line"> assertNotEquals(<span class="number">3</span>, <span class="number">1</span> + <span class="number">1</span>);</span><br><span class="line"></span><br><span class="line"> assertNotSame(<span class="keyword">new</span> <span class="title class_">Object</span>(), <span class="keyword">new</span> <span class="title class_">Object</span>());</span><br><span class="line"> <span class="type">Object</span> <span class="variable">obj</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Object</span>();</span><br><span class="line"> assertSame(obj, obj);</span><br><span class="line"></span><br><span class="line"> assertFalse(<span class="number">1</span> > <span class="number">2</span>);</span><br><span class="line"> assertTrue(<span class="number">1</span> < <span class="number">2</span>);</span><br><span class="line"></span><br><span class="line"> assertNull(<span class="literal">null</span>);</span><br><span class="line"> assertNotNull(<span class="keyword">new</span> <span class="title class_">Object</span>());</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-2-数组断言"><a href="#3-2-数组断言" class="headerlink" title="3.2 数组断言"></a>3.2 数组断言</h4><p>通过 assertArrayEquals 方法来判断两个对象或原始类型的数组是否相等</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Test</span></span><br><span class="line"><span class="meta">@DisplayName("数组断言")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">array</span><span class="params">()</span> {</span><br><span class="line"> assertArrayEquals(<span class="keyword">new</span> <span class="title class_">int</span>[]{<span class="number">1</span>, <span class="number">2</span>}, <span class="keyword">new</span> <span class="title class_">int</span>[] {<span class="number">1</span>, <span class="number">2</span>});</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-3-组合断言"><a href="#3-3-组合断言" class="headerlink" title="3.3 组合断言"></a>3.3 组合断言</h4><p>assertAll 方法接受多个 org.junit.jupiter.api.Executable 函数式接口的实例作为要验证的断言,可以通过 lambda 表达式很容易的提供这些断言</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Test</span></span><br><span class="line"><span class="meta">@DisplayName("组合断言")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">all</span><span class="params">()</span> {</span><br><span class="line"> assertAll(<span class="string">"Math"</span>,</span><br><span class="line"> () -> assertEquals(<span class="number">2</span>, <span class="number">1</span> + <span class="number">1</span>),</span><br><span class="line"> () -> assertTrue(<span class="number">1</span> > <span class="number">0</span>)</span><br><span class="line"> );</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-4-异常断言"><a href="#3-4-异常断言" class="headerlink" title="3.4 异常断言"></a>3.4 异常断言</h4><p>在JUnit4时期,想要测试方法的异常情况时,需要用@Rule注解的ExpectedException变量还是比较麻烦的。而JUnit5提供了一种新的断言方式Assertions.assertThrows() ,配合函数式编程就可以进行使用。</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Test</span></span><br><span class="line"><span class="meta">@DisplayName("异常测试")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">exceptionTest</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">ArithmeticException</span> <span class="variable">exception</span> <span class="operator">=</span> Assertions.assertThrows(</span><br><span class="line"> <span class="comment">//扔出断言异常</span></span><br><span class="line"> ArithmeticException.class, () -> System.out.println(<span class="number">1</span> % <span class="number">0</span>));</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-5-超时断言"><a href="#3-5-超时断言" class="headerlink" title="3.5 超时断言"></a>3.5 超时断言</h4><p>Junit5还提供了Assertions.assertTimeout() 为测试方法设置了超时时间</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Test</span></span><br><span class="line"><span class="meta">@DisplayName("超时测试")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">timeoutTest</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//如果测试方法时间超过1s将会异常</span></span><br><span class="line"> Assertions.assertTimeout(Duration.ofMillis(<span class="number">1000</span>), () -> Thread.sleep(<span class="number">500</span>));</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-6-快速失败"><a href="#3-6-快速失败" class="headerlink" title="3.6 快速失败"></a>3.6 快速失败</h4><p>通过 fail 方法直接使得测试失败</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Test</span></span><br><span class="line"><span class="meta">@DisplayName("快速失败")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">shouldFail</span><span class="params">()</span> {</span><br><span class="line"> fail(<span class="string">"This should fail"</span>);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>全部代码</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.admin;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.junit.jupiter.api.*;</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.boot.test.context.SpringBootTest;</span><br><span class="line"><span class="keyword">import</span> org.springframework.jdbc.core.JdbcTemplate;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.concurrent.TimeUnit;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> <span class="keyword">static</span> org.junit.jupiter.api.Assertions.*;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">/*@RunWith*/</span></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">@BootstrapWith</span>(SpringBootTestContextBootstrapper.class)</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@ExtendWith</span>(SpringExtension.class)</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="comment">//@SpringBootTest</span></span><br><span class="line"><span class="meta">@DisplayName("junit5功能测试类")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Junit5Test</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="meta">@DisplayName("简单断言")</span></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testSimpleAssertions</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">int</span> <span class="variable">cal</span> <span class="operator">=</span> cal(<span class="number">3</span>, <span class="number">2</span>);</span><br><span class="line"> <span class="comment">//相等</span></span><br><span class="line"> assertEquals(<span class="number">6</span>, cal, <span class="string">"业务逻辑计算失败"</span>);</span><br><span class="line"> <span class="type">Object</span> <span class="variable">obj1</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Object</span>();</span><br><span class="line"> <span class="type">Object</span> <span class="variable">obj2</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Object</span>();</span><br><span class="line"> assertSame(obj1, obj2, <span class="string">"两个对象不一样"</span>);</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="meta">@DisplayName("数组断言")</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">array</span><span class="params">()</span> {</span><br><span class="line"> assertArrayEquals(<span class="keyword">new</span> <span class="title class_">int</span>[]{<span class="number">1</span>, <span class="number">2</span>}, <span class="keyword">new</span> <span class="title class_">int</span>[]{<span class="number">1</span>, <span class="number">2</span>}, <span class="string">"数组内容不相等"</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="meta">@DisplayName("组合断言")</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">all</span><span class="params">()</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"> assertAll(<span class="string">"test"</span>,</span><br><span class="line"> () -> assertTrue(<span class="literal">true</span> && <span class="literal">true</span>, <span class="string">"结果不为true"</span>),</span><br><span class="line"> () -> assertEquals(<span class="number">1</span>, <span class="number">2</span>, <span class="string">"结果不是1"</span>));</span><br><span class="line"></span><br><span class="line"> System.out.println(<span class="string">"====="</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@DisplayName("异常断言")</span></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testException</span><span class="params">()</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">//断定业务逻辑一定出现异常</span></span><br><span class="line"> assertThrows(ArithmeticException.class, () -> {</span><br><span class="line"> <span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">10</span> / <span class="number">2</span>;</span><br><span class="line"> }, <span class="string">"业务逻辑居然正常运行?"</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@DisplayName("快速失败")</span></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testFail</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">if</span>(<span class="number">1</span> == <span class="number">2</span>){</span><br><span class="line"> fail(<span class="string">"测试失败"</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line"> </span><br><span class="line"> <span class="type">int</span> <span class="title function_">cal</span><span class="params">(<span class="type">int</span> i, <span class="type">int</span> j)</span> {</span><br><span class="line"> <span class="keyword">return</span> i + j;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-前置条件"><a href="#4-前置条件" class="headerlink" title="4.前置条件"></a>4.前置条件</h3><p> JUnit 5 中的前置条件(assumptions[假设])类似于断言,不同之处在于不满足的断言会使得测试方法失败,而不满足的前置条件只会使得测试方法的执行终止。前置条件可以看成是测试方法执行的前提,当该前提不满足时,就没有继续执行的必要</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@DisplayName("前置条件")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">AssumptionsTest</span> {</span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">final</span> <span class="type">String</span> <span class="variable">environment</span> <span class="operator">=</span> <span class="string">"DEV"</span>;</span><br><span class="line"> </span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="meta">@DisplayName("simple")</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">simpleAssume</span><span class="params">()</span> {</span><br><span class="line"> assumeTrue(Objects.equals(<span class="built_in">this</span>.environment, <span class="string">"DEV"</span>));</span><br><span class="line"> assumeFalse(() -> Objects.equals(<span class="built_in">this</span>.environment, <span class="string">"PROD"</span>));</span><br><span class="line"> }</span><br><span class="line"> </span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="meta">@DisplayName("assume then do")</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">assumeThenDo</span><span class="params">()</span> {</span><br><span class="line"> assumingThat(</span><br><span class="line"> Objects.equals(<span class="built_in">this</span>.environment, <span class="string">"DEV"</span>),</span><br><span class="line"> () -> System.out.println(<span class="string">"In DEV"</span>)</span><br><span class="line"> );</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>assumeTrue 和 assumFalse 确保给定的条件为 true 或 false,不满足条件会使得测试执行终止</p>
|
||
<p>assumingThat 的参数是表示条件的布尔值和对应的 Executable 接口的实现对象</p>
|
||
<p>只有条件满足时,Executable 对象才会被执行;当条件不满足时,测试执行并不会终止</p>
|
||
<h3 id="5-嵌套测试"><a href="#5-嵌套测试" class="headerlink" title="5.嵌套测试"></a>5.嵌套测试</h3><p> JUnit 5 可以通过 Java 中的内部类和@Nested 注解实现嵌套测试,从而可以更好的把相关的测试方法组织在一起。在内部类中可以使用@BeforeEach 和@AfterEach 注解,而且嵌套的层次没有限制</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@DisplayName("A stack")</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">TestingAStackDemo</span> {</span><br><span class="line"></span><br><span class="line"> Stack<Object> stack;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="meta">@DisplayName("is instantiated with new Stack()")</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">isInstantiatedWithNew</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Stack</span><>();</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Nested</span></span><br><span class="line"> <span class="meta">@DisplayName("when new")</span></span><br><span class="line"> <span class="keyword">class</span> <span class="title class_">WhenNew</span> {</span><br><span class="line"></span><br><span class="line"> <span class="meta">@BeforeEach</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">createNewStack</span><span class="params">()</span> {</span><br><span class="line"> stack = <span class="keyword">new</span> <span class="title class_">Stack</span><>();</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="meta">@DisplayName("is empty")</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">isEmpty</span><span class="params">()</span> {</span><br><span class="line"> assertTrue(stack.isEmpty());</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="meta">@DisplayName("throws EmptyStackException when popped")</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">throwsExceptionWhenPopped</span><span class="params">()</span> {</span><br><span class="line"> assertThrows(EmptyStackException.class, stack::pop);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="meta">@DisplayName("throws EmptyStackException when peeked")</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">throwsExceptionWhenPeeked</span><span class="params">()</span> {</span><br><span class="line"> assertThrows(EmptyStackException.class, stack::peek);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Nested</span><span class="comment">//b</span></span><br><span class="line"> <span class="meta">@DisplayName("after pushing an element")</span></span><br><span class="line"> <span class="keyword">class</span> <span class="title class_">AfterPushing</span> {</span><br><span class="line"></span><br><span class="line"> <span class="type">String</span> <span class="variable">anElement</span> <span class="operator">=</span> <span class="string">"an element"</span>;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@BeforeEach</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">pushAnElement</span><span class="params">()</span> {</span><br><span class="line"> stack.push(anElement);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="meta">@DisplayName("it is no longer empty")</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">isNotEmpty</span><span class="params">()</span> {</span><br><span class="line"> assertFalse(stack.isEmpty());</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="meta">@DisplayName("returns the element when popped and is empty")</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">returnElementWhenPopped</span><span class="params">()</span> {</span><br><span class="line"> assertEquals(anElement, stack.pop());</span><br><span class="line"> assertTrue(stack.isEmpty());</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="meta">@DisplayName("returns the element when peeked but remains not empty")</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">returnElementWhenPeeked</span><span class="params">()</span> {</span><br><span class="line"> assertEquals(anElement, stack.peek());</span><br><span class="line"> assertFalse(stack.isEmpty());</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="6-参数化测试"><a href="#6-参数化测试" class="headerlink" title="6.参数化测试"></a>6.参数化测试</h3><p>参数化测试是JUnit5很重要的一个新特性,它使得用不同的参数多次运行测试成为了可能,也为我们的单元测试带来许多便利</p>
|
||
<p>利用@ValueSource等注解,指定入参,我们将可以使用不同的参数进行多次单元测试,而不需要每新增一个参数就新增一个单元测试,省去了很多冗余代码</p>
|
||
<p>@ValueSource: 为参数化测试指定入参来源,支持八大基础类以及String类型,Class类型</p>
|
||
<p>@NullSource: 表示为参数化测试提供一个null的入参</p>
|
||
<p>@EnumSource: 表示为参数化测试提供一个枚举入参</p>
|
||
<p>@CsvFileSource:表示读取指定CSV文件内容作为参数化测试入参</p>
|
||
<p>@MethodSource:表示读取指定方法的返回值作为参数化测试入参(注意方法返回需要是一个流)</p>
|
||
<p>当然如果参数化测试仅仅只能做到指定普通的入参还达不到让我觉得惊艳的地步。让我真正感到他的强大之处的地方在于他可以支持外部的各类入参。如:CSV,YML,JSON 文件甚至方法的返回值也可以作为入参。只需要去实现ArgumentsProvider接口,任何外部文件都可以作为它的入参</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@ParameterizedTest</span></span><br><span class="line"><span class="meta">@ValueSource(strings = {"one", "two", "three"})</span></span><br><span class="line"><span class="meta">@DisplayName("参数化测试")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">parameterizedTest</span><span class="params">(String string)</span> {</span><br><span class="line"> System.out.println(string);</span><br><span class="line"> Assertions.assertTrue(StringUtils.isNotBlank(string));</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="meta">@ParameterizedTest</span></span><br><span class="line"><span class="meta">@MethodSource("method")</span> <span class="comment">//指定方法名</span></span><br><span class="line"><span class="meta">@DisplayName("方法来源参数")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">testWithExplicitLocalMethodSource</span><span class="params">(String name)</span> {<span class="comment">//方法的参数来源于一个方法</span></span><br><span class="line"> System.out.println(name);</span><br><span class="line"> Assertions.assertNotNull(name);</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="keyword">static</span> Stream<String> <span class="title function_">method</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> Stream.of(<span class="string">"apple"</span>, <span class="string">"banana"</span>);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="7-迁移指南"><a href="#7-迁移指南" class="headerlink" title="7.迁移指南"></a>7.迁移指南</h3><p>在进行迁移(Junit4迁移到Junit5)的时候需要注意如下的变化:</p>
|
||
<ul>
|
||
<li>注解在 org.junit.jupiter.api 包中,断言在 org.junit.jupiter.api.Assertions 类中,前置条件在 org.junit.jupiter.api.Assumptions 类中。</li>
|
||
<li>把@Before 和@After 替换成@BeforeEach 和@AfterEach。</li>
|
||
<li>把@BeforeClass 和@AfterClass 替换成@BeforeAll 和@AfterAll。</li>
|
||
<li>把@Ignore 替换成@Disabled。</li>
|
||
<li>把@Category 替换成@Tag。</li>
|
||
<li>把@RunWith、@Rule 和@ClassRule 替换成@ExtendWith。</li>
|
||
</ul>
|
||
<h2 id="五-指标监控"><a href="#五-指标监控" class="headerlink" title="五.指标监控"></a>五.指标监控</h2><h3 id="1-SpringBoot-Actuator"><a href="#1-SpringBoot-Actuator" class="headerlink" title="1.SpringBoot Actuator"></a>1.SpringBoot Actuator</h3><p> 未来每一个微服务在云上部署以后,我们都需要对其进行监控、追踪、审计、控制等。SpringBoot就抽取了Actuator场景,使得我们每个微服务快速引用即可获得生产级别的应用监控、审计等功能</p>
|
||
<h4 id="1-1-如何使用"><a href="#1-1-如何使用" class="headerlink" title="1.1 如何使用"></a>1.1 如何使用</h4><p>1.引入依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-actuator<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.测试访问 <a href="http://localhost:8080/actuator/">http://localhost:8080/actuator/</a> endpoint节点</p>
|
||
<p><img src="/pictures/image-20230828110908056.png" alt="image-20230828110908056"></p>
|
||
<p><img src="/pictures/image-20230828110928951.png" alt="image-20230828110928951"></p>
|
||
<p>3.设置以web的方式访问所有的端点</p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">management:</span></span><br><span class="line"> <span class="attr">endpoints:</span></span><br><span class="line"> <span class="attr">enabled-by-default:</span> <span class="literal">true</span> <span class="comment">#暴露所有端点信息</span></span><br><span class="line"> <span class="attr">web:</span></span><br><span class="line"> <span class="attr">exposure:</span></span><br><span class="line"> <span class="attr">include:</span> <span class="string">'*'</span> <span class="comment">#以web方式暴露所有的端点</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>设置之后就可以通过web(访问 <a href="http://localhost:8080/actuator/beans%EF%BC%89%E7%9A%84%E6%96%B9%E5%BC%8F%E8%AE%BF%E9%97%AEbeans%E7%AB%AF%E7%82%B9%E4%BA%86">http://localhost:8080/actuator/beans)的方式访问beans端点了</a></p>
|
||
<p><img src="/pictures/image-20230828113335033.png" alt="image-20230828113335033"></p>
|
||
<p><strong>支持的暴露方式</strong></p>
|
||
<ul>
|
||
<li>HTTP(web):默认只暴露health和info Endpoint,只能访问 <a href="http://localhost:8080/actuator/health%E5%92%8C">http://localhost:8080/actuator/health和</a> <a href="http://localhost:8080/actuator/info">http://localhost:8080/actuator/info</a></li>
|
||
<li>JMX(如Jconsole):默认暴露所有Endpoint,类似于cmd下打开jconsole,可以访问下面所有的endPoints</li>
|
||
<li>除过health和info,剩下的Endpoint都应该进行保护访问。如果引入SpringSecurity,则会默认配置安全访问规则</li>
|
||
</ul>
|
||
<p><strong>是通过web还是jmx方式访问的端点一览表</strong></p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>ID</th>
|
||
<th>JMX</th>
|
||
<th>Web</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td><code>auditevents</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>beans</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>caches</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>conditions</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>configprops</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>env</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>flyway</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>health</code></td>
|
||
<td>Yes</td>
|
||
<td>Yes</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>heapdump</code></td>
|
||
<td>N/A</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>httptrace</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>info</code></td>
|
||
<td>Yes</td>
|
||
<td>Yes</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>integrationgraph</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>jolokia</code></td>
|
||
<td>N/A</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>logfile</code></td>
|
||
<td>N/A</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>loggers</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>liquibase</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>metrics</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>mappings</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>prometheus</code></td>
|
||
<td>N/A</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>scheduledtasks</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>sessions</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>shutdown</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>startup</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>threaddump</code></td>
|
||
<td>Yes</td>
|
||
<td>No</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<h4 id="1-2-常用的EndPoints"><a href="#1-2-常用的EndPoints" class="headerlink" title="1.2 常用的EndPoints"></a>1.2 常用的EndPoints</h4><p><strong><code>http://localhost:8080/actuator/endPoint </code></strong></p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>ID</th>
|
||
<th>描述</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td><code>auditevents</code></td>
|
||
<td>暴露当前应用程序的审核事件信息。需要一个<code>AuditEventRepository组件</code>。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>beans</code></td>
|
||
<td>显示应用程序中所有Spring Bean的完整列表。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>caches</code></td>
|
||
<td>暴露可用的缓存。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>conditions</code></td>
|
||
<td>显示自动配置的所有条件信息,包括匹配或不匹配的原因。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>configprops</code></td>
|
||
<td>显示所有<code>@ConfigurationProperties</code>。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>env</code></td>
|
||
<td>暴露Spring的属性<code>ConfigurableEnvironment</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>flyway</code></td>
|
||
<td>显示已应用的所有Flyway数据库迁移。 需要一个或多个<code>Flyway</code>组件。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>health</code></td>
|
||
<td>显示应用程序运行状况信息。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>httptrace</code></td>
|
||
<td>显示HTTP跟踪信息(默认情况下,最近100个HTTP请求-响应)。需要一个<code>HttpTraceRepository</code>组件。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>info</code></td>
|
||
<td>显示应用程序信息。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>integrationgraph</code></td>
|
||
<td>显示Spring <code>integrationgraph</code> 。需要依赖<code>spring-integration-core</code>。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>loggers</code></td>
|
||
<td>显示和修改应用程序中日志的配置。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>liquibase</code></td>
|
||
<td>显示已应用的所有Liquibase数据库迁移。需要一个或多个<code>Liquibase</code>组件。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>metrics</code></td>
|
||
<td>显示当前应用程序的“指标”信息。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>mappings</code></td>
|
||
<td>显示所有<code>@RequestMapping</code>路径列表。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>scheduledtasks</code></td>
|
||
<td>显示应用程序中的计划任务。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>sessions</code></td>
|
||
<td>允许从Spring Session支持的会话存储中检索和删除用户会话。需要使用Spring Session的基于Servlet的Web应用程序。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>shutdown</code></td>
|
||
<td>使应用程序正常关闭。默认禁用。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>startup</code></td>
|
||
<td>显示由<code>ApplicationStartup</code>收集的启动步骤数据。需要使用<code>SpringApplication</code>进行配置<code>BufferingApplicationStartup</code>。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>threaddump</code></td>
|
||
<td>执行线程转储。</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<p>如果您的应用程序是Web应用程序(Spring MVC,Spring WebFlux或Jersey),则可以使用以下附加端点:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>ID</th>
|
||
<th>描述</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td><code>heapdump</code></td>
|
||
<td>返回<code>hprof</code>堆转储文件。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>jolokia</code></td>
|
||
<td>通过HTTP暴露JMX bean(需要引入Jolokia,不适用于WebFlux)。需要引入依赖<code>jolokia-core</code>。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>logfile</code></td>
|
||
<td>返回日志文件的内容(如果已设置<code>logging.file.name</code>或<code>logging.file.path</code>属性)。支持使用HTTP<code>Range</code>标头来检索部分日志文件的内容。</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>prometheus</code></td>
|
||
<td>以Prometheus服务器可以抓取的格式公开指标。需要依赖<code>micrometer-registry-prometheus</code>。</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<p><strong>最常用的Endpoint</strong></p>
|
||
<ul>
|
||
<li>Health:监控状况</li>
|
||
<li>Metrics:运行时指标</li>
|
||
<li>Loggers:日志记录</li>
|
||
</ul>
|
||
<h4 id="1-3-Health-Endpoint"><a href="#1-3-Health-Endpoint" class="headerlink" title="1.3 Health Endpoint"></a>1.3 Health Endpoint</h4><p>健康检查端点,我们一般用于在云平台,平台会定时的检查应用的健康状况,我们就需要Health Endpoint可以为平台返回当前应用的一系列组件健康状况的集合。</p>
|
||
<p>重要的几点:</p>
|
||
<ul>
|
||
<li>health endpoint返回的结果,应该是一系列健康检查后的一个汇总报告</li>
|
||
<li>很多的健康检查默认已经自动配置好了,比如:数据库、redis等</li>
|
||
<li>可以很容易的添加自定义的健康检查机制</li>
|
||
</ul>
|
||
<p>设置显示health端点的详细信息</p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">management:</span></span><br><span class="line"> <span class="attr">endpoint:</span></span><br><span class="line"> <span class="attr">health:</span></span><br><span class="line"> <span class="attr">show-details:</span> <span class="string">always</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230828142631189.png" alt="image-20230828142631189"></p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"status"</span><span class="punctuation">:</span> <span class="string">"UP"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"components"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"db"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"status"</span><span class="punctuation">:</span> <span class="string">"UP"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"details"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"database"</span><span class="punctuation">:</span> <span class="string">"MySQL"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"validationQuery"</span><span class="punctuation">:</span> <span class="string">"isValid()"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"diskSpace"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"status"</span><span class="punctuation">:</span> <span class="string">"UP"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"details"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"total"</span><span class="punctuation">:</span> <span class="number">510769754112</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"free"</span><span class="punctuation">:</span> <span class="number">342642921472</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"threshold"</span><span class="punctuation">:</span> <span class="number">10485760</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"exists"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">true</span></span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"ping"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"status"</span><span class="punctuation">:</span> <span class="string">"UP"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-4-Metrics-Endpoint"><a href="#1-4-Metrics-Endpoint" class="headerlink" title="1.4 Metrics Endpoint"></a>1.4 Metrics Endpoint</h4><p>提供详细的、层级的、空间指标信息,这些信息可以被pull(主动推送)或者push(被动获取)方式得到;</p>
|
||
<ul>
|
||
<li>通过Metrics对接多种监控系统</li>
|
||
<li>简化核心Metrics开发</li>
|
||
<li>添加自定义Metrics或者扩展已有Metrics</li>
|
||
</ul>
|
||
<p>查看完整的监控指标信息 <a href="http://localhost:8080/actuator/metrics">http://localhost:8080/actuator/metrics</a></p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"names"</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="string">"hikaricp.connections"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"hikaricp.connections.acquire"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"hikaricp.connections.active"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"hikaricp.connections.creation"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"hikaricp.connections.idle"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"hikaricp.connections.max"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"hikaricp.connections.min"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"hikaricp.connections.pending"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"hikaricp.connections.timeout"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"hikaricp.connections.usage"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"http.server.requests"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jdbc.connections.max"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jdbc.connections.min"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.buffer.count"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.buffer.memory.used"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.buffer.total.capacity"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.classes.loaded"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.classes.unloaded"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.gc.live.data.size"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.gc.max.data.size"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.gc.memory.allocated"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.gc.memory.promoted"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.gc.pause"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.memory.committed"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.memory.max"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.memory.used"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.threads.daemon"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.threads.live"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.threads.peak"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"jvm.threads.states"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"logback.events"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"process.cpu.usage"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"process.start.time"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"process.uptime"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"system.cpu.count"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="string">"system.cpu.usage"</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230828143224633.png" alt="image-20230828143224633"></p>
|
||
<p>查看某一个监控指标的详细信息(例如查看hikaricp.connections的详细信息) <a href="http://localhost:8080/actuator/metrics/hikaricp.connections">http://localhost:8080/actuator/metrics/hikaricp.connections</a> </p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"hikaricp.connections"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"description"</span><span class="punctuation">:</span> <span class="string">"Total connections"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"baseUnit"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"measurements"</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"statistic"</span><span class="punctuation">:</span> <span class="string">"VALUE"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"value"</span><span class="punctuation">:</span> <span class="number">10</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"availableTags"</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"tag"</span><span class="punctuation">:</span> <span class="string">"pool"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"values"</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="string">"HikariPool-1"</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-5-管理Endpoint"><a href="#1-5-管理Endpoint" class="headerlink" title="1.5 管理Endpoint"></a>1.5 管理Endpoint</h4><p><strong>开启与禁用Endpoints</strong></p>
|
||
<ul>
|
||
<li>默认所有的Endpoint除过shutdown都是开启的。</li>
|
||
<li>需要开启或者禁用某个Endpoint 配置模式为 management.endpoint.endpointName.enabled = true</li>
|
||
</ul>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">management:</span></span><br><span class="line"> <span class="attr">endpoint:</span></span><br><span class="line"> <span class="attr">beans:</span> <span class="comment">#可以写health、metrics等端点</span></span><br><span class="line"> <span class="attr">enabled:</span> <span class="literal">true</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<ul>
|
||
<li>或者禁用所有的Endpoint然后手动开启指定的Endpoint</li>
|
||
</ul>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">management:</span></span><br><span class="line"> <span class="attr">endpoints:</span></span><br><span class="line"> <span class="attr">enabled-by-default:</span> <span class="literal">false</span> <span class="comment">#禁用所有的端点(jconsole中也无法使用)</span></span><br><span class="line"> <span class="attr">endpoint:</span></span><br><span class="line"> <span class="attr">beans:</span></span><br><span class="line"> <span class="attr">enabled:</span> <span class="literal">true</span> <span class="comment">#逐一开启端点</span></span><br><span class="line"> <span class="attr">health:</span></span><br><span class="line"> <span class="attr">enabled:</span> <span class="literal">true</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-6-定制Endpoint"><a href="#1-6-定制Endpoint" class="headerlink" title="1.6 定制Endpoint"></a>1.6 定制Endpoint</h4><h5 id="1-6-1-定制health-endpoint"><a href="#1-6-1-定制health-endpoint" class="headerlink" title="1.6.1 定制health endpoint"></a>1.6.1 定制health endpoint</h5><p>1.编写MyComHealthIndicator类继承AbstractHealthIndicator</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot.acutuator.health;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.actuate.health.AbstractHealthIndicator;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.actuate.health.Health;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.actuate.health.Status;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Component;</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></span><br><span class="line"><span class="comment"> * 类的后缀必须为HealthIndicator</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Component</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MyComHealthIndicator</span> <span class="keyword">extends</span> <span class="title class_">AbstractHealthIndicator</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="meta">@Override</span></span><br><span class="line"> <span class="keyword">protected</span> <span class="keyword">void</span> <span class="title function_">doHealthCheck</span><span class="params">(Health.Builder builder)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> Map<String,Object> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> <span class="comment">// 检查完成</span></span><br><span class="line"> <span class="keyword">if</span>(<span class="number">1</span> == <span class="number">1</span>){ <span class="comment">//这里我们可以编写一个业务逻辑,例如数据库是否连接成功的业务逻辑</span></span><br><span class="line"> <span class="comment">// builder.up(); //健康</span></span><br><span class="line"> builder.status(Status.UP);</span><br><span class="line"> map.put(<span class="string">"count"</span>,<span class="number">1</span>);</span><br><span class="line"> map.put(<span class="string">"ms"</span>,<span class="number">100</span>);</span><br><span class="line"> }<span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">//builder.down();</span></span><br><span class="line"> builder.status(Status.OUT_OF_SERVICE);</span><br><span class="line"> map.put(<span class="string">"err"</span>,<span class="string">"连接超时"</span>);</span><br><span class="line"> map.put(<span class="string">"ms"</span>,<span class="number">3000</span>);</span><br><span class="line"> }</span><br><span class="line"> builder.withDetail(<span class="string">"code"</span>,<span class="number">100</span>)</span><br><span class="line"> .withDetails(map);</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>myCom = MyComHealthIndicator - HealthIndicator 所以类的名字一定要以HealthIndicator为后缀</p>
|
||
<p><img src="/pictures/image-20230828150633322.png" alt="image-20230828150633322"></p>
|
||
<h5 id="1-6-2-定制-info-endpoint"><a href="#1-6-2-定制-info-endpoint" class="headerlink" title="1.6.2 定制 info endpoint"></a>1.6.2 定制 info endpoint</h5><p>方式一: 编写配置文件</p>
|
||
<figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">info:</span></span><br><span class="line"> <span class="attr">appName:</span> <span class="string">boot-admin</span> <span class="comment">#应用名</span></span><br><span class="line"> <span class="attr">version:</span> <span class="number">2.0</span><span class="number">.1</span> <span class="comment">#版本</span></span><br><span class="line"> <span class="attr">mavenProjectName:</span> <span class="string">@project.artifactId@</span> <span class="comment">#使用@@可以获取maven的pom文件值</span></span><br><span class="line"> <span class="attr">mavenProjectVersion:</span> <span class="string">@project.version@</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230828151416487.png" alt="image-20230828151416487"></p>
|
||
<p>方式二: 编写InfoContributor</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot.acutuator.info;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.actuate.info.Info;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.actuate.info.InfoContributor;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Component;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Collections;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="meta">@Component</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">AppInfoInfoContributor</span> <span class="keyword">implements</span> <span class="title class_">InfoContributor</span> {</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> <span class="keyword">void</span> <span class="title function_">contribute</span><span class="params">(Info.Builder builder)</span> {</span><br><span class="line"></span><br><span class="line"> builder.withDetail(<span class="string">"msg"</span>,<span class="string">"你好"</span>)</span><br><span class="line"> .withDetail(<span class="string">"hello"</span>,<span class="string">"atguigu"</span>)</span><br><span class="line"> .withDetails(Collections.singletonMap(<span class="string">"world"</span>,<span class="string">"666600"</span>));</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>如果我们没有删除上面配置文件的配置,这时我们访问 <a href="http://localhost:8080/actuator/info">http://localhost:8080/actuator/info</a> 的时候会将配置文件和InfoContributor中的信息共同返回</p>
|
||
<p><img src="/pictures/image-20230828152006549.png" alt="image-20230828152006549"></p>
|
||
<h5 id="1-6-3-定制Metrics信息"><a href="#1-6-3-定制Metrics信息" class="headerlink" title="1.6.3 定制Metrics信息"></a>1.6.3 定制Metrics信息</h5><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">class</span> <span class="title class_">MyService</span>{</span><br><span class="line"> </span><br><span class="line"> Counter counter;</span><br><span class="line"> </span><br><span class="line"> <span class="comment">//构造器注入MeterRegistry</span></span><br><span class="line"> <span class="keyword">public</span> <span class="title function_">MyService</span><span class="params">(MeterRegistry meterRegistry)</span>{</span><br><span class="line"> <span class="comment">//访问 http://localhost:8080/actuator/metrics 的时候会多一个监控项myservice.method.running.counter</span></span><br><span class="line"> counter = meterRegistry.counter(<span class="string">"myservice.method.running.counter"</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">hello</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//调用hello方法的时候counter加1</span></span><br><span class="line"> counter.increment();</span><br><span class="line"> }</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="meta">@Bean</span></span><br><span class="line">MeterBinder <span class="title function_">queueSize</span><span class="params">(Queue queue)</span> {</span><br><span class="line"> <span class="keyword">return</span> (registry) -> Gauge.builder(<span class="string">"queueSize"</span>, queue::size).register(registry);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-7-新增Endpoint"><a href="#1-7-新增Endpoint" class="headerlink" title="1.7 新增Endpoint"></a>1.7 新增Endpoint</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.boot.acutuator.endpoint;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.actuate.endpoint.annotation.Endpoint;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.actuate.endpoint.annotation.ReadOperation;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.actuate.endpoint.annotation.WriteOperation;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Component;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Collections;</span><br><span class="line"><span class="keyword">import</span> java.util.Map;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="meta">@Component</span></span><br><span class="line"><span class="meta">@Endpoint(id = "myservice")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MyServiceEndPoint</span> {</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="meta">@ReadOperation</span></span><br><span class="line"> <span class="keyword">public</span> Map <span class="title function_">getDockerInfo</span><span class="params">()</span>{</span><br><span class="line"> <span class="comment">//端点的读操作 http://localhost:8080/actuator/myservice</span></span><br><span class="line"> <span class="keyword">return</span> Collections.singletonMap(<span class="string">"dockerInfo"</span>,<span class="string">"docker started....."</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@WriteOperation</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">stopDocker</span><span class="params">()</span>{</span><br><span class="line"> System.out.println(<span class="string">"docker stopped....."</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230828153914619.png" alt="image-20230828153914619"></p>
|
||
<p><img src="/pictures/image-20230828153902598.png" alt="image-20230828153902598"></p>
|
||
<h4 id="1-8-可视化"><a href="#1-8-可视化" class="headerlink" title="1.8 可视化"></a>1.8 可视化</h4><p>github地址: <a href="https://github.com/codecentric/spring-boot-admin">https://github.com/codecentric/spring-boot-admin</a></p>
|
||
<p>项目文档: <a href="https://docs.spring-boot-admin.com/current/getting-started.html">https://docs.spring-boot-admin.com/current/getting-started.html</a></p>
|
||
<p>1.创建一个新的springBoot项目用作服务端(场景只需要选择web场景即可)</p>
|
||
<p><img src="/pictures/image-20230828154818630.png" alt="image-20230828154818630"></p>
|
||
<p>2.引入依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>de.codecentric<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-admin-starter-server<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.3.1<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3.在启动类上添加注解</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@EnableAdminServer</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>4.修改以下端口号以防和业务的端口冲突</p>
|
||
<figure class="highlight properties"><table><tr><td class="code"><pre><span class="line"><span class="attr">server.port</span>=<span class="string">8888</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>5.访问<a href="http://localhost:8888/">http://localhost:8888</a></p>
|
||
<p><img src="/pictures/image-20230828155537932.png" alt="image-20230828155537932"></p>
|
||
<p>6.客户端上引入依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>de.codecentric<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-admin-starter-client<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.3.1<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>7.客户端的配置文件添加以下的配置</p>
|
||
<figure class="highlight properties"><table><tr><td class="code"><pre><span class="line"><span class="attr">spring.boot.admin.client.url</span>=<span class="string">http://localhost:8888 #服务端的地址</span></span><br><span class="line"><span class="attr">management.endpoints.web.exposure.include</span>=<span class="string">*</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>8.重启一下客户端,然后访问服务端的localhost:8080</p>
|
||
<p><img src="/pictures/image-20230828160606081.png" alt="image-20230828160606081"></p>
|
||
<p>点击应用墙,点击需要查看信息的应用就可以看到应用的详细信息</p>
|
||
<p><img src="/pictures/image-20230828160731314.png" alt="image-20230828160731314"></p>
|
||
<h2 id="六-原理解析"><a href="#六-原理解析" class="headerlink" title="六.原理解析"></a>六.原理解析</h2><h3 id="1-Profile功能"><a href="#1-Profile功能" class="headerlink" title="1.Profile功能"></a>1.Profile功能</h3><p>为了方便多环境适配,springboot简化了profile功能</p>
|
||
<ul>
|
||
<li><p>默认配置文件 application.yaml;任何时候都会加载</p>
|
||
</li>
|
||
<li><p>指定环境配置文件 application-{env}.yaml</p>
|
||
</li>
|
||
<li><p>激活指定环境</p>
|
||
</li>
|
||
<li><ul>
|
||
<li>配置文件激活,在默认配置文件 application.yaml 中添加spring.profiles.active=xxxx</li>
|
||
<li>命令行激活:java -jar xxx.jar –spring.profiles.active=prod</li>
|
||
</ul>
|
||
</li>
|
||
<li><ul>
|
||
<li><ul>
|
||
<li>修改配置文件的任意值,命令行优先</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li><p>默认配置与环境配置同时生效</p>
|
||
</li>
|
||
<li><p>同名配置项,profile配置优先</p>
|
||
</li>
|
||
</ul>
|
||
<p><strong>@Profile注解</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">//@Profile("prod")</span></span><br><span class="line"><span class="comment">//可以标注在类和方法上</span></span><br><span class="line"><span class="comment">//标注在类和方法上表示在prod环境下启用</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>外部配置源</strong></p>
|
||
<p>常用:Java属性文件、YAML文件、环境变量、命令行参数;</p>
|
||
<p><strong>配置文件查找位置</strong></p>
|
||
<p>下面的优先级覆盖上面的优先级</p>
|
||
<p>(1) classpath 根路径</p>
|
||
<p>(2) classpath 根路径下config目录</p>
|
||
<p>(3) jar包当前目录</p>
|
||
<p>(4) jar包当前目录的config目录</p>
|
||
<p>(5) /config子目录的直接子目录</p>
|
||
<p><strong>配置文件加载顺序:</strong></p>
|
||
<ol>
|
||
<li> 当前jar包内部的application.properties和application.yml</li>
|
||
<li> 当前jar包内部的application-{profile}.properties 和 application-{profile}.yml</li>
|
||
<li> 引用的外部jar包的application.properties和application.yml</li>
|
||
<li> 引用的外部jar包的application-{profile}.properties 和 application-{profile}.yml</li>
|
||
</ol>
|
||
<p><strong>总结:</strong> 指定环境优先,外部优先,后面的可以覆盖前面的同名配置项</p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>SpringBoot</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>压力测试与性能监控</title>
|
||
<url>/posts/1416.html</url>
|
||
<content><![CDATA[<h2 id="一-压力测试"><a href="#一-压力测试" class="headerlink" title="一.压力测试"></a>一.压力测试</h2><p><strong>性能指标</strong></p>
|
||
<ul>
|
||
<li><p>响应时间(Response Time: RT)响应时间指用户从客户端发起一个请求开始,到客户端接收到从服务器端返回的响应结束,整个过程所耗费的时间。</p>
|
||
</li>
|
||
<li><p>HPS(Hits Per Second) :每秒点击次数,单位是次/秒。</p>
|
||
</li>
|
||
<li><p>TPS(Transaction per Second):系统每秒处理交易数,单位是笔/秒。</p>
|
||
</li>
|
||
<li><p>QPS(Query per Second):系统每秒处理查询次数,单位是次/秒。对于互联网业务中,如果某些业务有且仅有一个请求连接,那么 TPS=QPS=HPS,一般情况下用 TPS 来衡量整个业务流程,用 QPS 来衡量接口查询次数,用 HPS 来表示对服务器单击请求。</p>
|
||
</li>
|
||
<li><p>无论 TPS、QPS、HPS,此指标是衡量系统处理能力非常重要的指标,越大越好,根据经验,一般情况下:</p>
|
||
<p>金融行业:1000TPS~50000TPS,不包括互联网化的活动</p>
|
||
<p>保险行业:100TPS~100000TPS,不包括互联网化的活动</p>
|
||
<p>制造行业:10TPS~5000TPS</p>
|
||
<p>互联网电子商务:10000TPS~1000000TPS</p>
|
||
<p>互联网中型网站:1000TPS~50000TPS</p>
|
||
<p>互联网小型网站:500TPS~10000TPS</p>
|
||
</li>
|
||
<li><p>最大响应时间(Max Response Time) 指用户发出请求或者指令到系统做出反应(响应)的最大时间。</p>
|
||
</li>
|
||
<li><p>最少响应时间(Mininum ResponseTime) 指用户发出请求或者指令到系统做出反应(响应)的最少时间。</p>
|
||
</li>
|
||
<li><p>90%响应时间(90% Response Time) 是指所有用户的响应时间进行排序,第 90%的响应时间。</p>
|
||
</li>
|
||
<li><p>从外部看,性能测试主要关注如下三个指标</p>
|
||
<p>吞吐量:每秒钟系统能够处理的请求数、任务数。</p>
|
||
<p>响应时间:服务处理一个请求或一个任务的耗时。</p>
|
||
<p>错误率:一批请求中结果出错的请求所占比例。</p>
|
||
</li>
|
||
</ul>
|
||
<h3 id="1-JMeter的使用"><a href="#1-JMeter的使用" class="headerlink" title="1.JMeter的使用"></a>1.JMeter的使用</h3><h4 id="1-1-安装"><a href="#1-1-安装" class="headerlink" title="1.1 安装"></a>1.1 安装</h4><p><strong>1.下载安装包</strong></p>
|
||
<p>安装网址: <a href="https://jmeter.apache.org/download_jmeter.cgi">https://jmeter.apache.org/download_jmeter.cgi</a></p>
|
||
<p><img src="/pictures/image-20230709161151542.png" alt="image-20230709161151542"></p>
|
||
<p><strong>2.解压并双击运行</strong></p>
|
||
<p><img src="/pictures/image-20230709161346717.png" alt="image-20230709161346717"></p>
|
||
<p><img src="/pictures/image-20230709161600398.png" alt="image-20230709161600398"></p>
|
||
<h4 id="1-2-设置"><a href="#1-2-设置" class="headerlink" title="1.2 设置"></a>1.2 设置</h4><p>设置为中文页面</p>
|
||
<p>点击Options->Language->选择简体中文</p>
|
||
<p><img src="/pictures/image-20230709161752103.png" alt="image-20230709161752103"></p>
|
||
<p>永久设置成中文->在<code>bin\jmeter.properties</code>配置文件中添加如下配置</p>
|
||
<p><img src="/pictures/image-20240105214825445.png" alt="image-20240105214825445"></p>
|
||
<p>jmeter发送请求响应的数据乱码的问题->在<code>bin\jmeter.properties</code>配置文件中添加如下配置</p>
|
||
<p><img src="/pictures/image-20240105215115275.png" alt="image-20240105215115275"></p>
|
||
<h4 id="1-3-压测示例"><a href="#1-3-压测示例" class="headerlink" title="1.3 压测示例"></a>1.3 压测示例</h4><p><strong>1.新建线程组</strong></p>
|
||
<p>右键点击测试计划->添加->线程->线程组</p>
|
||
<p><img src="/pictures/image-20230709162502383.png" alt="image-20230709162502383"></p>
|
||
<p>线程组参数详解:</p>
|
||
<ul>
|
||
<li><p>线程数:虚拟用户数。一个虚拟用户占用一个进程或线程。设置多少虚拟用户数在这里也就是设置多少个线程数。</p>
|
||
</li>
|
||
<li><p>线程数:虚拟用户数。一个虚拟用户占用一个进程或线程。设置多少虚拟用户数在这里也就是设置多少个线程数。</p>
|
||
</li>
|
||
<li><p>Ramp-Up Period(in seconds)准备时长:设置的虚拟用户数需要多长时间全部启动。如果线程数为 10,准备时长为 2,那么需要 2 秒钟启动10个线程,也就是每秒钟启动 5 个线程。</p>
|
||
</li>
|
||
<li><p>循环次数:每个线程发送请求的次数。如果线程数为 10,循环次数为 100,那么每个线程发送 100 次请求。总请求数为 10*100=1000 。如勾选了“永远”,那么所有线程会一直发送请求,一到选择停止运行脚本。</p>
|
||
</li>
|
||
<li><p>Delay Thread creation until needed:直到需要时延迟线程的创建。</p>
|
||
</li>
|
||
<li><p>调度器:设置线程组启动的开始时间和结束时间(配置调度器时,需要勾选循环次数为永远)</p>
|
||
</li>
|
||
<li><p>持续时间(秒):测试持续时间,会覆盖结束时间</p>
|
||
</li>
|
||
<li><p>启动延迟(秒):测试延迟启动时间,会覆盖启动时间</p>
|
||
</li>
|
||
<li><p>启动时间:测试启动时间,启动延迟会覆盖它。当启动时间已过,手动只需测试时当前时间也会覆盖它。</p>
|
||
</li>
|
||
<li><p>结束时间:测试结束时间,持续时间会覆盖它。</p>
|
||
</li>
|
||
</ul>
|
||
<p><strong>2.添加HTTP请求</strong></p>
|
||
<p><img src="/pictures/image-20230709163303477.png" alt="image-20230709163303477"></p>
|
||
<p><img src="/pictures/image-20230709163457833.png" alt="image-20230709163457833"></p>
|
||
<p><strong>3.添加监听器</strong></p>
|
||
<p><img src="/pictures/image-20230709163639856.png" alt="image-20230709163639856"></p>
|
||
<p><strong>4.启动压测和查看分析结果</strong></p>
|
||
<p><img src="/pictures/image-20230709164012746.png" alt="image-20230709164012746"></p>
|
||
<p><img src="/pictures/image-20230709164208747.png" alt="image-20230709164208747"></p>
|
||
<h4 id="1-4-JMeter-Address-Already-in-use-错误解决"><a href="#1-4-JMeter-Address-Already-in-use-错误解决" class="headerlink" title="1.4 JMeter Address Already in use 错误解决"></a>1.4 JMeter Address Already in use 错误解决</h4><p>windows 本身提供的端口访问机制的问题。<br>Windows 提供给 TCP/IP 链接的端口为 1024-5000,并且要四分钟来循环回收他们。就导致<br>我们在短时间内跑大量的请求时将端口占满了。<br>1.cmd 中,用 regedit 命令打开注册表</p>
|
||
<p>2.在 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters 下,<br>右击 parameters,添加一个新的 DWORD,名字为 MaxUserPort,然后双击 MaxUserPort,输入数值数据为 65534,基数选择十进制(如果是分布式运行的话,控制机器和负载机器都需要这样操作)</p>
|
||
<p>3.修改配置完毕之后记得重启机器才会生效<br>官网解释:<a href="https://support.microsoft.com/zh-cn/help/196271/when-you-try-to-connect-from-tcp-ports-greater-than-5000-you-receive-t">https://support.microsoft.com/zh-cn/help/196271/when-you-try-to-connect-from-tcp-ports-greater-than-5000-you-receive-t</a><br>TCPTimedWaitDelay:30</p>
|
||
<h2 id="二-性能监控"><a href="#二-性能监控" class="headerlink" title="二.性能监控"></a>二.性能监控</h2><p>Jdk 的两个小工具 jconsole、jvisualvm(升级版的 jconsole);通过命令行启动,可监控本地和远程应用。</p>
|
||
<h3 id="1-jconsole"><a href="#1-jconsole" class="headerlink" title="1.jconsole"></a>1.jconsole</h3><p><img src="/pictures/image-20230709160343565.png" alt="image-20230709160343565"></p>
|
||
<h3 id="2-jvisualvm"><a href="#2-jvisualvm" class="headerlink" title="2.jvisualvm"></a><strong>2.jvisualvm</strong></h3><p><strong>jvisualvm相比jconsole功能更全,一般使用jvisualvm</strong></p>
|
||
<p><img src="/pictures/image-20230709160552461.png" alt="image-20230709160552461"></p>
|
||
<p><strong>Visual GC插件的安装</strong></p>
|
||
<p>点击工具->插件->在可用插件中选择Visual GC安装</p>
|
||
<p>安装成功之后显示如下</p>
|
||
<p><img src="/pictures/image-20230709160932416.png" alt="image-20230709160932416"></p>
|
||
<p><img src="/pictures/image-20230709170626946.png" alt="image-20230709170626946"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>测试</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>测试</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>Thymeleaf教程</title>
|
||
<url>/posts/54835.html</url>
|
||
<content><![CDATA[<p>Thymeleaf 是一个服务器端 Java 模板引擎,能够处理 HTML、XML、CSS、JAVASCRIPT 等模板文件。Thymeleaf 模板可以直接当作静态原型来使用,它主要目标是为开发者的开发工作流程带来优雅的自然模板,也是 Java 服务器端 HTML5 开发的理想选择。</p>
|
||
<p><img src="/pictures/image-20230706152329777.png" alt="image-20230706152329777"></p>
|
||
<p>教程: <a href="https://www.thymeleaf.org/">https://www.thymeleaf.org</a></p>
|
||
<h1 id="项目集成Thymeleaf"><a href="#项目集成Thymeleaf" class="headerlink" title="项目集成Thymeleaf"></a>项目集成Thymeleaf</h1><p><strong>1.导入依赖</strong></p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!-- thymeleaf--></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-thymeleaf<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>2.添加配置</strong></p>
|
||
<figure class="highlight properties"><table><tr><td class="code"><pre><span class="line"><span class="attr">spring.thymeleaf.cache</span>=<span class="string">false #关闭缓存(后面使用devtools进行热更新也要关闭缓存)</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>3.在HTML文件中引入名称空间</strong></p>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">xmlns:th</span>=<span class="string">"http://www.thymeleaf.org"</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">xmlns:th</span>=<span class="string">"http://www.thymeleaf.org"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>标题<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"Content-Type"</span> <span class="attr">content</span>=<span class="string">"text/html; charset=UTF-8"</span> /></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">p</span> <span class="attr">th:text</span>=<span class="string">"#{home.welcome}"</span>></span>Welcome to our grocery store!<span class="tag"></<span class="name">p</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h1 id="Thymeleaf"><a href="#Thymeleaf" class="headerlink" title="Thymeleaf"></a>Thymeleaf</h1><h2 id="devtools热部署"><a href="#devtools热部署" class="headerlink" title="devtools热部署"></a><strong>devtools热部署</strong></h2><p>Tips:在使用Thymeleaf的时候修改页面我们要频繁的重启项目,非常浪费时间,这时我们可以导入devtools进行热部署</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!--devtools--></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-devtools<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">optional</span>></span>true<span class="tag"></<span class="name">optional</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>导入之后重启项目,会显示如下的标识</p>
|
||
<p><img src="/pictures/image-20230706154112026.png" alt="image-20230706154112026"></p>
|
||
<p>每次修改页面之后,我们只需要在当前文件下重新build一下(Ctrl+Shift+F9),就可以实现热更新</p>
|
||
<p><img src="/pictures/image-20230706161401528.png" alt="image-20230706161401528"></p>
|
||
<h2 id="使用文档"><a href="#使用文档" class="headerlink" title="使用文档"></a>使用文档</h2><p>英文文档: <a href="https://www.thymeleaf.org/doc/tutorials/3.1/usingthymeleaf.html">https://www.thymeleaf.org/doc/tutorials/3.1/usingthymeleaf.html</a></p>
|
||
<p>博客文章: <a href="https://fanlychie.github.io/post/thymeleaf.html">https://fanlychie.github.io/post/thymeleaf.html</a></p>
|
||
<p><strong>中文PDF文档</strong></p>
|
||
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/Thymeleaf中文参考文档.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>前端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>Thymeleaf</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>ElasticSearch</title>
|
||
<url>/posts/22654.html</url>
|
||
<content><![CDATA[<p>官网: <a href="https://www.elastic.co/cn/elasticsearch/">https://www.elastic.co/cn/elasticsearch/</a></p>
|
||
<h1 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h1><p> Elasticsearch 是一个分布式、RESTful 风格的搜索和数据分析引擎,能够解决不断涌现出的各种用例。作为 Elastic Stack 的核心,Elasticsearch 会集中存储您的数据,让您飞快完成搜索,微调相关性,进行强大的分析,并轻松缩放规模。</p>
|
||
<h1 id="一-基本概念"><a href="#一-基本概念" class="headerlink" title="一.基本概念"></a>一.基本概念</h1><p><strong>1.Index(索引)</strong></p>
|
||
<p>动词:相当于mysql的insert</p>
|
||
<p>名词:相当于mysql的database</p>
|
||
<p><strong>2.Type(类型)</strong></p>
|
||
<p>在index中可以定义一个或者多个类型</p>
|
||
<p>类似于mysql中的Table;每一种类型的数据放在一起</p>
|
||
<p><strong>3.Document(文档)</strong></p>
|
||
<p>保存在某个索引(index)下,某种类型(Type)的一个数据(Document),文档是JSON格式的,</p>
|
||
<p>Document就是像mysql中的某个Table里面的内容。</p>
|
||
<p><strong>4.倒排索引</strong></p>
|
||
<p><img src="/pictures/image-20230628180000365.png" alt="image-20230628180000365"></p>
|
||
<h1 id="二-Docker安装ElasticSearch"><a href="#二-Docker安装ElasticSearch" class="headerlink" title="二.Docker安装ElasticSearch"></a>二.Docker安装ElasticSearch</h1><h2 id="1-安装ElasticSearch-存储和检索数据"><a href="#1-安装ElasticSearch-存储和检索数据" class="headerlink" title="1.安装ElasticSearch(存储和检索数据)"></a>1.安装ElasticSearch(存储和检索数据)</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">拉取ElasticSearch</span></span><br><span class="line">docker pull elasticsearch:7.4.2</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">ES的配置文件存放的位置</span></span><br><span class="line">mkdir -p /mydata/elasticsearch/config</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">ES相关的数据</span></span><br><span class="line">mkdir -p /mydata/elasticsearch/data</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 class="string">"http.host: 0.0.0.0"</span>(可以被任何的机器访问)的配置写入elasticsearch.yml中(注意冒号后面的空格)</span></span><br><span class="line">echo "http.host: 0.0.0.0" >> /mydata/elasticsearch/config/elasticsearch.yml</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"><span class="meta prompt_"># </span><span class="language-bash">递归更改权限,es需要访问</span></span><br><span class="line">chmod -R 777 /mydata/elasticsearch/</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">运行容器的命令 9200端口用于发送请求使用 9300端口用于集群中节点中的通信使用</span></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">初始占用64m,最大占用512m(不指定,ES会占用所有的内存)</span></span><br><span class="line">docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \</span><br><span class="line">-e "discovery.type=single-node" \</span><br><span class="line">-e ES_JAVA_OPTS="-Xms64m -Xmx512m" \</span><br><span class="line">-v /mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \</span><br><span class="line">-v /mydata/elasticsearch/data:/usr/share/elasticsearch/data \</span><br><span class="line">-v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \</span><br><span class="line">-d elasticsearch:7.4.2 </span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置开机启动elasticsearch</span></span><br><span class="line">docker update elasticsearch --restart=always</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">http://虚拟机的ip:9200/</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230628191936254.png" alt="image-20230628191936254"></p>
|
||
<h2 id="2-安装Kibana-可视化检索数据"><a href="#2-安装Kibana-可视化检索数据" class="headerlink" title="2.安装Kibana(可视化检索数据)"></a>2.安装Kibana(可视化检索数据)</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">拉取Kibana</span></span><br><span class="line">docker pull kibana:7.4.2</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">这里-e是自己的elasticsearch服务地址(这里的地址一定要改为自己虚拟机的地址)</span></span><br><span class="line">docker run --name kibana -e ELASTICSEARCH_HOSTS=http://192.168.195.100:9200 -p 5601:5601 -d kibana:7.4.2</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置开机启动kibana</span></span><br><span class="line">docker update kibana --restart=always</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">访问对应的网址查看服务</span></span><br><span class="line">http://虚拟机的ip:5601</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230701104616032.png" alt="image-20230701104616032"></p>
|
||
<h1 id="三-初步检索"><a href="#三-初步检索" class="headerlink" title="三.初步检索"></a>三.初步检索</h1><h2 id="1-Cat"><a href="#1-Cat" class="headerlink" title="1._Cat"></a>1._Cat</h2><p>GET/_cat/nodes 查看所有节点</p>
|
||
<p>GET/_cat/health 查看es的健康状态</p>
|
||
<p>GET/_cat/master 查看主节点</p>
|
||
<p>GET/_cat/indices 查看所有索引 </p>
|
||
<h2 id="2-索引文档-保存"><a href="#2-索引文档-保存" class="headerlink" title="2.索引文档(保存)"></a>2.索引文档(保存)</h2><p><strong>保存操作可以发送PUT或者POST请求</strong></p>
|
||
<p>put需要在路径上指定id</p>
|
||
<p>post请求可以不指定id,自动生成一个唯一标识</p>
|
||
<p>例:PUT customer/external/1 在customer索引下的external类型下保存1号数据为</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line">-> PUT customer/external/<span class="number">1</span></span><br><span class="line"><span class="comment">//请求体</span></span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span><span class="string">"John Doe"</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230701144040577.png" alt="image-20230701144040577"></p>
|
||
<p>返回的数据解析</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="comment">//_开头的数据称为元数据</span></span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"_index"</span><span class="punctuation">:</span> <span class="string">"customer"</span><span class="punctuation">,</span><span class="comment">//数据存在的数据库</span></span><br><span class="line"> <span class="attr">"_type"</span><span class="punctuation">:</span> <span class="string">"external"</span><span class="punctuation">,</span><span class="comment">//保存数据的类型</span></span><br><span class="line"> <span class="attr">"_id"</span><span class="punctuation">:</span> <span class="string">"1"</span><span class="punctuation">,</span><span class="comment">//数据的id</span></span><br><span class="line"> <span class="attr">"_version"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span><span class="comment">//数据的版本</span></span><br><span class="line"> <span class="attr">"result"</span><span class="punctuation">:</span> <span class="string">"created"</span><span class="punctuation">,</span><span class="comment">//保存为"created",修改为"updated",发送多次为更新的操作</span></span><br><span class="line"> <span class="attr">"_shards"</span><span class="punctuation">:</span> <span class="punctuation">{</span> <span class="comment">//分片</span></span><br><span class="line"> <span class="attr">"total"</span><span class="punctuation">:</span> <span class="number">2</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"successful"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"failed"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_seq_no"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_primary_term"</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="3-查询文档"><a href="#3-查询文档" class="headerlink" title="3.查询文档"></a>3.查询文档</h2><figure class="highlight json"><table><tr><td class="code"><pre><span class="line">-> GET customer/external/<span class="number">1</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230701145518348.png" alt="image-20230701145518348"></p>
|
||
<p>返回数据解析</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"_index"</span><span class="punctuation">:</span> <span class="string">"customer"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_type"</span><span class="punctuation">:</span> <span class="string">"external"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_id"</span><span class="punctuation">:</span> <span class="string">"1"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_version"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_seq_no"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span><span class="comment">//并发控制的字段,每次更新就会+1,用来做乐观锁</span></span><br><span class="line"> <span class="attr">"_primary_term"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span><span class="comment">//同上,主分片重新分配,如重启,就会有变化</span></span><br><span class="line"> <span class="attr">"found"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span><span class="comment">//是否找到</span></span><br><span class="line"> <span class="attr">"_source"</span><span class="punctuation">:</span> <span class="punctuation">{</span><span class="comment">//数据真正的内容</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"John Doe"</span> </span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="4-更新文档"><a href="#4-更新文档" class="headerlink" title="4.更新文档"></a>4.更新文档</h2><figure class="highlight json"><table><tr><td class="code"><pre><span class="line">POST customer/external/<span class="number">1</span>/_update <span class="comment">//对比原先的数据,和原先的一样_version和_seq_no不会发生改变</span></span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"doc"</span><span class="punctuation">:</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"John Doe"</span> </span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br><span class="line">或者 </span><br><span class="line">POST customer/external/<span class="number">1</span> <span class="comment">//和之前的数据一样的话也会执行更新操作</span></span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"John Doe"</span></span><br><span class="line"><span class="punctuation">}</span></span><br><span class="line">或者</span><br><span class="line">PUT customer/external/<span class="number">1</span></span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"John Doe"</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p> 使用POST customer/external/1/_update 的方式进行更新会对比原先的数据,和原先的一样version和_seq_no不会发生改变,下面是我们使用同样的数据发送两次更新请求,第二次的result显示”noop”,没有进行操作</p>
|
||
<p><img src="/pictures/image-20230701151445190.png" alt="image-20230701151445190"></p>
|
||
<h2 id="5-删除文档-索引"><a href="#5-删除文档-索引" class="headerlink" title="5.删除文档|索引"></a>5.删除文档|索引</h2><figure class="highlight json"><table><tr><td class="code"><pre><span class="line">DELETE customer/external/<span class="number">1</span></span><br><span class="line">DELETE customer</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>删除文档</p>
|
||
<p><img src="/pictures/image-20230701152501989.png" alt="image-20230701152501989"></p>
|
||
<p>删除索引</p>
|
||
<p><img src="/pictures/image-20230701152648756.png" alt="image-20230701152648756"></p>
|
||
<h2 id="6-bulk批量API"><a href="#6-bulk批量API" class="headerlink" title="6.bulk批量API"></a>6.bulk批量API</h2><p><strong>Kibana的使用</strong></p>
|
||
<p><img src="/pictures/image-20230701153754438.png" alt="image-20230701153754438"></p>
|
||
<p><strong>批量保存数据</strong></p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line">POST /customer/external/_bulk</span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"1"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"name"</span><span class="punctuation">:</span><span class="string">"a"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"2"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"name"</span><span class="punctuation">:</span><span class="string">"b"</span><span class="punctuation">}</span></span><br><span class="line">新增两条数据</span><br><span class="line">新增id为<span class="number">1</span>的 对应 name为a</span><br><span class="line">新增Id为<span class="number">2</span>的 对应 name为b</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230701154217181.png" alt="image-20230701154217181"></p>
|
||
<p><strong>复杂批量操作</strong></p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line">POST /_bulk</span><br><span class="line"><span class="punctuation">{</span><span class="attr">"delete"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_index"</span><span class="punctuation">:</span><span class="string">"website"</span><span class="punctuation">,</span><span class="attr">"_type"</span><span class="punctuation">:</span><span class="string">"blog"</span><span class="punctuation">,</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"123"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"create"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_index"</span><span class="punctuation">:</span><span class="string">"website"</span><span class="punctuation">,</span><span class="attr">"_type"</span><span class="punctuation">:</span><span class="string">"blog"</span><span class="punctuation">,</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"123"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"title"</span><span class="punctuation">:</span><span class="string">"my first blog post"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_index"</span><span class="punctuation">:</span><span class="string">"website"</span><span class="punctuation">,</span><span class="attr">"_type"</span><span class="punctuation">:</span><span class="string">"blog"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"title"</span><span class="punctuation">:</span><span class="string">"my second blog post"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"update"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_index"</span><span class="punctuation">:</span><span class="string">"website"</span><span class="punctuation">,</span><span class="attr">"_type"</span><span class="punctuation">:</span><span class="string">"blog"</span><span class="punctuation">,</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"123"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"doc"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"title"</span><span class="punctuation">:</span><span class="string">"my updated blog post"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230701154839574.png" alt="image-20230701154839574"></p>
|
||
<h2 id="7-样本测试数据"><a href="#7-样本测试数据" class="headerlink" title="7.样本测试数据"></a>7.样本测试数据</h2><figure class="highlight json"><table><tr><td class="code"><pre><span class="line">POST /bank/account/_bulk</span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"1"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">1</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39225</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Amber"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Duke"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"880 Holmes Lane"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pyrami"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"amberduke@pyrami.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brogan"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"6"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">6</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">5686</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hattie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bond"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"671 Bristol Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Netagy"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hattiebond@netagy.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dante"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"13"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">13</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">32838</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Nanette"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bates"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"789 Madison Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quility"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"nanettebates@quility.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Nogal"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"18"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">18</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4180</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dale"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Adams"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"467 Hutchinson Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Boink"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"daleadams@boink.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Orick"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"20"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16418</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Elinor"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ratliff"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"282 Kings Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Scentric"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"elinorratliff@scentric.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ribera"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"25"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40540</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Virginia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ayala"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"171 Putnam Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Filodyne"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"virginiaayala@filodyne.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Nicholson"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"32"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48086</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dillard"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcpherson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"702 Quentin Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quailcom"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"dillardmcpherson@quailcom.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Veguita"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"37"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18612</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mcgee"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mooney"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"826 Fillmore Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Reversus"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mcgeemooney@reversus.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tooleville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"44"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">44</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34487</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Aurelia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Harding"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"502 Baycliff Terrace"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Orbalix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"aureliaharding@orbalix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Yardville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"49"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">49</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29104</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Fulton"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Holt"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"451 Humboldt Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Anocha"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"fultonholt@anocha.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sunriver"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"51"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">51</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14097</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Burton"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Meyers"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"334 River Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bezal"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"burtonmeyers@bezal.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Jacksonburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"56"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">56</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14992</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Josie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Nelson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"857 Tabor Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Emtrac"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"josienelson@emtrac.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sunnyside"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"63"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">63</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6077</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hughes"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Owens"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"510 Sedgwick Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Valpreal"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hughesowens@valpreal.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Guilford"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"68"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">68</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44214</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hall"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Key"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"927 Bay Parkway"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Eventex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hallkey@eventex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Shawmut"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"70"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">70</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38172</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Deidre"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Thompson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"685 School Lane"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Netplode"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"deidrethompson@netplode.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chestnut"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"75"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">75</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40500</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sandoval"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Kramer"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"166 Irvington Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Overfork"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sandovalkramer@overfork.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Limestone"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"82"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">82</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41412</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Concetta"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Barnes"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"195 Bayview Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Fitcore"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"concettabarnes@fitcore.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Summerfield"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"87"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">87</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1133</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hewitt"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Kidd"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"446 Halleck Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isologics"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hewittkidd@isologics.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Coalmont"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"94"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">94</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41060</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Brittany"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cabrera"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"183 Kathleen Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Mixers"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"brittanycabrera@mixers.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cornucopia"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AZ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"99"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">99</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">47159</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ratliff"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Heath"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"806 Rockwell Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zappix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ratliffheath@zappix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Shaft"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"102"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">102</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29712</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dena"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Olson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"759 Newkirk Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Hinway"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"denaolson@hinway.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Choctaw"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"107"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">107</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48844</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Randi"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rich"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"694 Jefferson Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Netplax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"randirich@netplax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bellfountain"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"114"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">114</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43045</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Josephine"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Joseph"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"451 Oriental Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Turnabout"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"josephinejoseph@turnabout.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sedley"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"119"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">119</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49222</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Laverne"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Johnson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"302 Howard Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Senmei"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lavernejohnson@senmei.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Herlong"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"121"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">121</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19594</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Acevedo"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dorsey"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"479 Nova Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Netropic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"acevedodorsey@netropic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Islandia"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"126"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">126</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3607</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Effie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gates"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"620 National Drive"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Digitalus"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"effiegates@digitalus.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Blodgett"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"133"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">133</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26135</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Deena"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Richmond"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"646 Underhill Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Sunclipse"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"deenarichmond@sunclipse.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Austinburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"138"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">138</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">9006</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Daniel"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Arnold"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"422 Malbone Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ecstasia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"danielarnold@ecstasia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gardiner"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"140"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">140</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26696</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cotton"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Christensen"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"878 Schermerhorn Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Prowaste"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cottonchristensen@prowaste.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Mayfair"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"145"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">145</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">47406</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rowena"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wilkinson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"891 Elton Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Asimiline"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rowenawilkinson@asimiline.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ripley"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"152"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">152</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8088</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Wolfe"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rocha"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"457 Guernsey Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Hivedom"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wolferocha@hivedom.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Adelino"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"157"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">157</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39868</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Claudia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Terry"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"132 Gunnison Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Lumbrex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"claudiaterry@lumbrex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Castleton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"164"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">164</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">9101</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cummings"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Little"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"308 Schaefer Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comtrak"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cummingslittle@comtrak.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chaparrito"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"169"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">169</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">45953</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hollie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Osborn"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"671 Seaview Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Musaphics"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hollieosborn@musaphics.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hanover"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"171"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">171</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">7091</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Nelda"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hopper"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"742 Prospect Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Equicom"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"neldahopper@equicom.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Finderne"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"176"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">176</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18607</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kemp"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Walters"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"906 Howard Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Eyewax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kempwalters@eyewax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Why"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"183"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">183</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14223</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hudson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"English"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"823 Herkimer Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xinware"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hudsonenglish@xinware.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Robbins"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"188"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">188</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41504</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Miranda"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"583 Ainslie Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Jasper"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"tiamiranda@jasper.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Summerset"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"190"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">190</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3150</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Blake"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Davidson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"636 Diamond Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quantasis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"blakedavidson@quantasis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Crumpler"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"195"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">195</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">5025</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kaye"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gibson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"955 Hopkins Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zork"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kayegibson@zork.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ola"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"203"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">203</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21890</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Eve"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wyatt"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"435 Furman Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Assitia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"evewyatt@assitia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Jamestown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"208"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">208</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40760</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Garcia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hess"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"810 Nostrand Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quiltigen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"garciahess@quiltigen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brooktrails"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"210"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">210</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33946</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cherry"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Carey"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"539 Tiffany Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Martgo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cherrycarey@martgo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fairacres"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"215"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">215</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">37427</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Copeland"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Solomon"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"741 McDonald Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Recognia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"copelandsolomon@recognia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Edmund"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"222"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">222</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14764</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rachelle"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rice"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"333 Narrows Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Enaut"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rachellerice@enaut.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wright"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AZ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"227"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">227</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19780</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Coleman"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Berg"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"776 Little Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Exoteric"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"colemanberg@exoteric.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Eagleville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"234"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">234</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44207</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Betty"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hall"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"709 Garfield Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Miraclis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bettyhall@miraclis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bendon"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"239"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">239</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">25719</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Chang"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Boyer"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"895 Brigham Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Qaboos"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"changboyer@qaboos.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Belgreen"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"241"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">241</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">25379</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Schroeder"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Harrington"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"610 Tapscott Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Otherway"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"schroederharrington@otherway.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ebro"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"246"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">246</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28405</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Katheryn"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Foster"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"259 Kane Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quantalia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"katherynfoster@quantalia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bath"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"253"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">253</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20240</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Melissa"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gould"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"440 Fuller Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Buzzopia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"melissagould@buzzopia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lumberton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"258"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">258</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">5712</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lindsey"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hawkins"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"706 Frost Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Enormo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lindseyhawkins@enormo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gardners"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"260"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">260</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">2726</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kari"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Skinner"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"735 Losee Terrace"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Singavera"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kariskinner@singavera.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rushford"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"265"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">265</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46910</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Marion"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Schneider"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"574 Everett Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Evidends"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"marionschneider@evidends.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Maplewood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"272"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">272</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19253</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lilly"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Morgan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"689 Fleet Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Biolive"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lillymorgan@biolive.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sunbury"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"277"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">277</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29564</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Romero"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lott"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"456 Danforth Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Plasto"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"romerolott@plasto.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Vincent"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"284"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">284</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22806</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Randolph"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Banks"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"875 Hamilton Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Caxt"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"randolphbanks@caxt.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Crawfordsville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"289"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">289</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">7798</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Blair"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Church"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"370 Sutton Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cubix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"blairchurch@cubix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Nile"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"291"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">291</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19955</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lynn"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Pollard"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"685 Pierrepont Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Slambda"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lynnpollard@slambda.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Mappsville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"296"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">296</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">24606</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rosa"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Oliver"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"168 Woodbine Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Idetica"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rosaoliver@idetica.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Robinson"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"304"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">304</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28647</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Palmer"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Clark"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"866 Boulevard Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Maximind"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"palmerclark@maximind.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Avalon"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"309"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">309</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3830</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rosemarie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Nieves"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"206 Alice Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zounds"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rosemarienieves@zounds.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ferney"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"311"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">311</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13388</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Vinson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ballard"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"960 Glendale Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Gynk"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"vinsonballard@gynk.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fairforest"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"316"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">316</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8214</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Anita"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ewing"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"396 Lombardy Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Panzent"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"anitaewing@panzent.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Neahkahnie"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"323"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">323</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42230</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Chelsea"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gamble"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"356 Dare Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isosphere"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"chelseagamble@isosphere.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dundee"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"328"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">328</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12523</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Good"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Campbell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"438 Hicks Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Gracker"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"goodcampbell@gracker.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Marion"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"330"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">330</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41620</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Yvette"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Browning"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"431 Beekman Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Marketoid"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"yvettebrowning@marketoid.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Talpa"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"335"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">335</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35433</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Vera"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hansen"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"252 Bushwick Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zanilla"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"verahansen@zanilla.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Manila"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"342"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">342</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33670</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Vivian"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wells"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"570 Cobek Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Nutralab"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"vivianwells@nutralab.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fontanelle"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"347"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">347</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36038</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gould"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Carson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"784 Pulaski Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Mobildata"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gouldcarson@mobildata.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Goochland"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"354"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">354</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21294</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kidd"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mclean"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"691 Saratoga Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ronbert"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kiddmclean@ronbert.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tioga"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"359"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">359</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29927</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Vanessa"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Harvey"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"679 Rutledge Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zentime"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"vanessaharvey@zentime.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Williston"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"361"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">361</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23659</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Noreen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Shelton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"702 Tillary Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Medmex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"noreenshelton@medmex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Derwood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"366"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">366</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42368</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lydia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cooke"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"470 Coleman Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comstar"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lydiacooke@comstar.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Datil"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"373"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">373</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">9671</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Simpson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Carpenter"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"837 Horace Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Snips"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"simpsoncarpenter@snips.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tolu"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"378"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">378</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27100</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Watson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Simpson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"644 Thomas Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Wrapture"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"watsonsimpson@wrapture.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Keller"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"380"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">380</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35628</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Fernandez"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Reid"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"154 Melba Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cosmosis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"fernandezreid@cosmosis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Boyd"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"385"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">385</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11022</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rosalinda"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Valencia"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"933 Lloyd Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zoarere"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rosalindavalencia@zoarere.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Waverly"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"392"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">392</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31613</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dotson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dean"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"136 Ford Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Petigems"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"dotsondean@petigems.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chical"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"397"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">397</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">37418</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Leonard"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gray"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"840 Morgan Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Recritube"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"leonardgray@recritube.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Edenburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"400"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">400</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20685</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kane"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"King"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"405 Cornelia Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Tri@Tribalog"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kaneking@tri@tribalog.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gulf"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"405"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">405</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">5679</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Strickland"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Fuller"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"990 Concord Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Digique"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"stricklandfuller@digique.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Southmont"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"412"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">412</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27436</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ilene"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Abbott"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"846 Vine Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Typhonica"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ileneabbott@typhonica.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cedarville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"417"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">417</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1788</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Wheeler"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ayers"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"677 Hope Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Fortean"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wheelerayers@fortean.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ironton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"424"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">424</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36818</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tracie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gregory"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"112 Hunterfly Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comstruct"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"traciegregory@comstruct.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Onton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"429"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">429</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46970</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cantu"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lindsey"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"404 Willoughby Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Inquala"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cantulindsey@inquala.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cowiche"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"431"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">431</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13136</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Laurie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Shaw"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"263 Aviation Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zillanet"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"laurieshaw@zillanet.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Harmon"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"436"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">436</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27585</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alexander"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sargent"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"363 Albemarle Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Fangold"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"alexandersargent@fangold.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Calpine"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"443"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">443</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">7588</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Huff"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Thomas"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"538 Erskine Loop"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Accufarm"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"huffthomas@accufarm.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Corinne"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"448"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">448</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22776</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Adriana"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcfadden"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"984 Woodside Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Telequiet"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"adrianamcfadden@telequiet.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Darrtown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"450"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">450</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">2643</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bradford"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Nielsen"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"487 Keen Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Exovent"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bradfordnielsen@exovent.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hamilton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"455"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">455</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39556</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lynn"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Tran"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"741 Richmond Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Optyk"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lynntran@optyk.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Clinton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"462"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">462</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10871</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Calderon"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Day"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"810 Milford Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cofine"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"calderonday@cofine.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kula"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"467"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">467</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6312</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Angelica"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"May"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"384 Karweg Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Keeg"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"angelicamay@keeg.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tetherow"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"474"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">474</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35896</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Obrien"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Walton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"192 Ide Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Suremax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"obrienwalton@suremax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Crucible"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"479"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">479</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31865</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cameron"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ross"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"904 Bouck Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Telpod"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cameronross@telpod.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Nord"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"481"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">481</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20024</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lina"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Stanley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"361 Hanover Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Strozen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"linastanley@strozen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wyoming"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"486"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">486</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35902</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dixie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Fuentes"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"991 Applegate Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Portico"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"dixiefuentes@portico.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Salix"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"493"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">493</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">5871</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Campbell"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Best"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"297 Friel Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Fanfare"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"campbellbest@fanfare.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kidder"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"498"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">498</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10516</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Stella"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hinton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"649 Columbia Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Flyboyz"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"stellahinton@flyboyz.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Crenshaw"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"501"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">501</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16572</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kelley"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ochoa"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"451 Clifton Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bluplanet"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kelleyochoa@bluplanet.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gouglersville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"506"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">506</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43440</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Davidson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Salas"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"731 Cleveland Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Sequitur"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"davidsonsalas@sequitur.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lloyd"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"513"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">513</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">30040</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Maryellen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rose"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"428 Durland Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Waterbaby"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"maryellenrose@waterbaby.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kiskimere"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"518"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">518</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48954</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Finch"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Curtis"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"137 Ryder Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Viagrand"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"finchcurtis@viagrand.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Riverton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"520"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">520</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27987</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Brandy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Calhoun"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"818 Harden Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Maxemia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"brandycalhoun@maxemia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sidman"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"525"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">525</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23545</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Holly"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Miles"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"746 Ludlam Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xurban"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hollymiles@xurban.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Harold"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"532"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">532</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">17207</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hardin"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Kirk"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"268 Canarsie Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Exposa"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hardinkirk@exposa.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Stouchsburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"537"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">537</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31069</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Morin"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Frost"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"910 Lake Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Primordia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"morinfrost@primordia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rivera"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"544"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">544</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41735</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Short"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dennis"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"908 Glen Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Minga"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"shortdennis@minga.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"549"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">549</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1932</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jacqueline"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Maxwell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"444 Schenck Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Fuelworks"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jacquelinemaxwell@fuelworks.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Oretta"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"551"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">551</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21732</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Milagros"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Travis"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"380 Murdock Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Sloganaut"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"milagrostravis@sloganaut.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Homeland"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"556"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">556</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36420</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Collier"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Odonnell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"591 Nolans Lane"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Sultraxin"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"collierodonnell@sultraxin.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fulford"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"563"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">563</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43403</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Morgan"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Torres"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"672 Belvidere Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quonata"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"morgantorres@quonata.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hollymead"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"568"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">568</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36628</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lesa"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Maynard"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"295 Whitty Lane"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Coash"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lesamaynard@coash.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Broadlands"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"570"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">570</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26751</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Church"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mercado"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"892 Wyckoff Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xymonk"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"churchmercado@xymonk.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gloucester"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"575"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">575</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12588</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Buchanan"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Pope"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"581 Sumner Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Stucco"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"buchananpope@stucco.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ellerslie"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"582"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">582</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33371</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Manning"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Guthrie"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"271 Jodie Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xerex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"manningguthrie@xerex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Breinigsville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NM"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"587"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">587</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3468</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Carly"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Johns"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"390 Noll Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Gallaxia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"carlyjohns@gallaxia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Emison"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"594"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">594</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28194</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Golden"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Donovan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"199 Jewel Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Organica"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"goldendonovan@organica.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Macdona"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"599"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">599</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11944</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Joanna"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Jennings"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"318 Irving Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Extremo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"joannajennings@extremo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bartley"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"602"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">602</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38699</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mcgowan"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcclain"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"361 Stoddard Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Oatfarm"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mcgowanmcclain@oatfarm.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kapowsin"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"607"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">607</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38350</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"White"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Small"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"736 Judge Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Immunics"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"whitesmall@immunics.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fairfield"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"614"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">614</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13157</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Salazar"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Howard"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"847 Imlay Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Retrack"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"salazarhoward@retrack.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Grill"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"619"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">619</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48755</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Grimes"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Reynolds"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"378 Denton Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Frenex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"grimesreynolds@frenex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Murillo"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"621"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">621</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35480</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Leslie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sloan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"336 Kansas Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Dancity"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lesliesloan@dancity.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Corriganville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"626"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">626</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19498</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ava"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Richardson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"666 Nautilus Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cinaster"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"avarichardson@cinaster.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sutton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"633"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">633</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35874</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Conner"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ramos"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"575 Agate Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Insource"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"connerramos@insource.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Madaket"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"638"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">638</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">2658</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bridget"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gallegos"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"383 Wogan Terrace"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Songlines"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bridgetgallegos@songlines.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Linganore"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"640"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">640</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35596</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Candace"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hancock"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"574 Riverdale Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Animalia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"candacehancock@animalia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Blandburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"645"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">645</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29362</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Edwina"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hutchinson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"892 Pacific Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Essensia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"edwinahutchinson@essensia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dowling"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"652"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">652</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">17363</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bonner"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Garner"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"219 Grafton Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Utarian"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bonnergarner@utarian.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Vandiver"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"657"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">657</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40475</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kathleen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wilder"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"286 Sutter Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Solgan"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kathleenwilder@solgan.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Graniteville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"664"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">664</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16163</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hart"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mccormick"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"144 Guider Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Dyno"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hartmccormick@dyno.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Carbonville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"669"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">669</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16934</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jewel"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Estrada"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"896 Meeker Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zilla"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jewelestrada@zilla.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Goodville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"671"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">671</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29029</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Antoinette"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cook"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"375 Cumberland Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Harmoney"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"antoinettecook@harmoney.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bergoo"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"676"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">676</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23842</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lisa"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dudley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"506 Vanderveer Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Tropoli"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lisadudley@tropoli.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Konterra"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"683"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">683</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4381</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Matilda"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Berger"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"884 Noble Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Fibrodyne"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"matildaberger@fibrodyne.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Shepardsville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"688"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">688</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">17931</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Freeman"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Zamora"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"114 Herzl Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Elemantra"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"freemanzamora@elemantra.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Libertytown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NM"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"690"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">690</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18127</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Russo"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Swanson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"256 Roebling Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zaj"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"russoswanson@zaj.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hoagland"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"695"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">695</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36800</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gonzales"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcfarland"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"647 Louisa Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Songbird"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gonzalesmcfarland@songbird.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Crisman"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"703"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">703</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27443</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dona"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Burton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"489 Flatlands Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cytrex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"donaburton@cytrex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Reno"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"708"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">708</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34002</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"May"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ortiz"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"244 Chauncey Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Syntac"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mayortiz@syntac.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Munjor"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"710"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">710</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33650</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Shelton"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Stark"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"404 Ovington Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kraggle"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sheltonstark@kraggle.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ogema"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"715"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">715</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23734</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tammi"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hodge"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"865 Church Lane"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Netur"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"tammihodge@netur.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lacomb"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"722"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">722</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27256</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Roberts"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Beasley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"305 Kings Hwy"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quintity"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"robertsbeasley@quintity.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hayden"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"727"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">727</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27263</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Natasha"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Knapp"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"723 Hubbard Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Exostream"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"natashaknapp@exostream.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Trexlertown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"734"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">734</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20325</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Keri"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Kinney"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"490 Balfour Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Retrotex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kerikinney@retrotex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Salunga"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"739"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">739</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39063</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gwen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hardy"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"733 Stuart Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Exozent"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gwenhardy@exozent.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Drytown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"741"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">741</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33074</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Nielsen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Good"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"404 Norfolk Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kiggle"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"nielsengood@kiggle.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cumberland"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"746"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">746</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15970</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Marguerite"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wall"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"364 Crosby Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Aquoavo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"margueritewall@aquoavo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Jeff"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"753"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">753</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33340</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Katina"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Alford"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"690 Ross Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Intrawear"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"katinaalford@intrawear.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Grimsley"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"758"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">758</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15739</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Berta"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Short"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"149 Surf Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ozean"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bertashort@ozean.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Odessa"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"760"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">760</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40996</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rhea"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Blair"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"440 Hubbard Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bicol"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rheablair@bicol.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Stockwell"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"765"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">765</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31278</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Knowles"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cunningham"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"753 Macdougal Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Thredz"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"knowlescunningham@thredz.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Thomasville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"772"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">772</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">37849</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Eloise"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sparks"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"608 Willow Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Satiance"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"eloisesparks@satiance.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Richford"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"777"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">777</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48294</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Adkins"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mejia"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"186 Oxford Walk"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Datagen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"adkinsmejia@datagen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Faywood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"784"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">784</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">25291</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mabel"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Thornton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"124 Louisiana Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zolavo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mabelthornton@zolavo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lynn"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"789"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">789</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8760</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cunningham"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Kerr"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"154 Sharon Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Polarium"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cunninghamkerr@polarium.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tuskahoma"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"791"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">791</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48249</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Janine"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Huber"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"348 Porter Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Viocular"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"janinehuber@viocular.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fivepointville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"796"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">796</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23503</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mona"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Craft"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"511 Henry Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Opticom"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"monacraft@opticom.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Websterville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"804"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">804</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23610</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rojas"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Oneal"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"669 Sandford Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Glukgluk"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rojasoneal@glukgluk.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wheaton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"809"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">809</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">47812</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Christie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Strickland"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"346 Bancroft Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Anarco"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"christiestrickland@anarco.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Baden"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"811"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">811</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26007</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Walls"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rogers"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"352 Freeman Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geekmosis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wallsrogers@geekmosis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Caroleen"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"816"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">816</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">9567</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cornelia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lane"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"384 Bainbridge Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Sulfax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cornelialane@sulfax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Elizaville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"823"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">823</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48726</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Celia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bernard"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"466 Amboy Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Mitroc"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"celiabernard@mitroc.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Skyland"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"828"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">828</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44890</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Blanche"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Holmes"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"605 Stryker Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Motovate"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"blancheholmes@motovate.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Loomis"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"830"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">830</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">45210</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Louella"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Chan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"511 Heath Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Conferia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"louellachan@conferia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brookfield"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"835"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">835</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46558</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Glover"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rutledge"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"641 Royce Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ginkogene"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gloverrutledge@ginkogene.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dixonville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"842"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">842</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49587</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Meagan"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Buckner"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"833 Bushwick Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Biospan"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"meaganbuckner@biospan.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Craig"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"847"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">847</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8652</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Antonia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Duncan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"644 Stryker Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Talae"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"antoniaduncan@talae.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dawn"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"854"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">854</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49795</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jimenez"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Barry"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"603 Cooper Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Verton"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jimenezbarry@verton.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Moscow"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"859"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">859</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20734</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Beulah"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Stuart"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"651 Albemarle Terrace"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Hatology"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"beulahstuart@hatology.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Waiohinu"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"861"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">861</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44173</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jaime"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wilson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"680 Richardson Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Temorak"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jaimewilson@temorak.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fidelis"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"866"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">866</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">45565</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Araceli"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Woodward"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"326 Meadow Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Olympix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"araceliwoodward@olympix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dana"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"873"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">873</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43931</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tisha"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cotton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"432 Lincoln Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Buzzmaker"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"tishacotton@buzzmaker.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bluetown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"878"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">878</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49159</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Battle"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Blackburn"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"234 Hendrix Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zilphur"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"battleblackburn@zilphur.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wanamie"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"880"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">880</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22575</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Christian"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Myers"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"737 Crown Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Combogen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"christianmyers@combogen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Abrams"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"885"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">885</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31661</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Valdez"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Roberson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"227 Scholes Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Delphide"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"valdezroberson@delphide.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chilton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"892"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">892</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44974</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hill"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hayes"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"721 Dooley Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Fuelton"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hillhayes@fuelton.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Orason"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"897"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">897</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">45973</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alyson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Irwin"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"731 Poplar Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quizka"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"alysonirwin@quizka.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Singer"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"900"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">900</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6124</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gonzalez"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Watson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"624 Sullivan Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Marvane"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gonzalezwatson@marvane.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wikieup"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"905"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">905</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29438</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Schultz"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Moreno"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"761 Cedar Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Paragonia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"schultzmoreno@paragonia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Glenshaw"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"912"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">912</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13675</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Flora"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Alvarado"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"771 Vandervoort Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Boilicon"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"floraalvarado@boilicon.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Vivian"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"917"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">917</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">47782</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Parks"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hurst"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"933 Cozine Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pyramis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"parkshurst@pyramis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lindcove"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"924"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">924</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3811</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hilary"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Leonard"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"235 Hegeman Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Metroz"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hilaryleonard@metroz.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Roosevelt"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"929"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">929</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34708</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Willie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hickman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"430 Devoe Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Apextri"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"williehickman@apextri.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Clay"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"931"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">931</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8244</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ingrid"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Garcia"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"674 Indiana Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Balooba"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ingridgarcia@balooba.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Interlochen"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AZ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"936"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">936</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22430</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Beth"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Frye"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"462 Thatford Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Puria"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bethfrye@puria.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hiseville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"943"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">943</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">24187</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Wagner"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Griffin"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"489 Ellery Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Gazak"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wagnergriffin@gazak.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lorraine"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"948"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">948</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">37074</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sargent"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Powers"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"532 Fiske Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Accuprint"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sargentpowers@accuprint.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Umapine"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"950"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">950</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">30916</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sherrie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Patel"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"658 Langham Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Futurize"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sherriepatel@futurize.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Garfield"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"955"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">955</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41621</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Klein"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Kemp"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"370 Vanderbilt Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Synkgen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kleinkemp@synkgen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bonanza"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"962"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">962</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">32096</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Trujillo"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wilcox"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"914 Duffield Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Extragene"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"trujillowilcox@extragene.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Golconda"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"967"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">967</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19161</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Carrie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Huffman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"240 Sands Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Injoy"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"carriehuffman@injoy.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Leroy"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"974"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">974</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38082</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Deborah"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Yang"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"463 Goodwin Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Entogrok"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"deborahyang@entogrok.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Herald"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"979"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">979</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43130</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Vaughn"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Pittman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"446 Tompkins Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Phormula"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"vaughnpittman@phormula.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fingerville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"981"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">981</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20278</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Nolan"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Warner"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"753 Channel Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Interodeo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"nolanwarner@interodeo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Layhill"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"986"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">986</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35086</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Norris"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hubbard"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"600 Celeste Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Printspan"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"norrishubbard@printspan.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cassel"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"993"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">993</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26487</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Campos"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Olsen"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"873 Covert Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isbol"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"camposolsen@isbol.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Glendale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"998"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">998</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16869</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Letha"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Baker"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"206 Llama Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Dognosis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lethabaker@dognosis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dunlo"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"2"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">2</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28838</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Roberta"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bender"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"560 Kingsway Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Chillium"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"robertabender@chillium.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bennett"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"7"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">7</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39121</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Levy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Richard"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"820 Logan Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Teraprene"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"levyrichard@teraprene.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Shrewsbury"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"14"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">14</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20480</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Erma"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Kane"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"661 Vista Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Stockpost"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ermakane@stockpost.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chamizal"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"19"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">19</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27894</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Schwartz"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Buchanan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"449 Mersereau Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Sybixtex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"schwartzbuchanan@sybixtex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Greenwich"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"21"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">7004</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Estella"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Paul"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"859 Portal Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zillatide"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"estellapaul@zillatide.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Churchill"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"26"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14127</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lorraine"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mccullough"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"157 Dupont Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zosis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lorrainemccullough@zosis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dennard"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"33"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35439</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Savannah"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Kirby"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"372 Malta Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Musanpoly"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"savannahkirby@musanpoly.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Muse"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"38"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10511</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Erna"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Fields"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"357 Maple Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Eweville"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ernafields@eweville.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Twilight"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"40"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33882</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Pace"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Molina"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"263 Ovington Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cytrak"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pacemolina@cytrak.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Silkworth"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"45"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">45</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44478</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Geneva"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Morin"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"357 Herkimer Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ezent"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"genevamorin@ezent.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Blanco"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AZ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"52"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">52</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46425</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kayla"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bradshaw"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"449 Barlow Drive"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Magnemo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kaylabradshaw@magnemo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wawona"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AZ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"57"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">57</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8705</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Powell"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Herring"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"263 Merit Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Digiprint"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"powellherring@digiprint.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Coral"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"64"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">64</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44036</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Miles"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Battle"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"988 Homecrest Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Koffee"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"milesbattle@koffee.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Motley"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"69"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">69</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14253</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Desiree"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Harrison"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"694 Garland Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Barkarama"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"desireeharrison@barkarama.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hackneyville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"71"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">71</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38201</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sharpe"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hoffman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"450 Conklin Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Centree"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sharpehoffman@centree.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Urbana"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"76"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">76</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38345</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Claudette"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Beard"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"748 Dorset Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Repetwire"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"claudettebeard@repetwire.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Caln"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"83"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">83</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35928</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mayo"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cleveland"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"720 Brooklyn Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Indexia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mayocleveland@indexia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Roberts"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"88"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">88</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26418</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Adela"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Tyler"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"737 Clove Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Surelogic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"adelatyler@surelogic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Boling"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"90"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">90</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">25332</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Herman"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Snyder"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"737 College Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Lunchpod"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hermansnyder@lunchpod.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Flintville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"95"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">95</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1650</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dominguez"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Le"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"539 Grace Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Portica"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"dominguezle@portica.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wollochet"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"103"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">103</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11253</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Calhoun"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bruce"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"731 Clarkson Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Automon"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"calhounbruce@automon.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Marienthal"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"108"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">108</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19015</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Christensen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Weaver"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"398 Dearborn Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quilk"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"christensenweaver@quilk.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Belvoir"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"110"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">110</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4850</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Daphne"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Byrd"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"239 Conover Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Freakin"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"daphnebyrd@freakin.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Taft"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"115"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">115</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18750</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Nikki"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Doyle"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"537 Clara Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Fossiel"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"nikkidoyle@fossiel.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Caron"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"122"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">122</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">17128</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Aurora"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Fry"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"227 Knapp Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Makingway"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"aurorafry@makingway.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Maybell"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"127"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">127</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48734</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Diann"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mclaughlin"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"340 Clermont Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Enomen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"diannmclaughlin@enomen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rutherford"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"134"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">134</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33829</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Madelyn"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Norris"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"176 Noel Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Endicil"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"madelynnorris@endicil.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Walker"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"139"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">139</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18444</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rios"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Todd"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"281 Georgia Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Uberlux"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"riostodd@uberlux.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hannasville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"141"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">141</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20790</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Liliana"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Caldwell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"414 Huron Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Rubadub"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lilianacaldwell@rubadub.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hiwasse"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"146"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">146</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39078</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lang"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Kaufman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"626 Beverley Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Rodeomad"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"langkaufman@rodeomad.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Mahtowa"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"153"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">153</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">32074</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bird"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cochran"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"691 Bokee Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Supremia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"birdcochran@supremia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Barrelville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"158"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">158</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">9380</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Natalie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcdowell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"953 Roder Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Myopium"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"nataliemcdowell@myopium.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Savage"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"160"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">160</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48974</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hull"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cherry"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"275 Beaumont Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Noralex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hullcherry@noralex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Whipholt"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"165"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">165</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18956</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sims"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mckay"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"205 Jackson Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comtour"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"simsmckay@comtour.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tilden"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"172"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">172</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18356</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Marie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Whitehead"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"704 Monaco Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Sultrax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mariewhitehead@sultrax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dragoon"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"177"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">177</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48972</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Harris"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gross"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"468 Suydam Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kidstock"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"harrisgross@kidstock.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Yettem"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"184"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">184</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">9157</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cathy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Morrison"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"882 Pine Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zytrek"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cathymorrison@zytrek.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fedora"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"189"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">189</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20167</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ada"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cortez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"700 Forest Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Micronaut"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"adacortez@micronaut.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Eagletown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"191"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">191</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26172</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Barr"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sharpe"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"428 Auburn Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ziggles"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"barrsharpe@ziggles.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Springdale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"196"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">196</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29931</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Caldwell"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Daniel"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"405 Oliver Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Furnigeer"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"caldwelldaniel@furnigeer.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Zortman"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"204"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">204</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27714</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mavis"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Deleon"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"400 Waldane Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Lotron"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mavisdeleon@lotron.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Stollings"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"209"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">209</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31052</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Myers"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Noel"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"691 Alton Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Greeker"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"myersnoel@greeker.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hinsdale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"211"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">211</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21539</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Graciela"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Vaughan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"558 Montauk Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Fishland"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gracielavaughan@fishland.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Madrid"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"216"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">216</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11422</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Price"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Haley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"233 Portland Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zeam"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pricehaley@zeam.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Titanic"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"223"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">223</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">9528</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Newton"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Fletcher"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"654 Dewitt Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Assistia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"newtonfletcher@assistia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Nipinnawasee"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"228"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">228</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10543</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rosella"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Albert"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"185 Gotham Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isoplex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rosellaalbert@isoplex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Finzel"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"230"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">230</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10829</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Chris"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Raymond"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"464 Remsen Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cogentry"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"chrisraymond@cogentry.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bowmansville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"235"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">235</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">17729</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mcpherson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mueller"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"541 Strong Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Tingles"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mcphersonmueller@tingles.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brantleyville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"242"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">242</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42318</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Berger"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Roach"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"125 Wakeman Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ovium"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bergerroach@ovium.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hessville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"247"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">247</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">45123</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mccormick"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Moon"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"582 Brighton Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Norsup"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mccormickmoon@norsup.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Forestburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"254"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">254</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35104</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Yang"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dodson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"531 Lott Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Mondicil"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"yangdodson@mondicil.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Enoree"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"259"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">259</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41877</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Eleanor"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gonzalez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"800 Sumpter Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Futuris"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"eleanorgonzalez@futuris.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Jenkinsville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"261"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">261</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39998</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Millicent"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Pickett"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"722 Montieth Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Gushkool"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"millicentpickett@gushkool.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Norwood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"266"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">266</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">2777</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Monique"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Conner"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"489 Metrotech Courtr"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Flotonic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"moniqueconner@flotonic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Retsof"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"273"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">273</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11181</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Murphy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Chandler"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"569 Bradford Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zilch"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"murphychandler@zilch.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Vicksburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"278"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">278</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22530</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tamra"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Navarro"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"175 Woodruff Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Norsul"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"tamranavarro@norsul.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Glasgow"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"280"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">280</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3380</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Vilma"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Shields"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"133 Berriman Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Applidec"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"vilmashields@applidec.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Adamstown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"285"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">285</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">47369</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hilda"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Phillips"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"618 Nixon Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comcur"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hildaphillips@comcur.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Siglerville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"292"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">292</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26679</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Morrow"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Greene"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"691 Nassau Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Columella"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"morrowgreene@columella.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sanborn"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"297"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">297</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20508</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tucker"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Patrick"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"978 Whitwell Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Valreda"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"tuckerpatrick@valreda.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Deseret"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"300"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">300</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">25654</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lane"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Tate"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"632 Kay Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Genesynk"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lanetate@genesynk.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lowell"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"305"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">305</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11655</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Augusta"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Winters"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"377 Paerdegat Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Vendblend"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"augustawinters@vendblend.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gwynn"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"312"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">312</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8511</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Burgess"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gentry"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"382 Bergen Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Orbixtar"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"burgessgentry@orbixtar.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Conestoga"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"317"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">317</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31968</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ruiz"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Morris"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"972 Dean Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Apex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ruizmorris@apex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Jacksonwald"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"324"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">324</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44976</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gladys"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Erickson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"250 Battery Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Eternis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gladyserickson@eternis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Marne"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"329"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">329</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31138</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Nellie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mercer"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"967 Ebony Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Scenty"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"nelliemercer@scenty.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Jardine"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"331"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">331</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46004</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gibson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Potts"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"994 Dahill Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zensus"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gibsonpotts@zensus.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Frizzleburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"336"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">336</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40891</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dudley"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Avery"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"405 Powers Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Genmom"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"dudleyavery@genmom.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Clarksburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"343"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">343</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">37684</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Robbie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Logan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"488 Linden Boulevard"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Hydrocom"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"robbielogan@hydrocom.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Stockdale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"348"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">348</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1360</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Karina"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Russell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"797 Moffat Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Limozen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"karinarussell@limozen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Riegelwood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"350"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">350</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4267</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Wyatt"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wise"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"896 Bleecker Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Rockyard"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wyattwise@rockyard.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Joes"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"355"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">355</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40961</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gregory"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Delacruz"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"876 Cortelyou Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Oulu"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gregorydelacruz@oulu.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Waterloo"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"362"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">362</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14938</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jimmie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dejesus"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"351 Navy Walk"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ecolight"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jimmiedejesus@ecolight.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Berlin"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"367"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">367</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40458</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Elaine"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Workman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"188 Ridge Boulevard"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Colaire"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"elaineworkman@colaire.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Herbster"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"374"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">374</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19521</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Blanchard"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Stein"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"313 Bartlett Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cujo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"blanchardstein@cujo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cascades"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"379"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">379</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12962</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ruthie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lamb"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"796 Rockaway Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Incubus"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ruthielamb@incubus.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hickory"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"381"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">381</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40978</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sophie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mays"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"261 Varanda Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Uneeq"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sophiemays@uneeq.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cressey"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"386"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">386</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42588</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Wallace"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Barr"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"246 Beverly Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Concility"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wallacebarr@concility.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Durham"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"393"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">393</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43936</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"William"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Kelly"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"178 Lawrence Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Techtrix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"williamkelly@techtrix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Orin"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"398"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">398</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8543</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Leticia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Duran"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"305 Senator Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xleen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"leticiaduran@xleen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cavalero"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"401"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">401</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29408</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Contreras"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Randolph"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"104 Lewis Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Inrt"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"contrerasrandolph@inrt.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chesapeake"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"406"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">406</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28127</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mccarthy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dunlap"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"684 Seacoast Terrace"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Canopoly"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mccarthydunlap@canopoly.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Elliott"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"413"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">413</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15631</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Pugh"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hamilton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"124 Euclid Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Techade"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pughhamilton@techade.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Beaulieu"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"418"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">418</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10207</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Reed"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Goff"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"959 Everit Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zillan"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"reedgoff@zillan.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hiko"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"420"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">420</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44699</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Brandie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hayden"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"291 Ash Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Digifad"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"brandiehayden@digifad.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Spelter"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NM"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"425"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">425</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41308</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Queen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Leach"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"105 Fair Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Magneato"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"queenleach@magneato.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Barronett"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"432"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">432</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28969</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Preston"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ferguson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"239 Greenwood Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bitendrex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"prestonferguson@bitendrex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Idledale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"437"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">437</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41225</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rosales"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Marquez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"873 Ryerson Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ronelon"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rosalesmarquez@ronelon.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Allendale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"444"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">444</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44219</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dolly"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Finch"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"974 Interborough Parkway"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zytrac"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"dollyfinch@zytrac.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Vowinckel"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"449"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">449</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41950</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Barnett"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cantrell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"945 Bedell Lane"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zentility"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"barnettcantrell@zentility.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Swartzville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"451"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">451</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31950</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mason"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcleod"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"438 Havemeyer Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Omatom"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"masonmcleod@omatom.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ryderwood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"456"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">456</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21419</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Solis"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Kline"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"818 Ashford Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Vetron"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"soliskline@vetron.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ruffin"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"463"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">463</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36672</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Heidi"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Acosta"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"692 Kenmore Terrace"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Elpro"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"heidiacosta@elpro.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ezel"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"468"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">468</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18400</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Foreman"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Fowler"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"443 Jackson Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zillactic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"foremanfowler@zillactic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wakarusa"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"470"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">470</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20455</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Schneider"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hull"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"724 Apollo Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Exospeed"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"schneiderhull@exospeed.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Watchtower"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"475"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">475</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">24427</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Morales"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Jacobs"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"225 Desmond Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Oronoko"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"moralesjacobs@oronoko.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Clayville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"482"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">482</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14834</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Janie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bass"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"781 Grattan Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Manglo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"janiebass@manglo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kenwood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"487"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">487</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">30718</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sawyer"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Vincent"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"238 Lancaster Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Brainquil"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sawyervincent@brainquil.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Galesville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"494"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">494</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3592</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Holden"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bowen"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"374 Elmwood Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Endipine"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"holdenbowen@endipine.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rosine"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"499"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">499</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26060</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lara"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Perkins"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"703 Monroe Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Paprikut"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"laraperkins@paprikut.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Barstow"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"502"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">502</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31898</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Woodard"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bailey"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"585 Albee Square"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Imperium"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"woodardbailey@imperium.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Matheny"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"507"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">507</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27675</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Blankenship"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ramirez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"630 Graham Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bytrex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"blankenshipramirez@bytrex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bancroft"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"514"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">514</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">30125</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Solomon"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bush"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"409 Harkness Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Snacktion"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"solomonbush@snacktion.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Grayhawk"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"519"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">519</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3282</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lorna"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Franco"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"722 Schenck Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zentia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lornafranco@zentia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"National"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"521"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">521</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16348</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Josefa"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Buckley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"848 Taylor Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Mazuda"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"josefabuckley@mazuda.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Saranap"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NM"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"526"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">526</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35375</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sweeney"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Fulton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"550 Martense Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cormoran"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sweeneyfulton@cormoran.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chalfant"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"533"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">533</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13761</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Margarita"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Diaz"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"295 Tapscott Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zilodyne"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"margaritadiaz@zilodyne.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hondah"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"538"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">538</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16416</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Koch"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Barker"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"919 Gerry Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xplor"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kochbarker@xplor.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dixie"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"540"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">540</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40235</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tammy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wiggins"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"186 Schenectady Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Speedbolt"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"tammywiggins@speedbolt.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Salvo"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"545"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">545</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27011</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lena"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lucas"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"110 Lamont Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kindaloo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lenalucas@kindaloo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Harleigh"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"552"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">552</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14727</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kate"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Estes"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"785 Willmohr Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Rodeocean"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kateestes@rodeocean.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Elfrida"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"557"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">557</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3119</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Landry"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Buck"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"558 Schweikerts Walk"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Protodyne"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"landrybuck@protodyne.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Edneyville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"564"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">564</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43631</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Owens"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bowers"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"842 Congress Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Nspire"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"owensbowers@nspire.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Machias"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"569"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">569</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40019</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sherri"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rowe"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"591 Arlington Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Netility"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sherrirowe@netility.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bridgetown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"571"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">571</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3014</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ayers"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Duffy"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"721 Wortman Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Aquasseur"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ayersduffy@aquasseur.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tilleda"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"576"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">576</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29682</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Helena"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Robertson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"774 Devon Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Vicon"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"helenarobertson@vicon.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dyckesville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"583"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">583</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26558</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Castro"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"West"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"814 Williams Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cipromox"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"castrowest@cipromox.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Nescatunga"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"588"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">588</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43531</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Martina"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Collins"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"301 Anna Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geekwagon"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"martinacollins@geekwagon.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Oneida"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"590"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">590</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4652</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ladonna"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Tucker"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"162 Kane Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Infotrips"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ladonnatucker@infotrips.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Utting"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"595"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">595</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12478</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mccall"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Britt"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"823 Hill Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cablam"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mccallbritt@cablam.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Vernon"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"603"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">603</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28145</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Janette"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Guzman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"976 Kingston Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Splinx"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"janetteguzman@splinx.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Boomer"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"608"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">608</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">47091</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Carey"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Whitley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"976 Lawrence Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Poshome"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"careywhitley@poshome.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Weogufka"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"610"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">610</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40571</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Foster"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Weber"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"323 Rochester Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Firewax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"fosterweber@firewax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Winston"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"615"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">615</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28726</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Delgado"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Curry"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"706 Butler Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zoxy"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"delgadocurry@zoxy.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gracey"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"622"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">622</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">9661</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Paulette"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hartman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"375 Emerald Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Locazone"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"paulettehartman@locazone.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Canterwood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"627"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">627</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">47546</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Crawford"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sears"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"686 Eastern Parkway"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Updat"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"crawfordsears@updat.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bison"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"634"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">634</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29805</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Deloris"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Levy"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"838 Foster Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Homelux"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"delorislevy@homelux.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kempton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"639"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">639</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28875</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Caitlin"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Clements"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"627 Aster Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bunga"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"caitlinclements@bunga.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cetronia"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"641"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">641</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18345</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sheppard"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Everett"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"791 Norwood Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Roboid"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sheppardeverett@roboid.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Selma"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"646"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">646</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15559</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lavonne"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Reyes"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"983 Newport Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Parcoe"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lavonnereyes@parcoe.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Monument"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"653"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">653</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">7606</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Marcia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bennett"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"455 Bragg Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Opticall"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"marciabennett@opticall.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Magnolia"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"658"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">658</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10210</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bass"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcconnell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"274 Ocean Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Combot"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bassmcconnell@combot.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Beyerville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"660"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">660</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46427</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Moon"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wood"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"916 Amersfort Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Olucore"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"moonwood@olucore.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Como"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"665"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">665</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15215</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Britney"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Young"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"766 Sackman Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geoforma"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"britneyyoung@geoforma.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tuttle"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"672"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">672</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12621</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Camille"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Munoz"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"959 Lewis Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Vantage"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"camillemunoz@vantage.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Whitmer"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"677"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">677</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8491</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Snider"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Benton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"827 Evans Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Medicroix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sniderbenton@medicroix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kaka"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"684"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">684</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46091</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Warren"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Snow"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"756 Oakland Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bizmatic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"warrensnow@bizmatic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hatteras"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"689"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">689</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14985</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ines"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Chaney"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"137 Dikeman Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zidant"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ineschaney@zidant.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Nettie"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"691"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">691</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10792</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mclean"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Colon"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"876 Classon Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Elentrix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mcleancolon@elentrix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Unionville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"696"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">696</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">17568</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Crane"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Matthews"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"721 Gerritsen Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Intradisk"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cranematthews@intradisk.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brewster"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"704"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">704</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">45347</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Peters"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Kent"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"871 Independence Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Extragen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"peterskent@extragen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Morriston"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"709"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">709</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11015</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Abbott"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Odom"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"893 Union Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Jimbies"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"abbottodom@jimbies.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Leeper"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"711"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">711</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26939</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Villarreal"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Horton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"861 Creamer Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Lexicondo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"villarrealhorton@lexicondo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lydia"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"716"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">716</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19789</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Paul"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mason"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"618 Nichols Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Slax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"paulmason@slax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Snowville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"723"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">723</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16421</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Nixon"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Moran"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"569 Campus Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cuizine"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"nixonmoran@cuizine.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Buxton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"728"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">728</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44818</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Conley"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Preston"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"450 Coventry Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Obones"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"conleypreston@obones.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Alden"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"730"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">730</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41299</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Moore"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lee"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"797 Turner Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Orbean"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"moorelee@orbean.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Highland"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"735"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">735</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3984</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Loraine"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Willis"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"928 Grove Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Gadtron"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lorainewillis@gadtron.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lowgap"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"742"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">742</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">24765</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Merle"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wooten"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"317 Pooles Lane"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Tropolis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"merlewooten@tropolis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bentley"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"747"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">747</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16617</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Diaz"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Austin"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"676 Harway Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Irack"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"diazaustin@irack.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cliff"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"754"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">754</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10779</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jones"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Vega"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"795 India Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Gluid"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jonesvega@gluid.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tyhee"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"759"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">759</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38007</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rose"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Carlson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"987 Navy Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Aquasure"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rosecarlson@aquasure.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Carlton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"761"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">761</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">7663</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rae"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Juarez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"560 Gilmore Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Entropix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"raejuarez@entropix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Northchase"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"766"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">766</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21957</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Thomas"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gillespie"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"993 Williams Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Octocore"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"thomasgillespie@octocore.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Defiance"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"773"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">773</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31126</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Liza"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Coffey"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"540 Bulwer Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Assurity"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lizacoffey@assurity.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gilgo"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"778"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">778</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46007</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Underwood"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wheeler"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"477 Provost Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Decratex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"underwoodwheeler@decratex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sardis"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"780"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">780</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4682</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Maryanne"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hendricks"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"709 Wolcott Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Sarasonic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"maryannehendricks@sarasonic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Santel"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"785"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">785</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">25078</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Fields"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lester"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"808 Chestnut Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Visualix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"fieldslester@visualix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rowe"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"792"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">792</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13109</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Becky"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Jimenez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"539 Front Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isologia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"beckyjimenez@isologia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Summertown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"797"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">797</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6854</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lindsay"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mills"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"919 Quay Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zoinage"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lindsaymills@zoinage.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Elliston"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"800"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">800</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26217</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Candy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Oconnor"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"200 Newel Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Radiantix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"candyoconnor@radiantix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sandston"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"805"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">805</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18426</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jackson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sampson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"722 Kenmore Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Daido"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jacksonsampson@daido.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bellamy"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"812"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">812</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42593</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Graves"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Newman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"916 Joralemon Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ecrater"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gravesnewman@ecrater.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Crown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"817"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">817</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36582</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Padilla"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bauer"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"310 Cadman Plaza"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Exoblue"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"padillabauer@exoblue.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ahwahnee"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"824"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">824</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6053</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dyer"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Henson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"650 Seaview Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Nitracyr"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"dyerhenson@nitracyr.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gibsonia"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"829"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">829</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20263</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Althea"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"319 Cook Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Hyplex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"altheabell@hyplex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wadsworth"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"831"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">831</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">25375</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Wendy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Savage"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"421 Veranda Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Neurocell"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wendysavage@neurocell.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fresno"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"836"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">836</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20797</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lloyd"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lindsay"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"953 Dinsmore Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Suretech"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lloydlindsay@suretech.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Conway"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"843"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">843</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15555</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Patricia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Barton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"406 Seabring Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Providco"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"patriciabarton@providco.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Avoca"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"848"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">848</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15443</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Carmella"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cash"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"988 Exeter Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bristo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"carmellacash@bristo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Northridge"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"850"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">850</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6531</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Carlene"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gaines"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"753 Monroe Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Naxdis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"carlenegaines@naxdis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Genoa"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"855"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">855</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40170</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Stevens"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"326 Driggs Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Aeora"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"miastevens@aeora.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Delwood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"862"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">862</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38792</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Clayton"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Golden"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"620 Regent Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Accusage"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"claytongolden@accusage.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ona"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"867"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">867</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">45453</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Blanca"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ellison"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"593 McKibben Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Koogle"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"blancaellison@koogle.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Frystown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"874"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">874</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23079</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lynette"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Higgins"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"377 McKinley Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Menbrain"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lynettehiggins@menbrain.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Manitou"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"879"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">879</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48332</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sabrina"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lancaster"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"382 Oak Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Webiotic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sabrinalancaster@webiotic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lindisfarne"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AZ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"881"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">881</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26684</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Barnes"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ware"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"666 Hooper Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Norali"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"barnesware@norali.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cazadero"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"886"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">886</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14867</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Willa"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Leblanc"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"773 Bergen Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Nurali"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"willaleblanc@nurali.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hilltop"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"893"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">893</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42584</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Moses"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Campos"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"991 Bevy Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Trollery"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mosescampos@trollery.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Freetown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"898"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">898</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12019</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lori"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Stevenson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"910 Coles Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Honotron"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"loristevenson@honotron.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Shindler"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"901"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">901</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35038</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Irma"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dotson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"245 Mayfair Drive"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bleeko"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"irmadotson@bleeko.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lodoga"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"906"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">906</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">24073</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Vicki"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Suarez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"829 Roosevelt Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Utara"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"vickisuarez@utara.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Albrightsville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"913"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">913</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">47657</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Margery"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Monroe"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"941 Fanchon Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Exerta"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"margerymonroe@exerta.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bannock"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"918"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">918</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36776</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dianna"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hernandez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"499 Moultrie Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isologica"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"diannahernandez@isologica.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Falconaire"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"920"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">920</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41513</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jerri"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mitchell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"831 Kent Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Tasmania"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jerrimitchell@tasmania.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cotopaxi"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"925"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">925</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18295</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rosario"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Jackson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"178 Leonora Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Progenex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rosariojackson@progenex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rivereno"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"932"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">932</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3111</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Summer"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Porter"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"949 Grand Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Multiflex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"summerporter@multiflex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Spokane"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"937"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">937</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43491</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Selma"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Anderson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"205 Reed Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Dadabase"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"selmaanderson@dadabase.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Malo"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"944"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">944</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46478</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Donaldson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Woodard"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"498 Laurel Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zogak"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"donaldsonwoodard@zogak.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hasty"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"949"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">949</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48703</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Latasha"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mullins"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"272 Lefferts Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zenolux"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"latashamullins@zenolux.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kieler"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"951"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">951</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36337</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tran"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Burris"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"561 Rutland Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geoform"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"tranburris@geoform.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Longbranch"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"956"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">956</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19477</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Randall"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lynch"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"490 Madison Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cosmetex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"randalllynch@cosmetex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wells"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"963"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">963</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">30461</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Griffin"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sheppard"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"682 Linden Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zanymax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"griffinsheppard@zanymax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fannett"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NM"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"968"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">968</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">32371</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Luella"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Burch"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"684 Arkansas Drive"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Krag"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"luellaburch@krag.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brambleton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"970"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">970</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19648</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Forbes"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wallace"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"990 Mill Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pheast"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"forbeswallace@pheast.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lopezo"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"975"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">975</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">5239</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Delores"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Booker"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"328 Conselyea Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Centice"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"deloresbooker@centice.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Williams"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"982"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">982</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16511</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Buck"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Robinson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"301 Melrose Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Calcu"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"buckrobinson@calcu.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Welch"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"987"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">987</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4072</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Brock"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sandoval"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"977 Gem Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Fiberox"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"brocksandoval@fiberox.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Celeryville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"994"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">994</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33298</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Madge"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Holcomb"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"612 Hawthorne Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Escenta"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"madgeholcomb@escenta.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Alafaya"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"999"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">999</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6087</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dorothy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Barron"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"499 Laurel Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xurban"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"dorothybarron@xurban.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Belvoir"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"4"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">4</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27658</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rodriquez"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Flores"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"986 Wyckoff Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Tourmania"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rodriquezflores@tourmania.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Eastvale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"9"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">9</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">24776</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Opal"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Meadows"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"963 Neptune Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cedward"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"opalmeadows@cedward.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Olney"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"11"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">11</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20203</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jenkins"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Haney"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"740 Ferry Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Qimonk"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jenkinshaney@qimonk.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Steinhatchee"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"16"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">16</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35883</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Adrian"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Pitts"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"963 Fay Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Combogene"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"adrianpitts@combogene.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Remington"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"23"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42374</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kirsten"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Fox"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"330 Dumont Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Codax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kirstenfox@codax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Walton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"28"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42112</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Vega"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Flynn"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"647 Hyman Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Accupharm"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"vegaflynn@accupharm.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Masthope"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"30"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19087</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lamb"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Townsend"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"169 Lyme Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geeknet"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lambtownsend@geeknet.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Epworth"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"35"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42039</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Darla"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bridges"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"315 Central Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xeronk"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"darlabridges@xeronk.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Woodlake"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"42"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">42</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21137</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Harding"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hobbs"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"474 Ridgewood Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xth"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hardinghobbs@xth.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Heil"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"47"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">47</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33044</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Georgia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wilkerson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"369 Herbert Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Endipin"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"georgiawilkerson@endipin.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dellview"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"54"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">54</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23406</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Angel"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mann"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"229 Ferris Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Amtas"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"angelmann@amtas.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Calverton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"59"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">59</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">37728</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Malone"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Justice"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"721 Russell Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Emoltra"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"malonejustice@emoltra.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Trucksville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"61"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">61</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6856</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Shawn"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Baird"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"605 Monument Walk"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Moltonic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"shawnbaird@moltonic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Darlington"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"66"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">66</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">25939</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Franks"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Salinas"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"437 Hamilton Walk"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cowtown"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"frankssalinas@cowtown.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chase"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"73"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">73</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33457</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Irene"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Stephenson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"684 Miller Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Hawkster"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"irenestephenson@hawkster.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Levant"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"78"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">78</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48656</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Elvira"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Patterson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"834 Amber Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Assistix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"elvirapatterson@assistix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dunbar"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"80"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">80</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13445</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lacey"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Blanchard"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"823 Himrod Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comdom"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"laceyblanchard@comdom.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Matthews"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"85"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">85</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48735</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Wilcox"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sellers"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"212 Irving Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Confrenzy"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wilcoxsellers@confrenzy.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kipp"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"92"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">92</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26753</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gay"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Brewer"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"369 Ditmars Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Savvy"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gaybrewer@savvy.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Moquino"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"97"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">97</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49671</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Karen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Trujillo"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"512 Cumberland Walk"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Tsunamia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"karentrujillo@tsunamia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fredericktown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"100"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">100</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29869</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Madden"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Woods"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"696 Ryder Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Slumberia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"maddenwoods@slumberia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Deercroft"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"105"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">105</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29654</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Castillo"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dickerson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"673 Oxford Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Tellifly"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"castillodickerson@tellifly.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Succasunna"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"112"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">112</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38395</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Frederick"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Case"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"580 Lexington Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Talkalot"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"frederickcase@talkalot.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Orovada"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"117"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">117</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48831</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Robin"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hays"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"347 Hornell Loop"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pasturia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"robinhays@pasturia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sims"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"124"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">124</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16425</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Fern"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lambert"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"511 Jay Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Furnitech"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"fernlambert@furnitech.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cloverdale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"129"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">129</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42409</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alexandria"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sanford"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"934 Ridgecrest Terrace"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kyagoro"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"alexandriasanford@kyagoro.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Concho"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"131"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">131</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28030</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dollie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Koch"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"287 Manhattan Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Skinserve"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"dolliekoch@skinserve.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Shasta"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"136"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">136</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">45801</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Winnie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Holland"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"198 Mill Lane"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Neteria"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"winnieholland@neteria.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Urie"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"143"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">143</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43093</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cohen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Noble"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"454 Nelson Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Buzzworks"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cohennoble@buzzworks.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Norvelt"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"148"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">148</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3662</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Annmarie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Snider"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"857 Lafayette Walk"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Edecine"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"annmariesnider@edecine.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hollins"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"150"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">150</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15306</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ortega"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dalton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"237 Mermaid Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Rameon"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ortegadalton@rameon.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Maxville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"155"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">155</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27878</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Atkinson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hudson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"434 Colin Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Qualitern"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"atkinsonhudson@qualitern.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hoehne"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"162"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">162</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6302</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Griffith"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Calderon"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"871 Vandervoort Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quotezart"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"griffithcalderon@quotezart.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Barclay"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"167"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">167</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42051</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hampton"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ryan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"618 Fleet Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zipak"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hamptonryan@zipak.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Irwin"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"174"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">174</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1464</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gamble"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Pierce"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"650 Eagle Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Matrixity"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gamblepierce@matrixity.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Abiquiu"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"179"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">179</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13265</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Elise"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Drake"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"305 Christopher Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Turnling"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"elisedrake@turnling.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Loretto"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"181"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">181</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27983</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bennett"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hampton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"435 Billings Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Voipa"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bennetthampton@voipa.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rodman"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"186"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">186</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18373</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kline"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Joyce"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"285 Falmouth Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Tetratrex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"klinejoyce@tetratrex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Klondike"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"193"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">193</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13412</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Patty"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Petty"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"251 Vermont Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kinetica"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pattypetty@kinetica.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Grantville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"198"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">198</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19686</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rachael"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sharp"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"443 Vernon Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Powernet"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rachaelsharp@powernet.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Canoochee"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"201"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">201</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14586</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ronda"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Perry"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"856 Downing Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Artiq"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rondaperry@artiq.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Colton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"206"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">206</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">47423</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kelli"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Francis"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"671 George Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Exoswitch"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kellifrancis@exoswitch.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Babb"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"213"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">213</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34172</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bauer"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Summers"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"257 Boynton Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Voratak"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bauersummers@voratak.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Oceola"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"218"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">218</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26702</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Garrison"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bryan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"478 Greenpoint Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Uniworld"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"garrisonbryan@uniworld.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Comptche"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"220"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">220</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3086</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tania"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Middleton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"541 Gunther Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zerology"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"taniamiddleton@zerology.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Linwood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"225"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">225</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21949</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Maryann"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Murphy"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"894 Bridgewater Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cinesanct"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"maryannmurphy@cinesanct.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cartwright"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"232"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">232</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11984</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Carr"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Jensen"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"995 Micieli Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Biohab"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"carrjensen@biohab.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Waikele"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"237"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">237</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">5603</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kirby"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Watkins"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"348 Blake Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Sonique"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kirbywatkins@sonique.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Freelandville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"244"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">244</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8048</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Judith"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Riggs"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"590 Kosciusko Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Arctiq"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"judithriggs@arctiq.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gorham"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"249"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">249</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16822</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mckinney"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gallagher"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"939 Seigel Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Premiant"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mckinneygallagher@premiant.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Catharine"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"251"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">251</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13475</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Marks"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Graves"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"427 Lawn Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Dentrex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"marksgraves@dentrex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Waukeenah"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"256"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">256</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48318</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Simon"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hogan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"789 Suydam Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Dancerity"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"simonhogan@dancerity.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dargan"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"263"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">263</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12837</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Thornton"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Meyer"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"575 Elliott Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Peticular"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"thorntonmeyer@peticular.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dotsero"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"268"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">268</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20925</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Avis"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Blackwell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"569 Jerome Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Magnina"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"avisblackwell@magnina.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bethany"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"270"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">270</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43951</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Moody"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Harmon"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"233 Vanderbilt Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Otherside"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"moodyharmon@otherside.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Elwood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"275"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">275</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">2384</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Reynolds"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Barnett"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"394 Stockton Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Austex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"reynoldsbarnett@austex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Grandview"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"282"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">282</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38540</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gay"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Schultz"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"805 Claver Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Handshake"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gayschultz@handshake.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tampico"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"287"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">287</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10845</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Valerie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lang"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"423 Midwood Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quarx"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"valerielang@quarx.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cannondale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"294"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">294</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29582</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Pitts"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Haynes"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"901 Broome Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Aquazure"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pittshaynes@aquazure.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Turah"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"299"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">299</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40825</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Angela"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Talley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"822 Bills Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Remold"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"angelatalley@remold.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bethpage"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"302"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">302</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11298</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Isabella"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hewitt"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"455 Bedford Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cincyr"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"isabellahewitt@cincyr.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Blanford"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"307"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">307</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43355</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Enid"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ashley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"412 Emerson Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Avenetro"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"enidashley@avenetro.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Catherine"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"314"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">314</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">5848</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Norton"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Norton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"252 Ditmas Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Talkola"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"nortonnorton@talkola.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Veyo"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"319"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">319</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15430</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ferrell"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mckinney"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"874 Cranberry Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Portaline"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ferrellmckinney@portaline.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rose"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"321"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">321</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43370</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Marta"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Larsen"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"617 Williams Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Manufact"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"martalarsen@manufact.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sisquoc"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"326"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">326</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">9692</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Pearl"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Reese"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"451 Colonial Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Accruex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pearlreese@accruex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Westmoreland"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"333"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">333</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22778</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Trudy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sweet"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"881 Kiely Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Acumentor"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"trudysweet@acumentor.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kent"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"338"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">338</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6969</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Pierce"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lawrence"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"318 Gallatin Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Lunchpad"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"piercelawrence@lunchpad.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Iola"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"340"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">340</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42072</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Juarez"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gutierrez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"802 Seba Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Billmed"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"juarezgutierrez@billmed.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Malott"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"345"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">345</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">9812</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Parker"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hines"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"715 Mill Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Baluba"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"parkerhines@baluba.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Blackgum"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"352"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">352</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20290</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kendra"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcintosh"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"963 Wolf Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Orboid"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kendramcintosh@orboid.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bladensburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"357"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">357</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15102</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Adele"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Carroll"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"381 Arion Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Aquafire"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"adelecarroll@aquafire.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Springville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"364"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">364</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35247</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Felicia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Merrill"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"229 Branton Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Prosely"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"feliciamerrill@prosely.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dola"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"369"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">369</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">17047</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mcfadden"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Guy"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"445 Lott Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kangle"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mcfaddenguy@kangle.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Greenbackville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"371"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">371</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19751</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Barker"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Allen"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"295 Wallabout Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Nexgene"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"barkerallen@nexgene.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Nanafalia"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"376"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">376</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44407</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mcmillan"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dunn"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"771 Dorchester Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Eargo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mcmillandunn@eargo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Yogaville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"383"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">383</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48889</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Knox"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Larson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"962 Bartlett Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bostonic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"knoxlarson@bostonic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Smeltertown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"388"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">388</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">9606</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Julianne"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Nicholson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"338 Crescent Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Viasia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"juliannenicholson@viasia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Alleghenyville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"390"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">390</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">7464</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ramona"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Roy"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"135 Banner Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Deminimum"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ramonaroy@deminimum.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dodge"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"395"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">395</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18679</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Juliet"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Whitaker"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"128 Remsen Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Toyletry"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"julietwhitaker@toyletry.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Yonah"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"403"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">403</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18833</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Williamson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Horn"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"223 Strickland Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Nimon"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"williamsonhorn@nimon.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bawcomville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"408"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">408</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34666</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lidia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Guerrero"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"254 Stratford Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Snowpoke"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lidiaguerrero@snowpoke.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fairlee"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"410"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">410</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31200</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Fox"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cardenas"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"987 Monitor Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Corpulse"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"foxcardenas@corpulse.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Southview"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"415"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">415</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19449</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Martinez"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Benson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"172 Berkeley Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Enersol"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"martinezbenson@enersol.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chumuckla"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"422"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">422</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40162</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Brigitte"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Scott"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"662 Vermont Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Waretel"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"brigittescott@waretel.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Elrama"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"427"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">427</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1463</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rebekah"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Garrison"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"837 Hampton Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Niquent"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rebekahgarrison@niquent.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Zarephath"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"434"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">434</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11329</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Christa"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Huff"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"454 Oriental Boulevard"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Earthpure"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"christahuff@earthpure.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Stevens"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"439"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">439</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22752</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lula"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Williams"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"630 Furman Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Vinch"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lulawilliams@vinch.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Newcastle"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"441"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">441</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">47947</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dickson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcgee"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"478 Knight Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Gogol"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"dicksonmcgee@gogol.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Laurelton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"446"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">446</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23071</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lolita"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Fleming"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"918 Bridge Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Vidto"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lolitafleming@vidto.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brownlee"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"453"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">453</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21520</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hood"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Powell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"479 Brevoort Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Vortexaco"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hoodpowell@vortexaco.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Alderpoint"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"458"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">458</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8865</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Aida"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wolf"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"403 Thames Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"aidawolf@isis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bordelonville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"460"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">460</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">37734</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Aguirre"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"White"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"190 Crooke Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Unq"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"aguirrewhite@unq.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Albany"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"465"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">465</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10681</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Pearlie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Holman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"916 Evergreen Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Hometown"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pearlieholman@hometown.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Needmore"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"472"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">472</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">25571</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lee"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Long"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"288 Mill Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comverges"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"leelong@comverges.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Movico"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"477"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">477</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">25892</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Holcomb"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cobb"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"369 Marconi Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Steeltab"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"holcombcobb@steeltab.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Byrnedale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"484"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">484</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3274</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Staci"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Melendez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"751 Otsego Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Namebox"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"stacimelendez@namebox.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Harborton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"489"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">489</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">7879</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Garrett"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Langley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"331 Bowne Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zillidium"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"garrettlangley@zillidium.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Riviera"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"491"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">491</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42942</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Teresa"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Owen"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"713 Canton Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Plasmos"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"teresaowen@plasmos.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bartonsville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"496"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">496</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14869</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alison"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Conrad"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"347 Varet Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Perkle"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"alisonconrad@perkle.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cliffside"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"504"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">504</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49205</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Shanna"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Chambers"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"220 Beard Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Corporana"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"shannachambers@corporana.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cashtown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AZ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"509"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">509</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34754</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Durham"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Pacheco"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"129 Plymouth Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Datacator"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"durhampacheco@datacator.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Loveland"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"511"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">511</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40908</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Elba"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Grant"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"157 Bijou Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Dognost"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"elbagrant@dognost.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Coyote"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"516"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">516</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44940</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Roy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Smith"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"770 Cherry Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Parleynet"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"roysmith@parleynet.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Carrsville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"523"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">523</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28729</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Amalia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Benjamin"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"173 Bushwick Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Sentia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"amaliabenjamin@sentia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Jacumba"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"528"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">528</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4071</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Thompson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hoover"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"580 Garden Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Portalis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"thompsonhoover@portalis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Knowlton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"530"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">530</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8840</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kathrine"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Evans"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"422 Division Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Spherix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kathrineevans@spherix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Biddle"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"535"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">535</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8715</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Fry"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"George"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"722 Green Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ewaves"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"frygeorge@ewaves.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kenmar"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"542"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">542</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23285</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Michelle"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mayo"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"657 Caton Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Biflex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"michellemayo@biflex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Beaverdale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"547"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">547</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12870</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Eaton"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rios"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"744 Withers Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Podunk"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"eatonrios@podunk.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chelsea"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"554"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">554</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33163</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Townsend"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Atkins"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"566 Ira Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Acruex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"townsendatkins@acruex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Valle"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"559"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">559</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11450</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tonia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Schmidt"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"508 Sheffield Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Extro"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"toniaschmidt@extro.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Newry"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"561"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">561</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12370</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sellers"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Davis"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"860 Madoc Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isodrive"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sellersdavis@isodrive.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Trail"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"566"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">566</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6183</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cox"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Roman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"349 Winthrop Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Medcom"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"coxroman@medcom.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rosewood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"573"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">573</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">32171</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Callie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Castaneda"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"799 Scott Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Earthwax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"calliecastaneda@earthwax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Marshall"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"578"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">578</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34259</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Holmes"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcknight"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"969 Metropolitan Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cubicide"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"holmesmcknight@cubicide.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Aguila"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"580"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">580</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13716</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mcmahon"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"York"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"475 Beacon Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zillar"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mcmahonyork@zillar.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Farmington"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"585"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">585</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26745</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Nieves"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Nolan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"115 Seagate Terrace"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Jumpstack"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"nievesnolan@jumpstack.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Eastmont"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"592"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">592</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">32968</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Head"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Webster"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"987 Lefferts Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Empirica"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"headwebster@empirica.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rockingham"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"597"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">597</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11246</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Penny"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Knowles"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"139 Forbell Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ersum"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pennyknowles@ersum.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Vallonia"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"600"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">600</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10336</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Simmons"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Byers"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"250 Dictum Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Qualitex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"simmonsbyers@qualitex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wanship"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"605"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">605</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38427</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mcclain"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Manning"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"832 Leonard Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Qiao"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mcclainmanning@qiao.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Calvary"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"612"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">612</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11868</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dunn"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cameron"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"156 Lorimer Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isonus"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"dunncameron@isonus.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Virgie"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"617"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">617</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35445</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kitty"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cooley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"788 Seagate Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ultrimax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kittycooley@ultrimax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Clarktown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"624"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">624</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27538</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Roxanne"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Franklin"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"299 Woodrow Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Silodyne"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"roxannefranklin@silodyne.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Roulette"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"629"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">629</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">32987</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mcclure"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rodgers"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"806 Pierrepont Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Elita"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mcclurerodgers@elita.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brownsville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"631"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">631</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21657</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Corrine"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Barber"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"447 Hunts Lane"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quarmony"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"corrinebarber@quarmony.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wyano"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"636"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">636</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8036</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Agnes"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hooper"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"865 Hanson Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Digial"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"agneshooper@digial.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sperryville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"643"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">643</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8057</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hendricks"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Stokes"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"142 Barbey Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Remotion"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hendricksstokes@remotion.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lewis"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"648"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">648</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11506</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Terry"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Montgomery"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"115 Franklin Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Enervate"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"terrymontgomery@enervate.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bascom"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"650"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">650</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18091</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Benton"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Knight"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"850 Aitken Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pholio"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bentonknight@pholio.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cobbtown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"655"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">655</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22912</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Eula"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Taylor"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"520 Orient Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Miracula"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"eulataylor@miracula.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wacissa"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"662"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">662</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10138</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Daisy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Burnett"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"114 Norman Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Liquicom"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"daisyburnett@liquicom.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Grahamtown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"667"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">667</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22559</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Juliana"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Chase"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"496 Coleridge Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comtract"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"julianachase@comtract.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wilsonia"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"674"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">674</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36038</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Watts"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Shannon"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"600 Story Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Joviold"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wattsshannon@joviold.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fairhaven"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"679"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">679</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20149</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Henrietta"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bonner"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"461 Bond Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geekol"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"henriettabonner@geekol.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Richville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"681"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">681</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34244</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Velazquez"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wolfe"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"773 Eckford Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zisis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"velazquezwolfe@zisis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Smock"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"686"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">686</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10116</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Decker"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcclure"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"236 Commerce Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Everest"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"deckermcclure@everest.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gibbsville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"693"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">693</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31233</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tabatha"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Zimmerman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"284 Emmons Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pushcart"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"tabathazimmerman@pushcart.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Esmont"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"698"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">698</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14965</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Baker"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Armstrong"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"796 Tehama Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Nurplex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bakerarmstrong@nurplex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Starks"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"701"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">701</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23772</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gardner"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Griffith"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"187 Moore Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Vertide"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gardnergriffith@vertide.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Coventry"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"706"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">706</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">5282</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Eliza"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Potter"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"945 Dunham Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Playce"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"elizapotter@playce.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Woodruff"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"713"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">713</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20054</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Iris"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcguire"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"508 Benson Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Duflex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"irismcguire@duflex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hillsboro"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"718"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">718</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13876</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hickman"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dillard"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"132 Etna Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Genmy"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hickmandillard@genmy.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Curtice"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"720"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">720</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31356</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ruth"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Vance"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"229 Adams Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zilidium"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ruthvance@zilidium.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Allison"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"725"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">725</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14677</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Reeves"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Tillman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"674 Ivan Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cemention"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"reevestillman@cemention.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Navarre"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"732"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">732</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38445</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Delia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cruz"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"870 Cheever Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Multron"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"deliacruz@multron.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cresaptown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"737"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">737</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40431</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sampson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Yates"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"214 Cox Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Signidyne"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sampsonyates@signidyne.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brazos"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"744"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">744</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8690</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bernard"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Martinez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"148 Dunne Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Dragbot"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bernardmartinez@dragbot.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Moraida"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"749"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">749</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1249</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rush"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Boyle"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"310 Argyle Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Sportan"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rushboyle@sportan.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brady"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"751"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">751</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49252</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Patrick"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Osborne"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"915 Prospect Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Gynko"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"patrickosborne@gynko.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Takilma"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"756"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">756</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40006</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jasmine"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Howell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"605 Elliott Walk"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ecratic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jasminehowell@ecratic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Harrodsburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"763"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">763</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12091</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Liz"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bentley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"933 Debevoise Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Nipaz"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lizbentley@nipaz.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Glenville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"768"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">768</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">2213</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sondra"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Soto"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"625 Colonial Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Navir"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sondrasoto@navir.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Benson"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"770"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">770</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39505</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Joann"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Crane"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"798 Farragut Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Lingoage"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"joanncrane@lingoage.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kirk"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"775"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">775</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27943</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Wilson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Merritt"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"288 Thornton Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geeky"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wilsonmerritt@geeky.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Holtville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"782"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">782</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3960</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Maldonado"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Craig"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"345 Myrtle Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zilencio"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"maldonadocraig@zilencio.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Yukon"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"787"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">787</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11876</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Harper"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wynn"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"139 Oceanic Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Interfind"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"harperwynn@interfind.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gerber"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"794"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">794</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16491</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Walker"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Charles"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"215 Kenilworth Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Orbin"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"walkercharles@orbin.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rivers"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"799"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">799</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">2889</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Myra"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Guerra"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"625 Dahlgreen Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Digigene"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"myraguerra@digigene.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Draper"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"802"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">802</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19630</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gracie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Foreman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"219 Kent Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Supportal"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gracieforeman@supportal.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Westboro"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"807"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">807</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29206</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hatfield"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lowe"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"499 Adler Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Lovepad"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hatfieldlowe@lovepad.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wiscon"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"814"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">814</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">9838</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Morse"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcbride"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"776 Calyer Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Inear"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"morsemcbride@inear.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kingstowne"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"819"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">819</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3971</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Karyn"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Medina"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"417 Utica Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Qnekt"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"karynmedina@qnekt.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kerby"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"821"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">821</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33271</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Trisha"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Blankenship"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"329 Jamaica Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Chorizon"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"trishablankenship@chorizon.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sexton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"826"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">826</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11548</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Summers"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Vinson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"742 Irwin Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Globoil"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"summersvinson@globoil.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Callaghan"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"833"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">833</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46154</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Woodward"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hood"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"398 Atkins Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zedalis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"woodwardhood@zedalis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Stonybrook"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"838"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">838</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">24629</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Latonya"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Blake"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"531 Milton Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Rugstars"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"latonyablake@rugstars.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tedrow"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"840"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">840</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39615</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Boone"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gomez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"256 Hampton Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geekular"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"boonegomez@geekular.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Westerville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"845"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">845</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35422</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tracy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Vaughn"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"645 Rockaway Parkway"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Andryx"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"tracyvaughn@andryx.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wilmington"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"852"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">852</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6041</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Allen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hammond"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"793 Essex Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Tersanki"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"allenhammond@tersanki.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Osmond"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"857"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">857</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39678</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alyce"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Douglas"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"326 Robert Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Earbang"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"alycedouglas@earbang.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Thornport"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"864"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">864</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21804</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Duffy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Anthony"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"582 Cooke Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Schoolio"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"duffyanthony@schoolio.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brenton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"869"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">869</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43544</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Corinne"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Robbins"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"732 Quentin Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Orbaxter"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"corinnerobbins@orbaxter.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Roy"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"871"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">871</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35854</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Norma"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Burt"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"934 Cyrus Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Magnafone"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"normaburt@magnafone.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Eden"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"876"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">876</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48568</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Brady"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Glover"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"565 Oceanview Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comvex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bradyglover@comvex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Noblestown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"883"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">883</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33679</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Austin"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Jefferson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"846 Lincoln Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Polarax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"austinjefferson@polarax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Savannah"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"888"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">888</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22277</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Myrna"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Herman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"649 Harwood Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Enthaze"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"myrnaherman@enthaze.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Idamay"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"890"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">890</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31198</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alvarado"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Pate"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"269 Ashland Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ovolo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"alvaradopate@ovolo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Volta"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"895"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">895</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">7327</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lara"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcdaniel"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"854 Willow Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Acusage"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"laramcdaniel@acusage.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Imperial"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"903"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">903</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10238</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Wade"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Page"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"685 Waldorf Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Eplosion"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wadepage@eplosion.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Welda"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"908"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">908</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">45975</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mosley"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Holloway"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"929 Eldert Lane"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Anivet"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mosleyholloway@anivet.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Biehle"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"910"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">910</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36831</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Esmeralda"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"James"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"535 High Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Terrasys"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"esmeraldajames@terrasys.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dubois"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"915"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">915</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19816</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Farrell"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"French"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"126 McKibbin Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Techmania"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"farrellfrench@techmania.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wescosville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"922"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">922</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39347</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Irwin"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Pugh"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"463 Shale Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Idego"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"irwinpugh@idego.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ivanhoe"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"927"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">927</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19976</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jeanette"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Acevedo"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"694 Polhemus Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Halap"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jeanetteacevedo@halap.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Harrison"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"934"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">934</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43987</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Freida"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Daniels"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"448 Cove Lane"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Vurbo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"freidadaniels@vurbo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Snelling"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"939"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">939</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31228</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hodges"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Massey"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"431 Dahl Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kegular"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hodgesmassey@kegular.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Katonah"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"941"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">941</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38796</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kim"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Moss"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"105 Onderdonk Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Digirang"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kimmoss@digirang.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Centerville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"946"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">946</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42794</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ina"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Obrien"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"339 Rewe Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Eclipsent"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"inaobrien@eclipsent.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Soham"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"953"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">953</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1110</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Baxter"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Black"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"720 Stillwell Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Uplinx"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"baxterblack@uplinx.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Drummond"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"958"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">958</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">32849</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Brown"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wilkins"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"686 Delmonico Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Medesign"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"brownwilkins@medesign.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Shelby"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"960"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">960</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">2905</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Curry"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Vargas"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"242 Blake Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pearlesex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"curryvargas@pearlesex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Henrietta"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"965"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">965</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21882</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Patrica"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Melton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"141 Rodney Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Flexigen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"patricamelton@flexigen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Klagetoh"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"972"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">972</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">24719</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Leona"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Christian"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"900 Woodpoint Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Extrawear"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"leonachristian@extrawear.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Roderfield"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"977"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">977</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6744</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rodgers"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mccray"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"612 Duryea Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Papricut"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rodgersmccray@papricut.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Marenisco"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"984"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">984</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1904</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Viola"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Crawford"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"354 Linwood Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ginkle"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"violacrawford@ginkle.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Witmer"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"989"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">989</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48622</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Franklin"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Frank"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"270 Carlton Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Shopabout"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"franklinfrank@shopabout.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Guthrie"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"991"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">991</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4239</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Connie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Berry"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"647 Gardner Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Flumbo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"connieberry@flumbo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Frierson"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"996"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">996</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">17541</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Andrews"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Herrera"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"570 Vandam Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Klugger"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"andrewsherrera@klugger.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Whitehaven"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"0"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">0</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16623</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bradshaw"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mckenzie"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"244 Columbus Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Euron"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bradshawmckenzie@euron.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hobucken"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"5"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">5</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29342</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Leola"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Stewart"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"311 Elm Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Diginetic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"leolastewart@diginetic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fairview"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"12"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">12</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">37055</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Stafford"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Brock"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"296 Wythe Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Uncorp"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"staffordbrock@uncorp.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bend"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"17"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">17</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">7831</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bessie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Orr"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"239 Hinsdale Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Skyplex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bessieorr@skyplex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Graball"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"24"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44182</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Wood"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dale"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"582 Gelston Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Besto"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wooddale@besto.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Juntura"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"29"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27323</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Leah"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Santiago"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"193 Schenck Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isologix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"leahsantiago@isologix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gerton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"31"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">30443</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kristen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Santana"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"130 Middagh Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Dogspa"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kristensantana@dogspa.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Vale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"36"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15902</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alexandra"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Nguyen"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"389 Elizabeth Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bittor"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"alexandranguyen@bittor.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hemlock"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"43"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">43</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33474</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ryan"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Howe"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"660 Huntington Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Microluxe"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ryanhowe@microluxe.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Clara"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"48"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">48</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40608</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Peck"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Downs"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"594 Dwight Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ramjob"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"peckdowns@ramjob.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Coloma"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"50"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">50</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43695</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sheena"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Kirkland"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"598 Bank Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zerbina"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sheenakirkland@zerbina.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Walland"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"55"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">55</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22020</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Shelia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Puckett"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"265 Royce Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Izzby"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sheliapuckett@izzby.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Slovan"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"62"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">62</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43065</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lester"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Stanton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"969 Doughty Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geekko"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lesterstanton@geekko.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Itmann"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"67"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">67</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39430</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Isabelle"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Spence"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"718 Troy Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geeketron"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"isabellespence@geeketron.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Camptown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"74"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">74</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">47167</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lauri"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Saunders"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"768 Lynch Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Securia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"laurisaunders@securia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Caroline"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"79"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">79</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28185</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Booker"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lowery"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"817 Campus Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Sensate"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bookerlowery@sensate.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Carlos"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"81"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">81</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46568</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dennis"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gilbert"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"619 Minna Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Melbacor"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"dennisgilbert@melbacor.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kersey"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"86"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">86</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15428</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Walton"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Butler"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"999 Schenck Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Unisure"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"waltonbutler@unisure.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bentonville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"93"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">93</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">17728</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jeri"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Booth"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"322 Roosevelt Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geekology"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jeribooth@geekology.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Leming"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"98"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">98</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15085</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cora"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Barrett"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"555 Neptune Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kiosk"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"corabarrett@kiosk.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Independence"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"101"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">101</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43400</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cecelia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Grimes"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"972 Lincoln Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ecosys"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ceceliagrimes@ecosys.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Manchester"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"106"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">106</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8212</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Josefina"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wagner"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"418 Estate Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kyaguru"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"josefinawagner@kyaguru.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Darbydale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"113"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">113</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41652</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Burt"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Moses"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"633 Berry Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Uni"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"burtmoses@uni.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Russellville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"118"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">118</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">2223</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ballard"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Vasquez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"101 Bush Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Intergeek"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ballardvasquez@intergeek.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Century"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"120"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">120</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38565</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Browning"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rodriquez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"910 Moore Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Opportech"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"browningrodriquez@opportech.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cutter"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"125"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">125</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">5396</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tanisha"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dixon"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"482 Hancock Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Junipoor"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"tanishadixon@junipoor.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wauhillau"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"132"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">132</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">37707</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Horton"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Romero"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"427 Rutherford Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Affluex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hortonromero@affluex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hall"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"137"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">137</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3596</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Frost"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Freeman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"191 Dennett Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Beadzza"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"frostfreeman@beadzza.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sabillasville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"144"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">144</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43257</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Evans"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dyer"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"912 Post Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Magmina"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"evansdyer@magmina.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gordon"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"149"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">149</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22994</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Megan"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gonzales"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"836 Tampa Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Andershun"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"megangonzales@andershun.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rockhill"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"151"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">151</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34473</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kent"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Joyner"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"799 Truxton Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kozgene"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kentjoyner@kozgene.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Allamuchy"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"156"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">156</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40185</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sloan"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Pennington"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"573 Opal Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Hopeli"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sloanpennington@hopeli.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Evergreen"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"163"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">163</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43075</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Wilda"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Norman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"173 Beadel Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kog"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wildanorman@kog.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bodega"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"168"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">168</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49568</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Carissa"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Simon"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"975 Flatbush Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zillacom"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"carissasimon@zillacom.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Neibert"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"170"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">170</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6025</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mann"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Madden"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"161 Radde Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Farmex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mannmadden@farmex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Thermal"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"175"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">175</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16213</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Montoya"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Donaldson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"481 Morton Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Envire"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"montoyadonaldson@envire.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Delco"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"182"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">182</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">7803</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Manuela"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dillon"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"742 Garnet Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Moreganic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"manueladillon@moreganic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ilchester"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"187"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">187</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26581</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Autumn"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hodges"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"757 Granite Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ezentia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"autumnhodges@ezentia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Martinsville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"194"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">194</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16311</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Beck"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rosario"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"721 Cambridge Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zoid"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"beckrosario@zoid.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Efland"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"199"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">199</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18086</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Branch"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Love"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"458 Commercial Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Frolix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"branchlove@frolix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Caspar"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"202"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">202</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26466</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Medina"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Brown"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"519 Sunnyside Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bleendot"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"medinabrown@bleendot.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Winfred"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"207"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">207</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">45535</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Evelyn"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lara"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"636 Chestnut Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ultrasure"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"evelynlara@ultrasure.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Logan"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"214"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">214</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">24418</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Luann"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Faulkner"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"697 Hazel Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zolar"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"luannfaulkner@zolar.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ticonderoga"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"219"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">219</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">17127</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Edwards"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hurley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"834 Stockholm Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Austech"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"edwardshurley@austech.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bayview"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"221"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">221</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15803</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Benjamin"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Barrera"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"568 Main Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zaphire"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"benjaminbarrera@zaphire.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Germanton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"226"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">226</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">37720</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Wilkins"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Brady"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"486 Baltic Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Dogtown"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wilkinsbrady@dogtown.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Condon"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"233"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">233</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23020</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Washington"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Walsh"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"366 Church Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Candecor"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"washingtonwalsh@candecor.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Westphalia"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"238"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">238</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21287</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Constance"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wong"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"496 Brown Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Grainspot"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"constancewong@grainspot.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cecilia"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"240"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">240</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49741</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Oconnor"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Clay"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"659 Highland Boulevard"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Franscene"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"oconnorclay@franscene.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kilbourne"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"245"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">245</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22026</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Fran"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bolton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"147 Jerome Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Solaren"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"franbolton@solaren.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Nash"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"252"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">252</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18831</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Elvia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Poole"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"836 Delevan Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Velity"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"elviapoole@velity.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Groveville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"257"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">257</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">5318</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Olive"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Oneil"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"457 Decatur Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Helixo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"oliveoneil@helixo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chicopee"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"264"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">264</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22084</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Samantha"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ferrell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"488 Fulton Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Flum"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"samanthaferrell@flum.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brandywine"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"269"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">269</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43317</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Crosby"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Figueroa"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"910 Aurelia Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pyramia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"crosbyfigueroa@pyramia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Leyner"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"271"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">271</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11864</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Holt"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Walter"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"645 Poplar Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Grupoli"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"holtwalter@grupoli.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Mansfield"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"276"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">276</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11606</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Pittman"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mathis"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"567 Charles Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zuvy"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pittmanmathis@zuvy.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Roeville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"283"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">283</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">24070</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Fuentes"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Foley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"729 Walker Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Knowlysis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"fuentesfoley@knowlysis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tryon"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"288"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">288</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27243</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Wong"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Stone"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"440 Willoughby Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zentix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wongstone@zentix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wheatfields"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"290"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">290</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26103</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Neva"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Burgess"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"985 Wyona Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Slofast"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"nevaburgess@slofast.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cawood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"295"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">295</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">37358</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Howe"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Nash"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"833 Union Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Aquacine"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"howenash@aquacine.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Indio"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"303"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">303</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21976</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Huffman"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Green"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"455 Colby Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comtest"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"huffmangreen@comtest.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Weeksville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"308"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">308</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33989</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Glass"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Schroeder"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"670 Veterans Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Realmo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"glassschroeder@realmo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gratton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"310"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">310</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23049</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Shannon"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Morton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"412 Pleasant Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ovation"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"shannonmorton@ovation.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Edgar"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AZ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"315"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">315</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1314</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Clare"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Morrow"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"728 Madeline Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Gaptec"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"claremorrow@gaptec.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Mapletown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"322"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">322</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6303</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gilliam"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Horne"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"414 Florence Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Shepard"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gilliamhorne@shepard.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Winesburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"327"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">327</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29294</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Nell"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Contreras"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"694 Gold Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Momentia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"nellcontreras@momentia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cumminsville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"334"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">334</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">9178</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cross"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Floyd"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"815 Herkimer Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Maroptic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"crossfloyd@maroptic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kraemer"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"339"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">339</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3992</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Franco"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Welch"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"776 Brightwater Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Earthplex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"francowelch@earthplex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Naomi"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"341"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">341</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44367</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alberta"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bradford"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"670 Grant Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bugsall"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"albertabradford@bugsall.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Romeville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"346"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">346</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26594</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Shelby"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sanchez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"257 Fillmore Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geekus"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"shelbysanchez@geekus.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Seymour"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"353"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">353</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">45182</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rivera"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sherman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"603 Garden Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bovis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"riverasherman@bovis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Otranto"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"358"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">358</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44043</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hale"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Baldwin"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"845 Menahan Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kidgrease"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"halebaldwin@kidgrease.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Day"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"360"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">360</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26651</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ward"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hicks"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"592 Brighton Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Biotica"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wardhicks@biotica.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kanauga"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"365"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">365</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3176</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sanders"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Holder"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"453 Cypress Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geekola"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sandersholder@geekola.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Staples"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"372"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">372</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28566</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alba"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Forbes"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"814 Meserole Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isostream"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"albaforbes@isostream.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Clarence"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"377"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">377</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">5374</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Margo"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gay"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"613 Chase Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Rotodyne"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"margogay@rotodyne.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Waumandee"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"384"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">384</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48758</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sallie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Houston"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"836 Polar Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Squish"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"salliehouston@squish.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Morningside"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"389"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">389</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8839</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"York"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cummings"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"778 Centre Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Insurity"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"yorkcummings@insurity.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Freeburn"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"391"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">391</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14733</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Holman"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Jordan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"391 Forrest Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Maineland"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"holmanjordan@maineland.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cade"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"396"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">396</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14613</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Marsha"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Elliott"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"297 Liberty Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Orbiflex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"marshaelliott@orbiflex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Windsor"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"404"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">404</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34978</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Massey"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Becker"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"930 Pitkin Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Genekom"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"masseybecker@genekom.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Blairstown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"409"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">409</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36960</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Maura"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Glenn"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"183 Poly Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Viagreat"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mauraglenn@viagreat.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Foscoe"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"411"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">411</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1172</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Guzman"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Whitfield"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"181 Perry Terrace"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Springbee"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"guzmanwhitfield@springbee.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Balm"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"416"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">416</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27169</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hunt"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Schwartz"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"461 Havens Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Danja"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"huntschwartz@danja.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Grenelefe"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"423"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">423</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38852</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hines"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Underwood"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"284 Louise Terrace"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Namegen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hinesunderwood@namegen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Downsville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"428"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">428</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13925</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Stephens"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cain"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"189 Summit Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Rocklogic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"stephenscain@rocklogic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bourg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"430"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">430</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15251</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alejandra"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Chavez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"651 Butler Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Gology"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"alejandrachavez@gology.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Allensworth"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"435"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">435</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14654</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sue"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lopez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"632 Stone Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Emergent"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"suelopez@emergent.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Waterford"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"442"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">442</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36211</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lawanda"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Leon"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"126 Canal Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xixan"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lawandaleon@xixan.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Berwind"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"447"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">447</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11402</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lucia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Livingston"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"773 Lake Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Soprano"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lucialivingston@soprano.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Edgewater"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"454"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">454</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31687</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alicia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rollins"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"483 Verona Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Boilcat"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"aliciarollins@boilcat.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lutsen"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"459"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">459</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18869</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Pamela"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Henry"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"361 Locust Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Imageflow"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pamelahenry@imageflow.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Greenfields"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"461"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">461</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38807</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mcbride"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Padilla"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"550 Borinquen Pl"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zepitope"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mcbridepadilla@zepitope.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Emory"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AZ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"466"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">466</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">25109</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Marcie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcmillan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"947 Gain Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Entroflex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"marciemcmillan@entroflex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ronco"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"473"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">473</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">5391</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Susan"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Luna"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"521 Bogart Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zaya"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"susanluna@zaya.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Grazierville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"478"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">478</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28044</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dana"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Decker"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"627 Dobbin Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Acrodance"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"danadecker@acrodance.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sharon"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"480"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">480</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40807</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Anastasia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Parker"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"650 Folsom Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zilladyne"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"anastasiaparker@zilladyne.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Oberlin"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"485"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">485</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44235</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Albert"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Roberts"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"385 Harman Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Stralum"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"albertroberts@stralum.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Watrous"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NM"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"492"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">492</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31055</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Burnett"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Briggs"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"987 Cass Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pharmex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"burnettbriggs@pharmex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cornfields"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"497"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">497</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13493</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Doyle"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Jenkins"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"205 Nevins Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Unia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"doylejenkins@unia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Nicut"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"500"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">500</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39143</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Pope"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Keith"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"537 Fane Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zboo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"popekeith@zboo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Courtland"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"505"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">505</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">45493</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Shelley"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Webb"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"873 Crawford Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quadeebo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"shelleywebb@quadeebo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Topanga"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"512"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">512</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">47432</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alisha"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Morales"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"623 Batchelder Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Terragen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"alishamorales@terragen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gilmore"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"517"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">517</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3022</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Allyson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Walls"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"334 Coffey Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Gorganic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"allysonwalls@gorganic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dahlen"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"524"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">524</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49334</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Salas"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Farley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"499 Trucklemans Lane"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xumonk"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"salasfarley@xumonk.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Noxen"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"529"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">529</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21788</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Deann"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Fisher"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"511 Buffalo Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Twiist"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"deannfisher@twiist.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Templeton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"531"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">531</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39770</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Janet"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Pena"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"645 Livonia Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Corecom"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"janetpena@corecom.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Garberville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"536"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">536</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6255</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Emma"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Adkins"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"971 Calder Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ontagene"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"emmaadkins@ontagene.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ruckersville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"543"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">543</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48022</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Marina"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rasmussen"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"446 Love Lane"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Crustatia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"marinarasmussen@crustatia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Statenville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"548"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">548</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36930</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sandra"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Andrews"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"973 Prospect Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Datagene"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sandraandrews@datagene.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Inkerman"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"550"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">550</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">32238</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Walsh"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Goodwin"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"953 Canda Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Proflex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"walshgoodwin@proflex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ypsilanti"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"555"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">555</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10750</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Fannie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Slater"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"457 Tech Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kineticut"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"fannieslater@kineticut.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Basye"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"562"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">562</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10737</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sarah"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Strong"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"177 Pioneer Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Megall"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sarahstrong@megall.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ladera"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"567"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">567</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6507</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Diana"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dominguez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"419 Albany Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ohmnet"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"dianadominguez@ohmnet.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wildwood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"574"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">574</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">32954</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Andrea"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mosley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"368 Throop Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Musix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"andreamosley@musix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Blende"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"579"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">579</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12044</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Banks"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sawyer"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"652 Doone Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Rooforia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bankssawyer@rooforia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Foxworth"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"581"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">581</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16525</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Fuller"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcintyre"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"169 Bergen Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Applideck"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"fullermcintyre@applideck.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kenvil"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"586"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">586</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13644</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Love"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Velasquez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"290 Girard Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zomboid"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lovevelasquez@zomboid.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Villarreal"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"593"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">593</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41230</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Muriel"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Vazquez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"395 Montgomery Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Sustenza"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"murielvazquez@sustenza.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Strykersville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"598"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">598</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33251</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Morgan"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Coleman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"324 McClancy Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Aclima"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"morgancoleman@aclima.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bowden"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"601"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">601</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20796</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Vickie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Valentine"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"432 Bassett Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comvene"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"vickievalentine@comvene.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Teasdale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"606"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">606</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28770</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Michael"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bray"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"935 Lake Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Telepark"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"michaelbray@telepark.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lemoyne"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"613"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">613</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39340</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Eddie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mccarty"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"971 Richards Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bisba"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"eddiemccarty@bisba.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fruitdale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"618"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">618</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8976</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cheri"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ford"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"803 Ridgewood Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zorromop"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cheriford@zorromop.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gambrills"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"620"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">620</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">7224</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Coleen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bartlett"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"761 Carroll Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Idealis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"coleenbartlett@idealis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Mathews"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"625"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">625</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46010</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cynthia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Johnston"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"142 Box Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zentry"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cynthiajohnston@zentry.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Makena"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"632"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">632</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40470</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kay"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Warren"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"422 Alabama Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Realysis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kaywarren@realysis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Homestead"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"637"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">637</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3169</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kathy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Carter"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"410 Jamison Lane"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Limage"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kathycarter@limage.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ernstville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"644"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">644</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44021</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Etta"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Miller"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"376 Lawton Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bluegrain"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ettamiller@bluegrain.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Baker"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"649"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">649</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20275</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jeanine"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Malone"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"114 Dodworth Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Nixelt"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jeaninemalone@nixelt.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Keyport"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"651"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">651</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18360</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Young"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Reeves"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"581 Plaza Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Krog"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"youngreeves@krog.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sussex"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"656"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">656</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21632</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Olson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hunt"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"342 Jaffray Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Volax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"olsonhunt@volax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bangor"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"663"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">663</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">2456</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rollins"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Richards"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"129 Sullivan Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geostele"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rollinsrichards@geostele.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Morgandale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"668"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">668</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">45069</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Potter"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Michael"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"803 Glenmore Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ontality"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pottermichael@ontality.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Newkirk"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"670"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">670</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10178</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ollie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Riley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"252 Jackson Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Adornica"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ollieriley@adornica.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brethren"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"675"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">675</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36102</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Fisher"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Shepard"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"859 Varick Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Qot"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"fishershepard@qot.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Diaperville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"682"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">682</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14168</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Anne"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hale"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"708 Anthony Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cytrek"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"annehale@cytrek.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Beechmont"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"687"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">687</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48630</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Caroline"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cox"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"626 Hillel Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Opticon"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"carolinecox@opticon.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Loma"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"694"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">694</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33125</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Craig"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Palmer"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"273 Montrose Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comvey"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"craigpalmer@comvey.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cleary"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"699"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">699</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4156</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gallagher"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Marshall"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"648 Clifford Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Exiand"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gallaghermarshall@exiand.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Belfair"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"702"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">702</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46490</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Meadows"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Delgado"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"612 Jardine Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Daisu"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"meadowsdelgado@daisu.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Venice"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"707"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">707</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">30325</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sonya"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Trevino"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"181 Irving Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Atgen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sonyatrevino@atgen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Enetai"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"714"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">714</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16602</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Socorro"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Murray"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"810 Manhattan Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isoswitch"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"socorromurray@isoswitch.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Jugtown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AZ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"719"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">719</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33107</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Leanna"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Reed"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"528 Krier Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Rodeology"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"leannareed@rodeology.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Carrizo"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"721"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">721</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">32958</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mara"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dickson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"810 Harrison Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comtours"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"maradickson@comtours.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Thynedale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"726"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">726</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44737</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rosemary"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Salazar"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"290 Croton Loop"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Rockabye"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rosemarysalazar@rockabye.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Helen"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"733"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">733</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15722</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lakeisha"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mccarthy"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"782 Turnbull Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Exosis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lakeishamccarthy@exosis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Caberfae"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NM"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"738"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">738</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44936</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rosalind"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hunter"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"644 Eaton Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zolarity"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rosalindhunter@zolarity.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cataract"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"740"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">740</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6143</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Chambers"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hahn"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"937 Windsor Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Medalert"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"chambershahn@medalert.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dorneyville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"745"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">745</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4572</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jacobs"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sweeney"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"189 Lott Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comtent"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jacobssweeney@comtent.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Advance"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"752"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">752</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14039</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jerry"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rush"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"632 Dank Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ebidco"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jerryrush@ebidco.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Geyserville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"757"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">757</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34628</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mccullough"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Moore"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"304 Hastings Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Nikuda"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mcculloughmoore@nikuda.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Charco"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"764"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">764</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3728</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Noemi"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gill"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"427 Chester Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Avit"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"noemigill@avit.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chesterfield"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"769"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">769</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15362</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Francis"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Beck"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"454 Livingston Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Furnafix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"francisbeck@furnafix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dunnavant"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"771"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">771</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">32784</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jocelyn"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Boone"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"513 Division Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Collaire"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jocelynboone@collaire.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lisco"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"776"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">776</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29177</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Duke"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Atkinson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"520 Doscher Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Tripsch"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"dukeatkinson@tripsch.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lafferty"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"783"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">783</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11911</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Faith"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cooper"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"539 Rapelye Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Insuron"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"faithcooper@insuron.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Jennings"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"788"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">788</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12473</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Marianne"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Aguilar"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"213 Holly Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Marqet"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"marianneaguilar@marqet.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Alfarata"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"790"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">790</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29912</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ellis"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sullivan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"877 Coyle Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Enersave"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ellissullivan@enersave.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Canby"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"795"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">795</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31450</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bruce"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Avila"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"865 Newkirk Placez"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Plasmosis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bruceavila@plasmosis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ada"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"803"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">803</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49567</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Marissa"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Spears"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"963 Highland Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Centregy"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"marissaspears@centregy.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bloomington"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"808"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">808</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11251</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Nola"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Quinn"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"863 Wythe Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Iplax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"nolaquinn@iplax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cuylerville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"810"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">810</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10563</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alyssa"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ortega"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"977 Clymer Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Eventage"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"alyssaortega@eventage.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Convent"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"815"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">815</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19336</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Guthrie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Morse"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"685 Vandalia Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Gronk"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"guthriemorse@gronk.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fowlerville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"822"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">822</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13024</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hicks"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Farrell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"468 Middleton Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zolarex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hicksfarrell@zolarex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Columbus"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"827"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">827</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">37536</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Naomi"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ball"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"319 Stewart Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isotronic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"naomiball@isotronic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Trona"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NM"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"834"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">834</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38049</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sybil"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Carrillo"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"359 Baughman Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Phuel"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sybilcarrillo@phuel.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kohatk"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"839"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">839</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38292</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Langley"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Neal"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"565 Newton Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Liquidoc"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"langleyneal@liquidoc.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Osage"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"841"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">841</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28291</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dalton"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Waters"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"859 Grand Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Malathion"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"daltonwaters@malathion.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tonopah"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AZ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"846"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">846</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35099</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Maureen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Glass"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"140 Amherst Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Stelaecor"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"maureenglass@stelaecor.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cucumber"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"853"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">853</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38353</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Travis"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Parks"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"930 Bay Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pyramax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"travisparks@pyramax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gadsden"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"858"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">858</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23194</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Small"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hatfield"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"593 Tennis Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Letpro"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"smallhatfield@letpro.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Haena"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"860"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">860</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23613</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Clark"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Boyd"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"501 Rock Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Deepends"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"clarkboyd@deepends.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Whitewater"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"865"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">865</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10574</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cook"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Kelley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"865 Lincoln Terrace"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quizmo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cookkelley@quizmo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kansas"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"872"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">872</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26314</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jane"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Greer"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"717 Hewes Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Newcube"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"janegreer@newcube.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Delshire"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"877"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">877</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42879</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tracey"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ruiz"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"141 Tompkins Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Waab"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"traceyruiz@waab.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Zeba"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NM"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"884"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">884</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29316</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Reva"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rosa"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"784 Greene Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Urbanshee"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"revarosa@urbanshee.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bakersville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"889"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">889</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26464</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Fischer"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Klein"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"948 Juliana Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comtext"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"fischerklein@comtext.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Jackpot"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"891"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">891</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34829</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jacobson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Clemons"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"507 Wilson Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quilm"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jacobsonclemons@quilm.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Muir"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"896"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">896</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31947</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Buckley"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Peterson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"217 Beayer Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Earwax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"buckleypeterson@earwax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Franklin"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"904"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">904</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27707</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mendez"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcneil"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"431 Halsey Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Macronaut"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mendezmcneil@macronaut.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Troy"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"909"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">909</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18421</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Stark"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lewis"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"409 Tilden Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Frosnex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"starklewis@frosnex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Axis"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"911"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">911</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42655</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Annie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lyons"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"518 Woods Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Enerforce"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"annielyons@enerforce.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Stagecoach"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"916"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">916</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">47887</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jarvis"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Alexander"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"406 Bergen Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Equitax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jarvisalexander@equitax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Haring"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"923"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">923</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48466</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mueller"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mckee"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"298 Ruby Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Luxuria"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"muellermckee@luxuria.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Coleville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"928"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">928</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19611</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hester"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Copeland"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"425 Cropsey Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Dymi"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hestercopeland@dymi.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wolcott"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"930"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">930</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">47257</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kinney"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lawson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"501 Raleigh Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Neptide"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kinneylawson@neptide.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Deltaville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"935"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">935</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4959</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Flowers"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Robles"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"201 Hull Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xelegyl"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"flowersrobles@xelegyl.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rehrersburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"942"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">942</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21299</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hamilton"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Clayton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"413 Debevoise Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Architax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hamiltonclayton@architax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Terlingua"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NM"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"947"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">947</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22039</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Virgie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Garza"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"903 Matthews Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Plasmox"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"virgiegarza@plasmox.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Somerset"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"954"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">954</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49404</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jenna"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Martin"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"688 Hart Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zinca"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jennamartin@zinca.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Oasis"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"959"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">959</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34743</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Shaffer"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cervantes"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"931 Varick Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Oceanica"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"shaffercervantes@oceanica.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bowie"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"961"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">961</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43219</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Betsy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hyde"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"183 Junius Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Tubalum"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"betsyhyde@tubalum.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Driftwood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"966"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">966</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20619</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Susanne"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rodriguez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"255 Knickerbocker Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comtrek"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"susannerodriguez@comtrek.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Trinway"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"973"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">973</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">45756</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rice"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Farmer"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"476 Nassau Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Photobin"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ricefarmer@photobin.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Suitland"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"978"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">978</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21459</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Melanie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rojas"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"991 Java Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kage"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"melanierojas@kage.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Greenock"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"980"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">980</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42436</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cash"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Collier"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"999 Sapphire Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ceprene"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cashcollier@ceprene.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Glidden"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"985"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">985</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20083</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Martin"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gardner"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"644 Fairview Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Golistic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"martingardner@golistic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Connerton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"992"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">992</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11413</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kristie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Kennedy"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"750 Hudson Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ludak"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kristiekennedy@ludak.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Warsaw"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"997"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">997</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">25311</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Combs"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Frederick"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"586 Lloyd Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pathways"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"combsfrederick@pathways.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Williamson"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"3"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">3</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44947</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Levine"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Burks"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"328 Wilson Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Amtap"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"levineburks@amtap.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cochranville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"8"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">8</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48868</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jan"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Burns"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"699 Visitation Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Glasstep"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"janburns@glasstep.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wakulla"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AZ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"10"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">10</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46170</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dominique"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Park"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"100 Gatling Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Conjurica"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"dominiquepark@conjurica.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Omar"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"15"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">15</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43456</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bobbie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sexton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"232 Sedgwick Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zytrex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bobbiesexton@zytrex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hendersonville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"22"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40283</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Barrera"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Terrell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"292 Orange Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Steelfab"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"barreraterrell@steelfab.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bynum"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"27"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6176</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Meyers"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Williamson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"675 Henderson Walk"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Plexia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"meyerswilliamson@plexia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Richmond"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AZ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"34"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35379</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ellison"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Kim"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"986 Revere Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Signity"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ellisonkim@signity.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sehili"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"39"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38688</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bowers"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mendez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"665 Bennet Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Farmage"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bowersmendez@farmage.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Duryea"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"41"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">41</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36060</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hancock"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Holden"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"625 Gaylord Drive"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Poochies"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hancockholden@poochies.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Alamo"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"46"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">46</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12351</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Karla"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bowman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"554 Chapel Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Undertap"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"karlabowman@undertap.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sylvanite"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"53"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">53</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28101</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kathryn"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Payne"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"467 Louis Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Katakana"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kathrynpayne@katakana.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Harviell"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"58"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">58</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31697</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Marva"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cannon"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"993 Highland Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comcubine"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"marvacannon@comcubine.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Orviston"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"60"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">60</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">45955</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Maude"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Casey"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"566 Strauss Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quilch"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"maudecasey@quilch.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Enlow"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"65"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">65</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23282</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Leonor"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Pruitt"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"974 Terrace Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Velos"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"leonorpruitt@velos.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Devon"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"72"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">72</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">9732</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Barlow"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rhodes"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"891 Clinton Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zialactic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"barlowrhodes@zialactic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Echo"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"77"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">77</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">5724</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Byrd"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Conley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"698 Belmont Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zidox"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"byrdconley@zidox.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rockbridge"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"84"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">84</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3001</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hutchinson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Newton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"553 Locust Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zaggles"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hutchinsonnewton@zaggles.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Snyderville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"89"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">89</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13263</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mcdowell"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bradley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"960 Howard Alley"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Grok"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mcdowellbradley@grok.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Toftrees"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"91"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">91</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29799</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Vonda"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Galloway"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"988 Voorhies Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Illumity"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"vondagalloway@illumity.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Holcombe"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"96"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">96</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15933</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Shirley"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Edwards"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"817 Caton Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Equitox"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"shirleyedwards@equitox.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Nelson"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"104"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">104</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">32619</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Casey"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Roth"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"963 Railroad Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Hotcakes"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"caseyroth@hotcakes.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Davenport"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"109"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">109</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">25812</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gretchen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Dawson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"610 Bethel Loop"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Tetak"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gretchendawson@tetak.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hailesboro"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"111"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">111</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1481</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Traci"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Allison"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"922 Bryant Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Enjola"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"traciallison@enjola.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Robinette"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"116"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">116</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21335</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hobbs"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wright"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"965 Temple Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Netbook"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hobbswright@netbook.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Strong"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"123"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">123</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3079</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cleo"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Beach"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"653 Haring Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Proxsoft"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cleobeach@proxsoft.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Greensburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"128"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">128</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3556</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mack"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bullock"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"462 Ingraham Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Terascape"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mackbullock@terascape.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Eureka"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"130"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">130</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">24171</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Roxie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cantu"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"841 Catherine Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Skybold"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"roxiecantu@skybold.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Deputy"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"135"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">135</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">24885</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Stevenson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Crosby"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"473 Boardwalk "</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Accel"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"stevensoncrosby@accel.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Norris"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"142"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">142</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4544</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Vang"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hughes"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"357 Landis Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bolax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"vanghughes@bolax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Emerald"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"147"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">147</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35921</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Charmaine"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Whitney"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"484 Seton Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comveyer"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"charmainewhitney@comveyer.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dexter"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"154"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">154</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40945</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Burns"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Solis"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"274 Lorraine Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Rodemco"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"burnssolis@rodemco.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ballico"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"159"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">159</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1696</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alvarez"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mack"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"897 Manor Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Snorus"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"alvarezmack@snorus.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rosedale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"161"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">161</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4659</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Doreen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Randall"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"178 Court Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Calcula"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"doreenrandall@calcula.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Belmont"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"166"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">166</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33847</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rutledge"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rivas"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"352 Verona Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Virxo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rutledgerivas@virxo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brandermill"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"173"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">173</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">5989</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Whitley"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Blevins"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"127 Brooklyn Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pawnagra"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"whitleyblevins@pawnagra.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rodanthe"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"178"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">178</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36735</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Clements"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Finley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"270 Story Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Imaginart"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"clementsfinley@imaginart.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lookingglass"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"180"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">180</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34236</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ursula"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Goodman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"414 Clinton Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Earthmark"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ursulagoodman@earthmark.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rote"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"185"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">185</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43532</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Laurel"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cline"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"788 Fenimore Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Prismatic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"laurelcline@prismatic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Frank"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"192"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">192</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23508</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ramsey"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Carr"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"209 Williamsburg Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Strezzo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ramseycarr@strezzo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Grapeview"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NM"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"197"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">197</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">17246</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sweet"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sanders"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"712 Homecrest Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isosure"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sweetsanders@isosure.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sheatown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"200"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">200</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26210</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Teri"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hester"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"653 Abbey Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Electonic"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"terihester@electonic.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Martell"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"205"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">205</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">45493</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Johnson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Chang"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"331 John Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Gleamink"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"johnsonchang@gleamink.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sultana"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"212"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">212</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10299</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Marisol"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Fischer"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"362 Prince Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Autograte"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"marisolfischer@autograte.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Oley"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"217"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">217</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33730</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sally"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mccoy"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"854 Corbin Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Omnigog"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sallymccoy@omnigog.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Escondida"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"224"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">224</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42708</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Billie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Nixon"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"241 Kaufman Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xanide"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"billienixon@xanide.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chapin"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"229"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">229</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">2740</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jana"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hensley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"176 Erasmus Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isotrack"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"janahensley@isotrack.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Caledonia"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"231"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">231</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46180</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Essie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Clarke"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"308 Harbor Lane"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pharmacon"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"essieclarke@pharmacon.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fillmore"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"236"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">236</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41200</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Suzanne"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bird"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"219 Luquer Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Imant"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"suzannebird@imant.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bainbridge"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"243"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">243</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29902</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Evangelina"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Perez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"787 Joval Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Keengen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"evangelinaperez@keengen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Mulberry"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"248"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">248</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49989</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"West"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"England"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"717 Hendrickson Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Obliq"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"westengland@obliq.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Maury"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"250"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">250</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27893</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Earlene"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ellis"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"512 Bay Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Codact"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"earleneellis@codact.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sunwest"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"255"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">255</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49339</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Iva"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rivers"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"470 Rost Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Mantrix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ivarivers@mantrix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Disautel"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"262"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">262</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">30289</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tameka"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Levine"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"815 Atlantic Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Acium"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"tamekalevine@acium.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Winchester"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"267"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">267</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42753</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Weeks"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Castillo"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"526 Holt Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Talendula"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"weekscastillo@talendula.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Washington"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"274"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">274</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12104</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Frieda"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"House"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"171 Banker Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quonk"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"friedahouse@quonk.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Aberdeen"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"279"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">279</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15904</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Chapman"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hart"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"902 Bliss Terrace"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kongene"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"chapmanhart@kongene.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bradenville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"281"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">281</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39830</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bean"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Aguirre"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"133 Pilling Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Amril"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"beanaguirre@amril.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Waterview"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"286"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">286</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39063</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rosetta"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Turner"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"169 Jefferson Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Spacewax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rosettaturner@spacewax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Stewart"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"293"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">293</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29867</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cruz"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Carver"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"465 Boerum Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Vitricomp"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cruzcarver@vitricomp.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Crayne"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"298"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">298</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34334</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bullock"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Marsh"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"589 Virginia Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Renovize"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bullockmarsh@renovize.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Coinjock"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"301"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">301</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16782</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Minerva"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Graham"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"532 Harrison Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Sureplex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"minervagraham@sureplex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Belleview"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"GA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"306"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">306</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">2171</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hensley"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hardin"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"196 Maujer Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Neocent"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hensleyhardin@neocent.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Reinerton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"313"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">313</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34108</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alston"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Henderson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"132 Prescott Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Prosure"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"alstonhenderson@prosure.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Worton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"318"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">318</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8512</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Nichole"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Pearson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"656 Lacon Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Yurture"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"nicholepearson@yurture.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Juarez"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"320"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">320</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34521</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Patti"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Brennan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"870 Degraw Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cognicode"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pattibrennan@cognicode.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Torboy"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"325"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">325</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1956</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Magdalena"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Simmons"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"681 Townsend Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geekosis"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"magdalenasimmons@geekosis.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sterling"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"332"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">332</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">37770</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Shepherd"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Davenport"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"586 Montague Terrace"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ecraze"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"shepherddavenport@ecraze.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Accoville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NM"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"337"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">337</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43432</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Monroe"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Stafford"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"183 Seigel Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Centuria"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"monroestafford@centuria.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Camino"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"344"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">344</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42654</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sasha"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Baxter"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"700 Bedford Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Callflex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sashabaxter@callflex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Campo"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"349"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">349</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">24180</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Allison"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Fitzpatrick"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"913 Arlington Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Veraq"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"allisonfitzpatrick@veraq.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Marbury"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"351"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">351</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">47089</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hendrix"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Stephens"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"181 Beaver Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Recrisys"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hendrixstephens@recrisys.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Denio"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"356"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">356</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34540</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lourdes"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Valdez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"700 Anchorage Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Interloo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lourdesvaldez@interloo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Goldfield"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"363"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">363</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34007</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Peggy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bright"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"613 Engert Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Inventure"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"peggybright@inventure.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chautauqua"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"368"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">368</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23535</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hooper"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Tyson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"892 Taaffe Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zaggle"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hoopertyson@zaggle.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Nutrioso"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"370"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">370</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28499</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Oneill"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Carney"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"773 Adelphi Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bedder"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"oneillcarney@bedder.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Yorklyn"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"375"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">375</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23860</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Phoebe"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Patton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"564 Hale Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xoggle"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"phoebepatton@xoggle.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brule"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NM"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"382"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">382</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42061</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Finley"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Singleton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"407 Clay Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quarex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"finleysingleton@quarex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bedias"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"387"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">387</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35916</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"April"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hill"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"818 Bayard Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kengen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"aprilhill@kengen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chloride"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"394"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">394</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6121</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lorrie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Nunez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"221 Ralph Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bullzone"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lorrienunez@bullzone.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Longoria"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"399"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">399</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">32587</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Carmela"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Franks"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"617 Dewey Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zensure"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"carmelafranks@zensure.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sanders"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"402"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">402</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1282</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Pacheco"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rosales"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"538 Pershing Loop"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Circum"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pachecorosales@circum.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Elbert"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"407"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">407</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36417</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gilda"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Jacobson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"883 Loring Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comveyor"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gildajacobson@comveyor.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Topaz"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"414"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">414</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">17506</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Conway"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Daugherty"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"643 Kermit Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Lyria"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"conwaydaugherty@lyria.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Vaughn"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"419"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">419</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">34847</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Helen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Montoya"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"736 Kingsland Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Hairport"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"helenmontoya@hairport.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Edinburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NE"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"421"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">421</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46868</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tamika"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mccall"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"764 Bragg Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Eventix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"tamikamccall@eventix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tivoli"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"426"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">426</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4499</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Julie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Parsons"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"768 Keap Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Goko"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"julieparsons@goko.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Coldiron"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"433"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">433</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19266</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Wilkinson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Flowers"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"154 Douglass Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xsports"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wilkinsonflowers@xsports.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Coultervillle"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"438"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">438</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16367</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Walter"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Velez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"931 Farragut Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Virva"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"waltervelez@virva.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tyro"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"440"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">440</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41590</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ray"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wiley"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"102 Barwell Terrace"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Polaria"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"raywiley@polaria.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hardyville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"445"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">445</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41178</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rodriguez"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Macias"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"164 Boerum Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xylar"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rodriguezmacias@xylar.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Riner"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"452"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">452</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3589</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Blackwell"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Delaney"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"443 Sackett Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Imkan"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"blackwelldelaney@imkan.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gasquet"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"457"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">457</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14057</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bush"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gordon"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"975 Dakota Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Softmicro"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bushgordon@softmicro.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chemung"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"PA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"464"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">464</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20504</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cobb"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Humphrey"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"823 Sunnyside Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Apexia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cobbhumphrey@apexia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wintersburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"469"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">469</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26509</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Marci"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Shepherd"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"565 Hall Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Shadease"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"marcishepherd@shadease.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Springhill"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"471"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">471</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">7629</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Juana"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Silva"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"249 Amity Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Artworlds"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"juanasilva@artworlds.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Norfolk"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"476"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">476</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33386</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Silva"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Marks"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"183 Eldert Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Medifax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"silvamarks@medifax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hachita"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"483"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">483</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6344</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kelley"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Harper"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"758 Preston Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xyqag"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kelleyharper@xyqag.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Healy"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"488"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">488</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">6289</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Wilma"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hopkins"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"428 Lee Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Entality"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"wilmahopkins@entality.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Englevale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"490"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">490</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1447</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Strong"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hendrix"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"134 Beach Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Duoflex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"stronghendrix@duoflex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Allentown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"495"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">495</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13478</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Abigail"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Nichols"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"887 President Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Enquility"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"abigailnichols@enquility.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bagtown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NM"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"503"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">503</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42649</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Leta"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Stout"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"518 Bowery Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pivitol"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"letastout@pivitol.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Boonville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"508"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">508</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41300</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lawrence"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mathews"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"987 Rose Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Deviltoe"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lawrencemathews@deviltoe.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Woodburn"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"510"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">510</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48504</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Petty"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sykes"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"566 Village Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Nebulean"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pettysykes@nebulean.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wedgewood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"515"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">515</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18531</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lott"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Keller"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"827 Miami Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Translink"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lottkeller@translink.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gila"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"522"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">522</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19879</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Faulkner"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Garrett"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"396 Grove Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pigzart"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"faulknergarrett@pigzart.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Felt"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"527"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">527</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">2028</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Carver"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Peters"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"816 Victor Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Housedown"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"carverpeters@housedown.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Nadine"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"534"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">534</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20470</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cristina"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Russo"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"500 Highlawn Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Cyclonica"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cristinarusso@cyclonica.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gorst"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"539"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">539</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">24560</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tami"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Maddox"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"741 Pineapple Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Accidency"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"tamimaddox@accidency.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kennedyville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"541"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">541</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42915</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Logan"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Burke"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"904 Clarendon Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Overplex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"loganburke@overplex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Johnsonburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"546"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">546</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43242</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bernice"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sims"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"382 Columbia Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Verbus"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bernicesims@verbus.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sena"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"553"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">553</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28390</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Aimee"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cohen"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"396 Lafayette Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Eplode"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"aimeecohen@eplode.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Thatcher"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"558"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">558</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8922</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Horne"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Valenzuela"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"979 Kensington Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isoternia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hornevalenzuela@isoternia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Greenbush"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"560"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">560</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">24514</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Felecia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Oneill"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"995 Autumn Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Mediot"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"feleciaoneill@mediot.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Joppa"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"565"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">565</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">15197</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Taylor"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ingram"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"113 Will Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Lyrichord"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"tayloringram@lyrichord.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Collins"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"572"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">572</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49355</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Therese"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Espinoza"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"994 Chester Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Gonkle"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"thereseespinoza@gonkle.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hayes"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"577"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">577</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21398</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gilbert"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Serrano"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"294 Troutman Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Senmao"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gilbertserrano@senmao.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Greer"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"584"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">584</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">5346</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Pearson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bryant"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"971 Heyward Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Anacho"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pearsonbryant@anacho.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Bluffview"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"589"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">589</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">33260</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ericka"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cote"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"425 Bath Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Venoflex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"erickacote@venoflex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Blue"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"591"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">591</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48997</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rivers"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Macdonald"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"919 Johnson Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Ziore"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"riversmacdonald@ziore.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Townsend"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"596"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">596</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4063</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Letitia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Walker"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"963 Vanderveer Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zizzle"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"letitiawalker@zizzle.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rossmore"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"604"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">604</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10675</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Isabel"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gilliam"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"854 Broadway "</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zenthall"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"isabelgilliam@zenthall.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Ventress"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"609"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">609</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28586</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Montgomery"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Washington"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"169 Schroeders Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kongle"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"montgomerywashington@kongle.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Croom"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AZ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"611"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">611</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">17528</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Katherine"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Prince"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"705 Elm Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zillacon"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"katherineprince@zillacon.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rew"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"616"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">616</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">25276</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jessie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mayer"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"683 Chester Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Emtrak"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jessiemayer@emtrak.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Marysville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"HI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"623"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">623</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">20514</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rose"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Combs"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"312 Grimes Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Aquamate"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rosecombs@aquamate.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fostoria"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"628"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">628</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">42736</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Buckner"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Chen"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"863 Rugby Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Jamnation"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bucknerchen@jamnation.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Camas"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"630"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">630</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">46060</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Leanne"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Jones"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"451 Bayview Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Wazzu"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"leannejones@wazzu.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kylertown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"635"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">635</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44705</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Norman"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gilmore"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"330 Gates Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comfirm"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"normangilmore@comfirm.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Riceville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"642"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">642</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">32852</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Reyna"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Harris"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"305 Powell Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bedlam"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"reynaharris@bedlam.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Florence"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"647"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">647</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10147</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Annabelle"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Velazquez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"299 Kensington Walk"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Sealoud"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"annabellevelazquez@sealoud.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Soudan"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"654"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">654</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38695</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Armstrong"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Frazier"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"899 Seeley Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zensor"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"armstrongfrazier@zensor.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Cherokee"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"659"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">659</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29648</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Dorsey"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sosa"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"270 Aberdeen Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Daycore"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"dorseysosa@daycore.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Chamberino"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"661"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">661</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3679</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Joanne"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Spencer"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"910 Montauk Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Visalia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"joannespencer@visalia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Valmy"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NH"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"666"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">666</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13880</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mcguire"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lloyd"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"658 Just Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Centrexin"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mcguirelloyd@centrexin.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Warren"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"673"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">673</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11303</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mcdaniel"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Harrell"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"565 Montgomery Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Eyeris"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mcdanielharrell@eyeris.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Garnet"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"678"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">678</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43663</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ruby"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Shaffer"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">28</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"350 Clark Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comtrail"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rubyshaffer@comtrail.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Aurora"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"680"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">680</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31561</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Melton"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Camacho"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"771 Montana Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Insuresys"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"meltoncamacho@insuresys.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sparkill"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"685"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">685</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22249</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Yesenia"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rowland"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"193 Dekalb Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Coriander"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"yeseniarowland@coriander.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lupton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"692"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">692</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10435</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Haney"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Barlow"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"267 Lenox Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Egypto"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"haneybarlow@egypto.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Detroit"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"697"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">697</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">48745</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mallory"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Emerson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"318 Dunne Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Exoplode"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"malloryemerson@exoplode.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Montura"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"700"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">700</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19164</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Patel"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Durham"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"440 King Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Icology"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pateldurham@icology.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Mammoth"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"705"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">705</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28415</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Krystal"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cross"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"604 Drew Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Tubesys"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"krystalcross@tubesys.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dalton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"712"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">712</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12459</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Butler"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Alston"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"486 Hemlock Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quordate"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"butleralston@quordate.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Verdi"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"717"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">717</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29270</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Erickson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcdonald"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"873 Franklin Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Exotechno"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ericksonmcdonald@exotechno.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Jessie"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"724"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">724</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12548</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hopper"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Peck"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"849 Hendrickson Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Uxmox"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hopperpeck@uxmox.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Faxon"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"UT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"729"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">729</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">41812</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Katy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Rivera"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"791 Olive Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Blurrybus"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"katyrivera@blurrybus.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Innsbrook"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"731"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">731</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">4994</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lorene"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Weiss"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"990 Ocean Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Comvoy"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"loreneweiss@comvoy.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lavalette"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"736"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">736</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">28677</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rogers"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcmahon"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"423 Cameron Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Brainclip"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"rogersmcmahon@brainclip.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Saddlebrooke"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"FL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"743"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">743</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14077</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Susana"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Moody"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"842 Fountain Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bitrex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"susanamoody@bitrex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Temperanceville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"748"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">748</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">38060</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ford"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Branch"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"926 Cypress Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Buzzness"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"fordbranch@buzzness.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Beason"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"DC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"750"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">750</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40481</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Cherie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Brooks"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"601 Woodhull Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kaggle"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"cheriebrooks@kaggle.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Groton"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"755"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">755</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43878</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Bartlett"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Conway"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"453 Times Placez"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Konnect"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"bartlettconway@konnect.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Belva"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"762"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">762</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10291</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Amanda"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Head"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"990 Ocean Parkway"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zentury"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"amandahead@zentury.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hegins"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"767"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">767</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26220</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Anthony"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Sutton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"179 Fayette Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Xiix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"anthonysutton@xiix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Iberia"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"774"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">774</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">35287</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lynnette"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Alvarez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"991 Brightwater Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Gink"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lynnettealvarez@gink.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Leola"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"779"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">779</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">40983</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Maggie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Pace"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"104 Harbor Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Bulljuice"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"maggiepace@bulljuice.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Floris"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"781"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">781</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">29961</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sanford"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mullen"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"879 Dover Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zanity"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sanfordmullen@zanity.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Martinez"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"786"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">786</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3024</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Rene"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Vang"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"506 Randolph Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Isopop"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"renevang@isopop.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Vienna"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"793"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">793</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16911</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alford"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Compton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"186 Veronica Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zyple"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"alfordcompton@zyple.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sugartown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"798"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">798</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">3165</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Catherine"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ward"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"325 Burnett Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Dreamia"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"catherineward@dreamia.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Glenbrook"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"801"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">801</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14954</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Molly"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Maldonado"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">37</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"518 Maple Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Straloy"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mollymaldonado@straloy.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hebron"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"806"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">806</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">36492</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Carson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Riddle"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"984 Lois Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Terrago"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"carsonriddle@terrago.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Leland"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"813"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">813</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">30833</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ebony"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bishop"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">20</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"487 Ridge Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Optique"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ebonybishop@optique.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Fairmount"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"818"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">818</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">24433</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Espinoza"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Petersen"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"641 Glenwood Road"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Futurity"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"espinozapetersen@futurity.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Floriston"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"820"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">820</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1011</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Shepard"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Ramsey"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"806 Village Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Mantro"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"shepardramsey@mantro.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tibbie"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"825"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">825</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49000</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Terra"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Witt"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"590 Conway Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Insectus"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"terrawitt@insectus.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Forbestown"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AR"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"832"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">832</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">8582</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Laura"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Gibbs"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"511 Osborn Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Corepan"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lauragibbs@corepan.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Worcester"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"KS"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"837"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">837</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">14485</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Amy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Villarreal"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"381 Stillwell Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Fleetmix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"amyvillarreal@fleetmix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sanford"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"844"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">844</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26840</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Jill"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"David"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"346 Legion Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zytrax"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"jilldavid@zytrax.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Saticoy"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"SC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"849"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">849</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">16200</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Barry"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Chapman"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"931 Dekoven Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Darwinium"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"barrychapman@darwinium.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Whitestone"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"851"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">851</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22026</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Henderson"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Price"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"530 Hausman Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Plutorque"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hendersonprice@plutorque.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brutus"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"RI"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"856"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">856</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27583</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Alissa"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Knox"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"258 Empire Boulevard"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geologix"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"alissaknox@geologix.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hartsville/Hartley"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"863"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">863</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23165</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Melendez"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Fernandez"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"661 Johnson Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Vixo"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"melendezfernandez@vixo.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Farmers"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"868"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">868</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">27624</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Polly"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Barron"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">22</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"129 Frank Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geofarm"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"pollybarron@geofarm.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Loyalhanna"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ND"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"870"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">870</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">43882</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Goff"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Phelps"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"164 Montague Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Digigen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"goffphelps@digigen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Weedville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"875"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">875</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">19655</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mercer"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Pratt"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"608 Perry Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Twiggery"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mercerpratt@twiggery.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Eggertsville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"882"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">882</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">10895</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mari"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Landry"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">39</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"963 Gerald Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kenegy"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"marilandry@kenegy.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lithium"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NC"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"887"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">887</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31772</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Eunice"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Watts"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"707 Stuyvesant Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Memora"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"eunicewatts@memora.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Westwood"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"894"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">894</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">1031</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tyler"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Fitzgerald"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"787 Meserole Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Jetsilk"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"tylerfitzgerald@jetsilk.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Woodlands"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"899"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">899</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">32953</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Carney"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Callahan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"724 Kimball Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Mangelica"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"carneycallahan@mangelica.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Tecolotito"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"902"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">902</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">13345</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hallie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Jarvis"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">23</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"237 Duryea Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Anixang"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"halliejarvis@anixang.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Boykin"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"IN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"907"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">907</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">12961</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Ingram"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"William"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">36</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"826 Overbaugh Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Genmex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"ingramwilliam@genmex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Kimmell"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"914"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">914</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">7120</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Esther"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Bean"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"583 Macon Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Applica"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"estherbean@applica.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Homeworth"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MN"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"919"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">919</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">39655</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Shauna"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hanson"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">27</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"557 Hart Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Exospace"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"shaunahanson@exospace.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Outlook"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"LA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"921"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">921</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49119</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Barbara"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Wade"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"687 Hoyts Lane"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Roughies"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"barbarawade@roughies.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Sattley"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"CO"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"926"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">926</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">49433</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Welch"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mcgowan"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"833 Quincy Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Atomica"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"welchmcgowan@atomica.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Hampstead"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"933"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">933</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">18071</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Tabitha"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Cole"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">21</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"916 Rogers Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Eclipto"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"tabithacole@eclipto.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Lawrence"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"TX"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"938"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">938</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">9597</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Sharron"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Santos"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">40</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"215 Matthews Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Zenco"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"sharronsantos@zenco.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Wattsville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VT"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"940"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">940</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23285</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Melinda"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Mendoza"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">38</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"806 Kossuth Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Kneedles"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"melindamendoza@kneedles.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Coaldale"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"OK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"945"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">945</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">23085</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Hansen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Hebert"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"287 Conduit Boulevard"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Capscreen"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"hansenhebert@capscreen.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Taycheedah"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AK"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"952"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">952</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21430</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Angelique"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Weeks"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">33</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"659 Reeve Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Exodoc"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"angeliqueweeks@exodoc.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Turpin"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MD"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"957"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">957</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">11373</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Michael"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Giles"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">31</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"668 Court Square"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Yogasm"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"michaelgiles@yogasm.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Rosburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"WV"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"964"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">964</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">26154</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Elena"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Waller"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"618 Crystal Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Insurety"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"elenawaller@insurety.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Gallina"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NY"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"969"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">969</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22214</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Briggs"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Lynn"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">30</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"952 Lester Court"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Quinex"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"briggslynn@quinex.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Roland"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"971"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">971</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">22772</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Gabrielle"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Reilly"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">32</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"964 Tudor Terrace"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Blanet"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"gabriellereilly@blanet.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Falmouth"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"AL"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"976"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">976</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">31707</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mullen"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Tanner"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">26</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"711 Whitney Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pulze"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mullentanner@pulze.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Mooresburg"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"MA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"983"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">983</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">47205</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Mattie"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Eaton"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">24</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"418 Allen Avenue"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Trasola"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"mattieeaton@trasola.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Dupuyer"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"NJ"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"988"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">988</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">17803</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Lucy"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Castro"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">34</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"F"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"425 Fleet Walk"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Geekfarm"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"lucycastro@geekfarm.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Mulino"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"VA"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"990"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">990</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">44456</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Kelly"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Steele"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">35</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"809 Hoyt Street"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Eschoir"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"kellysteele@eschoir.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Stewartville"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ID"</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"index"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"_id"</span><span class="punctuation">:</span><span class="string">"995"</span><span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">{</span><span class="attr">"account_number"</span><span class="punctuation">:</span><span class="number">995</span><span class="punctuation">,</span><span class="attr">"balance"</span><span class="punctuation">:</span><span class="number">21153</span><span class="punctuation">,</span><span class="attr">"firstname"</span><span class="punctuation">:</span><span class="string">"Phelps"</span><span class="punctuation">,</span><span class="attr">"lastname"</span><span class="punctuation">:</span><span class="string">"Parrish"</span><span class="punctuation">,</span><span class="attr">"age"</span><span class="punctuation">:</span><span class="number">25</span><span class="punctuation">,</span><span class="attr">"gender"</span><span class="punctuation">:</span><span class="string">"M"</span><span class="punctuation">,</span><span class="attr">"address"</span><span class="punctuation">:</span><span class="string">"666 Miller Place"</span><span class="punctuation">,</span><span class="attr">"employer"</span><span class="punctuation">:</span><span class="string">"Pearlessa"</span><span class="punctuation">,</span><span class="attr">"email"</span><span class="punctuation">:</span><span class="string">"phelpsparrish@pearlessa.com"</span><span class="punctuation">,</span><span class="attr">"city"</span><span class="punctuation">:</span><span class="string">"Brecon"</span><span class="punctuation">,</span><span class="attr">"state"</span><span class="punctuation">:</span><span class="string">"ME"</span><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230701155812781.png" alt="image-20230701155812781"></p>
|
||
<h1 id="四-进阶检索"><a href="#四-进阶检索" class="headerlink" title="四.进阶检索"></a>四.进阶检索</h1><h2 id="1-SearchAPI"><a href="#1-SearchAPI" class="headerlink" title="1.SearchAPI"></a>1.SearchAPI</h2><p>ES支持两种基本的方式检索:</p>
|
||
<ul>
|
||
<li>一个是通过使用REST request URI 发送搜索参数(uri+检索参数)</li>
|
||
<li>另一个是通过使用 REST request body来发送它们(uri+请求体)</li>
|
||
</ul>
|
||
<h3 id="1-1-检索信息"><a href="#1-1-检索信息" class="headerlink" title="1.1 检索信息"></a>1.1 检索信息</h3><p><strong>一切检索从_search开始</strong></p>
|
||
<h4 id="1-1-1-使用uri-检索参数的方式进行检索"><a href="#1-1-1-使用uri-检索参数的方式进行检索" class="headerlink" title="1.1.1 使用uri+检索参数的方式进行检索"></a>1.1.1 使用uri+检索参数的方式进行检索</h4><figure class="highlight json"><table><tr><td class="code"><pre><span class="line">GET bank/_search <span class="comment">//检索bank下所有信息,包含type和docs</span></span><br><span class="line">GET bank/_search?q=*&sort=account_number<span class="punctuation">:</span>asc <span class="comment">//请求参数方式检索</span></span><br><span class="line"><span class="comment">//q=*表示查询所有</span></span><br><span class="line"><span class="comment">//sort=account_number:asc 按照account_number进行升序排序</span></span><br><span class="line"><span class="comment">//相应的结果解析</span></span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"took"</span><span class="punctuation">:</span><span class="number">29</span><span class="punctuation">,</span><span class="comment">//执行搜索的时间</span></span><br><span class="line"> <span class="attr">"time_out"</span><span class="punctuation">:</span><span class="literal"><span class="keyword">false</span></span><span class="punctuation">,</span> <span class="comment">//搜索是否超时</span></span><br><span class="line"> <span class="attr">"_shards"</span><span class="punctuation">:</span><span class="punctuation">{</span>.....<span class="punctuation">}</span><span class="punctuation">,</span><span class="comment">//有多少个分片被搜索了,以及统计成功/失败的搜索分片</span></span><br><span class="line"> <span class="attr">"hits"</span><span class="punctuation">:</span><span class="punctuation">{</span>.......<span class="punctuation">}</span><span class="comment">//搜索的结果</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230701162247192.png" alt="image-20230701162247192"></p>
|
||
<p>完整的响应结果</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"took"</span> <span class="punctuation">:</span> <span class="number">29</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"timed_out"</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">"_shards"</span> <span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"total"</span> <span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"successful"</span> <span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skipped"</span> <span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"failed"</span> <span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"hits"</span> <span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"total"</span> <span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"value"</span> <span class="punctuation">:</span> <span class="number">1000</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"relation"</span> <span class="punctuation">:</span> <span class="string">"eq"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"max_score"</span> <span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"hits"</span> <span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"_index"</span> <span class="punctuation">:</span> <span class="string">"bank"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_type"</span> <span class="punctuation">:</span> <span class="string">"account"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_id"</span> <span class="punctuation">:</span> <span class="string">"0"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_score"</span> <span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_source"</span> <span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"account_number"</span> <span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"balance"</span> <span class="punctuation">:</span> <span class="number">16623</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"firstname"</span> <span class="punctuation">:</span> <span class="string">"Bradshaw"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"lastname"</span> <span class="punctuation">:</span> <span class="string">"Mckenzie"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"age"</span> <span class="punctuation">:</span> <span class="number">29</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"gender"</span> <span class="punctuation">:</span> <span class="string">"F"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"address"</span> <span class="punctuation">:</span> <span class="string">"244 Columbus Place"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"employer"</span> <span class="punctuation">:</span> <span class="string">"Euron"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"email"</span> <span class="punctuation">:</span> <span class="string">"bradshawmckenzie@euron.com"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"city"</span> <span class="punctuation">:</span> <span class="string">"Hobucken"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"state"</span> <span class="punctuation">:</span> <span class="string">"CO"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span> <span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"_index"</span> <span class="punctuation">:</span> <span class="string">"bank"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_type"</span> <span class="punctuation">:</span> <span class="string">"account"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_id"</span> <span class="punctuation">:</span> <span class="string">"1"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_score"</span> <span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_source"</span> <span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"account_number"</span> <span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"balance"</span> <span class="punctuation">:</span> <span class="number">39225</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"firstname"</span> <span class="punctuation">:</span> <span class="string">"Amber"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"lastname"</span> <span class="punctuation">:</span> <span class="string">"Duke"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"age"</span> <span class="punctuation">:</span> <span class="number">32</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"gender"</span> <span class="punctuation">:</span> <span class="string">"M"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"address"</span> <span class="punctuation">:</span> <span class="string">"880 Holmes Lane"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"employer"</span> <span class="punctuation">:</span> <span class="string">"Pyrami"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"email"</span> <span class="punctuation">:</span> <span class="string">"amberduke@pyrami.com"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"city"</span> <span class="punctuation">:</span> <span class="string">"Brogan"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"state"</span> <span class="punctuation">:</span> <span class="string">"IL"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span> <span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"_index"</span> <span class="punctuation">:</span> <span class="string">"bank"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_type"</span> <span class="punctuation">:</span> <span class="string">"account"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_id"</span> <span class="punctuation">:</span> <span class="string">"2"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_score"</span> <span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_source"</span> <span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"account_number"</span> <span class="punctuation">:</span> <span class="number">2</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"balance"</span> <span class="punctuation">:</span> <span class="number">28838</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"firstname"</span> <span class="punctuation">:</span> <span class="string">"Roberta"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"lastname"</span> <span class="punctuation">:</span> <span class="string">"Bender"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"age"</span> <span class="punctuation">:</span> <span class="number">22</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"gender"</span> <span class="punctuation">:</span> <span class="string">"F"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"address"</span> <span class="punctuation">:</span> <span class="string">"560 Kingsway Place"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"employer"</span> <span class="punctuation">:</span> <span class="string">"Chillium"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"email"</span> <span class="punctuation">:</span> <span class="string">"robertabender@chillium.com"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"city"</span> <span class="punctuation">:</span> <span class="string">"Bennett"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"state"</span> <span class="punctuation">:</span> <span class="string">"LA"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span> <span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="number">2</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"_index"</span> <span class="punctuation">:</span> <span class="string">"bank"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_type"</span> <span class="punctuation">:</span> <span class="string">"account"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_id"</span> <span class="punctuation">:</span> <span class="string">"3"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_score"</span> <span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_source"</span> <span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"account_number"</span> <span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"balance"</span> <span class="punctuation">:</span> <span class="number">44947</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"firstname"</span> <span class="punctuation">:</span> <span class="string">"Levine"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"lastname"</span> <span class="punctuation">:</span> <span class="string">"Burks"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"age"</span> <span class="punctuation">:</span> <span class="number">26</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"gender"</span> <span class="punctuation">:</span> <span class="string">"F"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"address"</span> <span class="punctuation">:</span> <span class="string">"328 Wilson Avenue"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"employer"</span> <span class="punctuation">:</span> <span class="string">"Amtap"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"email"</span> <span class="punctuation">:</span> <span class="string">"levineburks@amtap.com"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"city"</span> <span class="punctuation">:</span> <span class="string">"Cochranville"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"state"</span> <span class="punctuation">:</span> <span class="string">"HI"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span> <span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="number">3</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"_index"</span> <span class="punctuation">:</span> <span class="string">"bank"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_type"</span> <span class="punctuation">:</span> <span class="string">"account"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_id"</span> <span class="punctuation">:</span> <span class="string">"4"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_score"</span> <span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_source"</span> <span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"account_number"</span> <span class="punctuation">:</span> <span class="number">4</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"balance"</span> <span class="punctuation">:</span> <span class="number">27658</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"firstname"</span> <span class="punctuation">:</span> <span class="string">"Rodriquez"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"lastname"</span> <span class="punctuation">:</span> <span class="string">"Flores"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"age"</span> <span class="punctuation">:</span> <span class="number">31</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"gender"</span> <span class="punctuation">:</span> <span class="string">"F"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"address"</span> <span class="punctuation">:</span> <span class="string">"986 Wyckoff Avenue"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"employer"</span> <span class="punctuation">:</span> <span class="string">"Tourmania"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"email"</span> <span class="punctuation">:</span> <span class="string">"rodriquezflores@tourmania.com"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"city"</span> <span class="punctuation">:</span> <span class="string">"Eastvale"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"state"</span> <span class="punctuation">:</span> <span class="string">"HI"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span> <span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="number">4</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"_index"</span> <span class="punctuation">:</span> <span class="string">"bank"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_type"</span> <span class="punctuation">:</span> <span class="string">"account"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_id"</span> <span class="punctuation">:</span> <span class="string">"5"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_score"</span> <span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_source"</span> <span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"account_number"</span> <span class="punctuation">:</span> <span class="number">5</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"balance"</span> <span class="punctuation">:</span> <span class="number">29342</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"firstname"</span> <span class="punctuation">:</span> <span class="string">"Leola"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"lastname"</span> <span class="punctuation">:</span> <span class="string">"Stewart"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"age"</span> <span class="punctuation">:</span> <span class="number">30</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"gender"</span> <span class="punctuation">:</span> <span class="string">"F"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"address"</span> <span class="punctuation">:</span> <span class="string">"311 Elm Place"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"employer"</span> <span class="punctuation">:</span> <span class="string">"Diginetic"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"email"</span> <span class="punctuation">:</span> <span class="string">"leolastewart@diginetic.com"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"city"</span> <span class="punctuation">:</span> <span class="string">"Fairview"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"state"</span> <span class="punctuation">:</span> <span class="string">"NJ"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span> <span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="number">5</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"_index"</span> <span class="punctuation">:</span> <span class="string">"bank"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_type"</span> <span class="punctuation">:</span> <span class="string">"account"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_id"</span> <span class="punctuation">:</span> <span class="string">"6"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_score"</span> <span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_source"</span> <span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"account_number"</span> <span class="punctuation">:</span> <span class="number">6</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"balance"</span> <span class="punctuation">:</span> <span class="number">5686</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"firstname"</span> <span class="punctuation">:</span> <span class="string">"Hattie"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"lastname"</span> <span class="punctuation">:</span> <span class="string">"Bond"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"age"</span> <span class="punctuation">:</span> <span class="number">36</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"gender"</span> <span class="punctuation">:</span> <span class="string">"M"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"address"</span> <span class="punctuation">:</span> <span class="string">"671 Bristol Street"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"employer"</span> <span class="punctuation">:</span> <span class="string">"Netagy"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"email"</span> <span class="punctuation">:</span> <span class="string">"hattiebond@netagy.com"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"city"</span> <span class="punctuation">:</span> <span class="string">"Dante"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"state"</span> <span class="punctuation">:</span> <span class="string">"TN"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span> <span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="number">6</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"_index"</span> <span class="punctuation">:</span> <span class="string">"bank"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_type"</span> <span class="punctuation">:</span> <span class="string">"account"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_id"</span> <span class="punctuation">:</span> <span class="string">"7"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_score"</span> <span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_source"</span> <span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"account_number"</span> <span class="punctuation">:</span> <span class="number">7</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"balance"</span> <span class="punctuation">:</span> <span class="number">39121</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"firstname"</span> <span class="punctuation">:</span> <span class="string">"Levy"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"lastname"</span> <span class="punctuation">:</span> <span class="string">"Richard"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"age"</span> <span class="punctuation">:</span> <span class="number">22</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"gender"</span> <span class="punctuation">:</span> <span class="string">"M"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"address"</span> <span class="punctuation">:</span> <span class="string">"820 Logan Street"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"employer"</span> <span class="punctuation">:</span> <span class="string">"Teraprene"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"email"</span> <span class="punctuation">:</span> <span class="string">"levyrichard@teraprene.com"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"city"</span> <span class="punctuation">:</span> <span class="string">"Shrewsbury"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"state"</span> <span class="punctuation">:</span> <span class="string">"MO"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span> <span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="number">7</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"_index"</span> <span class="punctuation">:</span> <span class="string">"bank"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_type"</span> <span class="punctuation">:</span> <span class="string">"account"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_id"</span> <span class="punctuation">:</span> <span class="string">"8"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_score"</span> <span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_source"</span> <span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"account_number"</span> <span class="punctuation">:</span> <span class="number">8</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"balance"</span> <span class="punctuation">:</span> <span class="number">48868</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"firstname"</span> <span class="punctuation">:</span> <span class="string">"Jan"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"lastname"</span> <span class="punctuation">:</span> <span class="string">"Burns"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"age"</span> <span class="punctuation">:</span> <span class="number">35</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"gender"</span> <span class="punctuation">:</span> <span class="string">"M"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"address"</span> <span class="punctuation">:</span> <span class="string">"699 Visitation Place"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"employer"</span> <span class="punctuation">:</span> <span class="string">"Glasstep"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"email"</span> <span class="punctuation">:</span> <span class="string">"janburns@glasstep.com"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"city"</span> <span class="punctuation">:</span> <span class="string">"Wakulla"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"state"</span> <span class="punctuation">:</span> <span class="string">"AZ"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span> <span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="number">8</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"_index"</span> <span class="punctuation">:</span> <span class="string">"bank"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_type"</span> <span class="punctuation">:</span> <span class="string">"account"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_id"</span> <span class="punctuation">:</span> <span class="string">"9"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_score"</span> <span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"_source"</span> <span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"account_number"</span> <span class="punctuation">:</span> <span class="number">9</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"balance"</span> <span class="punctuation">:</span> <span class="number">24776</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"firstname"</span> <span class="punctuation">:</span> <span class="string">"Opal"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"lastname"</span> <span class="punctuation">:</span> <span class="string">"Meadows"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"age"</span> <span class="punctuation">:</span> <span class="number">39</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"gender"</span> <span class="punctuation">:</span> <span class="string">"M"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"address"</span> <span class="punctuation">:</span> <span class="string">"963 Neptune Avenue"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"employer"</span> <span class="punctuation">:</span> <span class="string">"Cedward"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"email"</span> <span class="punctuation">:</span> <span class="string">"opalmeadows@cedward.com"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"city"</span> <span class="punctuation">:</span> <span class="string">"Olney"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"state"</span> <span class="punctuation">:</span> <span class="string">"OH"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span> <span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="number">9</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="1-1-2-使用uri-请求体的方式进行检索"><a href="#1-1-2-使用uri-请求体的方式进行检索" class="headerlink" title="1.1.2 使用uri+请求体的方式进行检索"></a>1.1.2 使用uri+请求体的方式进行检索</h4><figure class="highlight json"><table><tr><td class="code"><pre><span class="line">GET /bank/_search </span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"query"</span><span class="punctuation">:</span> <span class="punctuation">{</span> </span><br><span class="line"> <span class="attr">"match_all"</span><span class="punctuation">:</span> <span class="punctuation">{</span><span class="punctuation">}</span> <span class="comment">//查询所有(匹配条件)</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="comment">//排序规则</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"account_number"</span><span class="punctuation">:</span> <span class="string">"asc"</span><span class="comment">//根据account_number升序</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span> </span><br><span class="line"> <span class="attr">"balance"</span><span class="punctuation">:</span><span class="string">"desc"</span> <span class="comment">//根据balance降序</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230701163210869.png" alt="image-20230701163210869"></p>
|
||
<h2 id="2-Query-DSL"><a href="#2-Query-DSL" class="headerlink" title="2.Query DSL"></a>2.Query DSL</h2><h3 id="2-1-基本的语法"><a href="#2-1-基本的语法" class="headerlink" title="2.1 基本的语法"></a>2.1 基本的语法</h3><figure class="highlight json"><table><tr><td class="code"><pre><span class="line">GET /bank/_search</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"query"</span><span class="punctuation">:</span> <span class="punctuation">{</span> <span class="comment">//查询操作</span></span><br><span class="line"> <span class="attr">"match_all"</span><span class="punctuation">:</span> <span class="punctuation">{</span><span class="punctuation">}</span> <span class="comment">//查询的条件 </span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span><span class="punctuation">:</span> <span class="punctuation">[</span> <span class="comment">//排序的条件(数组,可以指定多个排序规则)</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"balance"</span><span class="punctuation">:</span> <span class="punctuation">{</span> <span class="comment">//排序的字段</span></span><br><span class="line"> <span class="attr">"order"</span><span class="punctuation">:</span> <span class="string">"desc"</span> <span class="comment">//排序的规则(升序或者降序)</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"from"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span><span class="comment">//分页字段,从第几页开始</span></span><br><span class="line"> <span class="attr">"size"</span><span class="punctuation">:</span> <span class="number">5</span><span class="punctuation">,</span><span class="comment">//每页的记录数</span></span><br><span class="line"> <span class="attr">"_source"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="string">"balance"</span><span class="punctuation">,</span><span class="string">"firstname"</span><span class="punctuation">]</span> <span class="comment">//返回指定的字段</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-2-match查询-匹配查询"><a href="#2-2-match查询-匹配查询" class="headerlink" title="2.2 match查询[匹配查询]"></a>2.2 match查询[匹配查询]</h3><p><strong>根据某个字段的值进行匹配查询</strong></p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="comment">//查询account_number是20的数据</span></span><br><span class="line">GET /bank/_search</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"query"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"match"</span><span class="punctuation">:</span> <span class="punctuation">{</span> <span class="comment">//查询account_number是20的数据</span></span><br><span class="line"> <span class="attr">"account_number"</span><span class="punctuation">:</span> <span class="string">"20"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>模糊匹配</strong></p>
|
||
<p>对检索的条件进行分词匹配,按照评分的进行排序</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="comment">//查询地址中包含mill或者lane或者mill lane的数据</span></span><br><span class="line">GET /bank/_search</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"query"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"match"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"address"</span><span class="punctuation">:</span> <span class="string">"Mill lane"</span> <span class="comment">//查询地址中包含Mill或者lane中一个或者多个的数据,然后按照命中的评分排序</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-3-match-phrase-短语匹配"><a href="#2-3-match-phrase-短语匹配" class="headerlink" title="2.3 match_phrase[短语匹配]"></a>2.3 match_phrase[短语匹配]</h3><p>匹配的短语不分割进行匹配,一整个进行匹配</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="comment">//查询地址中包含Mill lane短语的数据</span></span><br><span class="line">GET /bank/_search</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"query"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"match_phrase"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"address"</span><span class="punctuation">:</span> <span class="string">"Mill lane"</span> <span class="comment">//查询包含整个Mill lane的数据</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-4-multi-match-多字段匹配"><a href="#2-4-multi-match-多字段匹配" class="headerlink" title="2.4 multi_match[多字段匹配]"></a>2.4 multi_match[多字段匹配]</h3><figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="comment">//查询state和address中包含mill的数据</span></span><br><span class="line">GET /bank/_search</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"query"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"multi_match"</span><span class="punctuation">:</span> <span class="punctuation">{</span> <span class="comment">//查询在state或者在address字段中包含mill的数据</span></span><br><span class="line"> <span class="attr">"query"</span><span class="punctuation">:</span> <span class="string">"mill"</span><span class="punctuation">,</span><span class="comment">//多字段匹配在查询的时候也会分词进行匹配</span></span><br><span class="line"> <span class="attr">"fields"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="string">"state"</span><span class="punctuation">,</span><span class="string">"address"</span><span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-5-bool-复合查询"><a href="#2-5-bool-复合查询" class="headerlink" title="2.5 bool[复合查询]"></a>2.5 bool[复合查询]</h3><figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="comment">//查询性别是M和地址中包含mill并且年龄不是28,lastname最好是Hines的数据</span></span><br><span class="line">GET /bank/_search</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"query"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"bool"</span><span class="punctuation">:</span> <span class="punctuation">{</span> <span class="comment">//多条件复合查询</span></span><br><span class="line"> <span class="attr">"must"</span><span class="punctuation">:</span> <span class="punctuation">[</span> <span class="comment">//必须符合的条件</span></span><br><span class="line"> <span class="punctuation">{</span><span class="attr">"match"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"gender"</span><span class="punctuation">:</span> <span class="string">"M"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span><span class="attr">"match"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"address"</span><span class="punctuation">:</span> <span class="string">"mill"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"must_not"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="comment">//必须不符合的条件</span></span><br><span class="line"> <span class="punctuation">{</span><span class="attr">"match"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"age"</span><span class="punctuation">:</span> <span class="string">"38"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"should"</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span><span class="attr">"match"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"lastname"</span><span class="punctuation">:</span> <span class="string">"Hines"</span> <span class="comment">//最好lastname是Hines,满足这个条件的得分会高一些</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-6-Filter-结果过滤"><a href="#2-6-Filter-结果过滤" class="headerlink" title="2.6 Filter[结果过滤]"></a>2.6 Filter[结果过滤]</h3><p><strong>使用Filter进行检索相比上面的检索,不会影响过滤结果的得分</strong>(上面的检索都可以通过Filter实现)</p>
|
||
<p>举例:未使用filter的查询:</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="comment">//查询年龄在18-20之间的所有数据</span></span><br><span class="line">GET /bank/_search</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"query"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"bool"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"must"</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span><span class="attr">"range"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"age"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"gte"</span><span class="punctuation">:</span> <span class="number">18</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"lte"</span><span class="punctuation">:</span> <span class="number">30</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>有得分的变化</p>
|
||
<p><img src="/pictures/image-20230702111451660.png" alt="image-20230702111451660"></p>
|
||
<p>使用了Filter的查询:</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line">GET /bank/_search</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"query"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"bool"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"filter"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"range"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"age"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"gte"</span><span class="punctuation">:</span> <span class="number">18</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"lte"</span><span class="punctuation">:</span> <span class="number">30</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>没有得分的变化</p>
|
||
<p><img src="/pictures/image-20230702111554667.png" alt="image-20230702111554667"></p>
|
||
<p><strong>Filter可以和上面的检索条件一起使用</strong></p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line">GET /bank/_search</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"query"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> </span><br><span class="line"> <span class="attr">"bool"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> </span><br><span class="line"> <span class="attr">"must"</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span><span class="attr">"match"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"gender"</span><span class="punctuation">:</span> <span class="string">"M"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span><span class="attr">"match"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"address"</span><span class="punctuation">:</span> <span class="string">"mill"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> </span><br><span class="line"> <span class="attr">"must_not"</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span><span class="attr">"match"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"age"</span><span class="punctuation">:</span> <span class="string">"18"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> </span><br><span class="line"> <span class="attr">"should"</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span><span class="attr">"match"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"lastname"</span><span class="punctuation">:</span> <span class="string">"Wallace"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> </span><br><span class="line"> <span class="attr">"filter"</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span><span class="attr">"range"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"age"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"gte"</span><span class="punctuation">:</span> <span class="number">18</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"lte"</span><span class="punctuation">:</span> <span class="number">30</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-7-term"><a href="#2-7-term" class="headerlink" title="2.7 term"></a>2.7 term</h3><p>和match一样,匹配某个属性的值。全文检索字段用match,其他非text字段匹配用term(精确性字段推荐使用term,例如年龄,数量等)</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line">GET /bank/_search</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"query"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"term"</span><span class="punctuation">:</span> <span class="punctuation">{</span><span class="comment">//精确的使用term,全文检索字段用match</span></span><br><span class="line"> <span class="attr">"age"</span><span class="punctuation">:</span> <span class="string">"28"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-8-aggregations-执行聚合"><a href="#2-8-aggregations-执行聚合" class="headerlink" title="2.8 aggregations[执行聚合]"></a>2.8 aggregations[执行聚合]</h3><p>聚合提供了从数据中分组和提取数据的能力.类似于MySql中的Group by函数</p>
|
||
<p><strong>搜索address中包含mill的所有人的年龄分布以及平均年龄</strong></p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="comment">//搜索address中包含mill的所有人的年龄分布以及平均年龄</span></span><br><span class="line">GET /bank/_search</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"query"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"match"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"address"</span><span class="punctuation">:</span> <span class="string">"mill"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"aggs"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"ageAgg"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"terms"</span><span class="punctuation">:</span> <span class="punctuation">{</span><span class="comment">//查看年龄的分布情况</span></span><br><span class="line"> <span class="attr">"field"</span><span class="punctuation">:</span> <span class="string">"age"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"size"</span><span class="punctuation">:</span> <span class="number">10</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"ageAvg"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="comment">//年龄平均值</span></span><br><span class="line"> <span class="attr">"avg"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"field"</span><span class="punctuation">:</span> <span class="string">"age"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"balanceAvg"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="comment">//工资的平均值</span></span><br><span class="line"> <span class="attr">"avg"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"field"</span><span class="punctuation">:</span> <span class="string">"balance"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230703101958163.png" alt="image-20230703101958163"></p>
|
||
<p><strong>按照年龄聚合,并且获取这些年龄段的这些人的平均薪资[子聚合]</strong></p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="comment">//按照年龄聚合,并且获取这些年龄段的这些人的平均薪资</span></span><br><span class="line">GET /bank/_search</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"query"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"match_all"</span><span class="punctuation">:</span> <span class="punctuation">{</span><span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"aggs"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"ageAgg"</span><span class="punctuation">:</span> <span class="punctuation">{</span><span class="comment">//年龄段的聚合</span></span><br><span class="line"> <span class="attr">"terms"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"field"</span><span class="punctuation">:</span> <span class="string">"age"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"size"</span><span class="punctuation">:</span> <span class="number">100</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"aggs"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"ageAvg"</span><span class="punctuation">:</span> <span class="punctuation">{</span><span class="comment">//年龄段的聚合里面嵌套一个求年龄平均值的聚合</span></span><br><span class="line"> <span class="attr">"avg"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"field"</span><span class="punctuation">:</span> <span class="string">"balance"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230703102805047.png" alt="image-20230703102805047"></p>
|
||
<p><strong>查询所有年龄分布,并且这些年龄段中男的平均工资和女的平均工资以及这个年龄段的总体平均薪资</strong></p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line">GET /bank/_search</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"query"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"match_all"</span><span class="punctuation">:</span> <span class="punctuation">{</span><span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"aggs"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"avgAgg"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"terms"</span><span class="punctuation">:</span> <span class="punctuation">{</span><span class="comment">//根据年龄进行分段</span></span><br><span class="line"> <span class="attr">"field"</span><span class="punctuation">:</span> <span class="string">"age"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"size"</span><span class="punctuation">:</span> <span class="number">100</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"aggs"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"genderAgg"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"terms"</span><span class="punctuation">:</span> <span class="punctuation">{</span><span class="comment">//根据性别进行分段</span></span><br><span class="line"> <span class="attr">"field"</span><span class="punctuation">:</span> <span class="string">"gender.keyword"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"aggs"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"balanceAvg"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"avg"</span><span class="punctuation">:</span> <span class="punctuation">{</span><span class="comment">//求出每个年龄段对应的不同性别的平均工资</span></span><br><span class="line"> <span class="attr">"field"</span><span class="punctuation">:</span> <span class="string">"balance"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"ageBalanceAvg"</span><span class="punctuation">:</span> <span class="punctuation">{</span><span class="comment">//计算每个年龄段对应的平均工资</span></span><br><span class="line"> <span class="attr">"avg"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"field"</span><span class="punctuation">:</span> <span class="string">"balance"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230703105247964.png" alt="image-20230703105247964"></p>
|
||
<h2 id="3-Mapping"><a href="#3-Mapping" class="headerlink" title="3.Mapping"></a>3.Mapping</h2><p><strong>指定ES中数据的数据类型</strong></p>
|
||
<h3 id="3-1-创建映射"><a href="#3-1-创建映射" class="headerlink" title="3.1 创建映射"></a>3.1 创建映射</h3><p>在创建索引的时候我们可以指定属性名的数据类型</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line">##创建一个新的索引<span class="punctuation">,</span>指定索引下字段的映射关系</span><br><span class="line">PUT /my_index</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"mappings"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"properties"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"age"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"integer"</span><span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"email"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"keyword"</span><span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span><span class="punctuation">{</span><span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"text"</span><span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230703112342368.png" alt="image-20230703112342368"></p>
|
||
<h3 id="3-2-添加新的映射"><a href="#3-2-添加新的映射" class="headerlink" title="3.2 添加新的映射"></a>3.2 添加新的映射</h3><figure class="highlight json"><table><tr><td class="code"><pre><span class="line">##添加一个映射</span><br><span class="line">PUT /my_index/_mapping</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"properties"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"employee-id"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"keyword"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"index"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span> <span class="comment">//表示这个字段不参与检索</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230703113121234.png" alt="image-20230703113121234"></p>
|
||
<h3 id="3-3-更新映射"><a href="#3-3-更新映射" class="headerlink" title="3.3 更新映射"></a>3.3 更新映射</h3><p>对于已经存在的映射字段,我们不能更新,更新必须创建新的索引进行数据迁移</p>
|
||
<h3 id="3-4-数据迁移"><a href="#3-4-数据迁移" class="headerlink" title="3.4 数据迁移"></a>3.4 数据迁移</h3><p>1.创建一个新的索引并指定映射</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line">PUT /new_bank</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"mappings"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"properties"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"account_number"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"long"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"address"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"text"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"age"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"integer"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"balance"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"long"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"city"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"keyword"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"email"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"keyword"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"employer"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"keyword"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"firstname"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"text"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"gender"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"keyword"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"lastname"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"keyword"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"state"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"keyword"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.数据迁移</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="comment">//新版本的写法(6.0以后)</span></span><br><span class="line">POST _reindex</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"source"</span><span class="punctuation">:</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"index"</span><span class="punctuation">:</span><span class="string">"twitter"</span> <span class="comment">//老的索引</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"dest"</span><span class="punctuation">:</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"index"</span><span class="punctuation">:</span><span class="string">"new_twitter"</span> <span class="comment">//新的索引</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br><span class="line"><span class="comment">//旧版本需要指定数据类型</span></span><br><span class="line">#数据迁移</span><br><span class="line">POST _reindex</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"source"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"index"</span><span class="punctuation">:</span> <span class="string">"bank"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"account"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"dest"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"index"</span><span class="punctuation">:</span> <span class="string">"new_bank"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230703115140810.png" alt="image-20230703115140810"></p>
|
||
<h2 id="4-分词"><a href="#4-分词" class="headerlink" title="4.分词"></a>4.分词</h2><h3 id="4-1-安装分词器"><a href="#4-1-安装分词器" class="headerlink" title="4.1 安装分词器"></a>4.1 安装分词器</h3><p>安装地址: <a href="https://github.com/medcl/elasticsearch-analysis-ik">https://github.com/medcl/elasticsearch-analysis-ik</a></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">切换到es挂载在注解的plugins目录</span></span><br><span class="line">cd /mydata/elasticsearch/plugins/</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">安装wget</span></span><br><span class="line">yum install wget </span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">下载ik分词器的压缩包(下载的速度不是很快(5分钟左右),建议本地下载好了之后,上传上去)</span></span><br><span class="line">wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.4.2/elasticsearch-analysis-ik-7.4.2.zip</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">进入容器内部查看一下文件是否同步到了容器的内部</span></span><br><span class="line">docker exec -it 容器Id /bin/bash</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">切换到plugins目录中去,这时目录中也存在elasticsearch-analysis-ik-7.4.2.zip这个压缩包</span></span><br><span class="line">cd plugins/ #使用ls查看一下</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 class="language-bash">在主机下解压elasticsearch-analysis-ik-7.4.2.zip这个压缩包</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">zip的解压需要使用unzip解压命令 这里我们直接在本地解压一下 上传到plugins目录(解压的文件名为ik)</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">安装unzip</span></span><br><span class="line">yum install -y unzip</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看ik分词器是否安装成功</span></span><br><span class="line">docker exec -it 容器Id /bin/bash</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">切换到bin目录</span></span><br><span class="line">cd bin/</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">执行下面的命令,有ik显示即为安装成功</span></span><br><span class="line">elasticsearch-plugin list</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">退出容器,重启一下</span></span><br><span class="line">docker restart elasticsearch</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>测试使用</p>
|
||
<p><img src="/pictures/image-20230703152110823.png" alt="image-20230703152110823"></p>
|
||
<h3 id="4-2-自定义词库"><a href="#4-2-自定义词库" class="headerlink" title="4.2 自定义词库"></a>4.2 自定义词库</h3><p>1.安装nginx,用作设置ik的远程分词库</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">创建nginx容器挂载的目录</span></span><br><span class="line">mkdir /mydata/nginx/conf</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">拉取nginx的镜像</span></span><br><span class="line">docker pull nginx:1.10</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">随便启动一个nginx实例,为了复制其配置</span></span><br><span class="line">docker run -p 80:80 --name nginx -d nginx:1.10</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">将容器内的配置文件拷贝到conf目录(注意这里有个点和空格)</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">注意在nginx的目录下操作,(成功之后/mydata/nginx/conf目录下会有相应的配置文件和目录)</span></span><br><span class="line">docker container cp nginx:/etc/nginx /mydata/nginx/conf</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">停掉并删除之前的启动的nginx</span></span><br><span class="line">docker stop nginx</span><br><span class="line">docker rm nginx</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">正式的启动容器</span></span><br><span class="line">docker run -p 80:80 --name nginx \</span><br><span class="line">-v /mydata/nginx/html:/usr/share/nginx/html \</span><br><span class="line">-v /mydata/nginx/logs:/var/log/nginx \</span><br><span class="line">-v /mydata/nginx/conf:/etc/nginx \</span><br><span class="line">-d nginx:1.10</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">设置开机自启</span></span><br><span class="line">docker update nginx --restart=always</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.配置自定义的词库</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">在nginx外部挂载的html目录下创建相应的目录</span></span><br><span class="line">mkdir es</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">创建分词需要使用的文本文件</span></span><br><span class="line">vim fenci.txt</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">例如:奥里给 老铁之类的</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">在浏览器上可以通过http://192.168.195.100/es/fenci.txt访问到里面的内容</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3.配置es远程词库的地址</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">切换到ik分词器配置文件所在的目录</span></span><br><span class="line">cd elasticsearch/plugins/ik/config/</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">修改配置文件,设置远程分词库的地址</span></span><br><span class="line">vim IKAnalyzer.cfg.xml</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230703170719714.png" alt="image-20230703170719714"></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">重启es</span></span><br><span class="line">docker restart elasticsearch</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>4.测试一下(这时我们使用网络中新颖的词就可以识别成一个词语)</p>
|
||
<p><img src="/pictures/image-20230703171420471.png" alt="image-20230703171420471"></p>
|
||
<h1 id="五-Elasticsearch-Rest-Client"><a href="#五-Elasticsearch-Rest-Client" class="headerlink" title="五.Elasticsearch-Rest-Client"></a>五.Elasticsearch-Rest-Client</h1><h2 id="1-环境配置"><a href="#1-环境配置" class="headerlink" title="1.环境配置"></a>1.环境配置</h2><p><strong>1.导入依赖</strong></p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!--指定版本--></span></span><br><span class="line"><span class="tag"><<span class="name">properties</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">elasticsearch.version</span>></span>7.4.2<span class="tag"></<span class="name">elasticsearch.version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">properties</span>></span></span><br><span class="line"><span class="comment"><!--ES的依赖--></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.elasticsearch.client<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>elasticsearch-rest-high-level-client<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>7.4.2<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>2.编写配置文件</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.apache.http.HttpHost;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.HttpResponse;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.nio.protocol.HttpAsyncResponseConsumer;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.client.HttpAsyncResponseConsumerFactory;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.client.RequestOptions;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.client.RestClient;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.client.RestHighLevelClient;</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="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/3</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">@Configuration</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ElasticSearchConfig</span> {</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">public</span> <span class="keyword">static</span> <span class="keyword">final</span> RequestOptions COMMON_OPTIONS;</span><br><span class="line"> <span class="keyword">static</span> {</span><br><span class="line"> RequestOptions.<span class="type">Builder</span> <span class="variable">builder</span> <span class="operator">=</span> RequestOptions.DEFAULT.toBuilder();</span><br><span class="line"></span><br><span class="line"> COMMON_OPTIONS = builder.build();</span><br><span class="line"> }</span><br><span class="line"></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> RestHighLevelClient <span class="title function_">esRestClient</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">RestHighLevelClient</span> <span class="variable">client</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">RestHighLevelClient</span>(</span><br><span class="line"> RestClient.builder(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">HttpHost</span>(<span class="string">"192.168.195.100"</span>, <span class="number">9200</span>, <span class="string">"http"</span>)</span><br><span class="line"> )</span><br><span class="line"> );</span><br><span class="line"> <span class="keyword">return</span> client;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>3.测试使用</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.gulimall.search;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.client.RestHighLevelClient;</span><br><span class="line"><span class="keyword">import</span> org.junit.jupiter.api.AfterAll;</span><br><span class="line"><span class="keyword">import</span> org.junit.jupiter.api.Test;</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.boot.test.context.SpringBootTest;</span><br><span class="line"></span><br><span class="line"><span class="meta">@SpringBootTest</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">GulimallSearchApplicationTests</span> {</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> RestHighLevelClient client;</span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">contextLoads</span><span class="params">()</span> {</span><br><span class="line"> System.out.println(client);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="2-代码操作ES"><a href="#2-代码操作ES" class="headerlink" title="2.代码操作ES"></a>2.代码操作ES</h2><h3 id="2-1-创建索引"><a href="#2-1-创建索引" class="headerlink" title="2.1 创建索引"></a><strong>2.1 创建索引</strong></h3><figure class="highlight java"><table><tr><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">@Test</span></span><br><span class="line"><span class="keyword">void</span> <span class="title function_">testCreateIndex</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="type">CreateIndexRequest</span> <span class="variable">request</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">CreateIndexRequest</span>(<span class="string">"test_create"</span>);</span><br><span class="line"> <span class="type">CreateIndexResponse</span> <span class="variable">createIndexResponse</span> <span class="operator">=</span> client.indices().create(request, RequestOptions.DEFAULT);</span><br><span class="line"> log.info(<span class="string">"创建一个索引:{}"</span>,createIndexResponse);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-2-判断索引是否存在"><a href="#2-2-判断索引是否存在" class="headerlink" title="2.2 判断索引是否存在"></a><strong>2.2 判断索引是否存在</strong></h3><figure class="highlight java"><table><tr><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">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testExistIndex</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="type">GetIndexRequest</span> <span class="variable">request</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">GetIndexRequest</span>(<span class="string">"users"</span>);</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">exists</span> <span class="operator">=</span> client.indices().exists(request, RequestOptions.DEFAULT);</span><br><span class="line"> log.info(<span class="string">"索引是否存在:{}"</span>,exists);</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-3-删除索引"><a href="#2-3-删除索引" class="headerlink" title="2.3 删除索引"></a><strong>2.3 删除索引</strong></h3><figure class="highlight java"><table><tr><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">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testDeleteIndex</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="type">DeleteIndexRequest</span> <span class="variable">request</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">DeleteIndexRequest</span>(<span class="string">"test_create"</span>);</span><br><span class="line"> <span class="type">AcknowledgedResponse</span> <span class="variable">delete</span> <span class="operator">=</span> client.indices().delete(request, RequestOptions.DEFAULT);</span><br><span class="line"> System.out.println(delete.isAcknowledged());</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-4-保存文档"><a href="#2-4-保存文档" class="headerlink" title="2.4 保存文档"></a><strong>2.4 保存文档</strong></h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 测试向es中存储数据</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">@Test</span></span><br><span class="line"><span class="keyword">void</span> <span class="title function_">indexData</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="comment">//在users索引下存储数据</span></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>(<span class="string">"users"</span>);</span><br><span class="line"> <span class="comment">//存储的数据的id</span></span><br><span class="line"> indexRequest.id(<span class="string">"1"</span>);</span><br><span class="line"> <span class="comment">//第一种方式</span></span><br><span class="line"> <span class="comment">//indexRequest.source("userName","zhangSan","age",18,"gender","男");</span></span><br><span class="line"> <span class="comment">//第二种方式</span></span><br><span class="line"> <span class="type">User</span> <span class="variable">user</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"tom"</span>,<span class="string">"男"</span>,<span class="number">22</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">jsonString</span> <span class="operator">=</span> JSON.toJSONString(user);</span><br><span class="line"> indexRequest.source(jsonString, XContentType.JSON);</span><br><span class="line"> <span class="comment">//执行真正的保存操作</span></span><br><span class="line"> <span class="comment">//下面方法的第二个参数也可以使用这个参数GulimallElasticSearchConfig.COMMON_OPTIONS</span></span><br><span class="line"> <span class="type">IndexResponse</span> <span class="variable">index</span> <span class="operator">=</span> client.index(indexRequest, RequestOptions.DEFAULT);</span><br><span class="line"> log.info(<span class="string">"保存之后响应的数据:{}"</span>,index);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-5-判断文档是否存在"><a href="#2-5-判断文档是否存在" class="headerlink" title="2.5 判断文档是否存在"></a><strong>2.5 判断文档是否存在</strong></h3><figure class="highlight java"><table><tr><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">@Test</span></span><br><span class="line"><span class="keyword">void</span> <span class="title function_">testIsExists</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="type">GetRequest</span> <span class="variable">getRequest</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">GetRequest</span>(<span class="string">"users"</span>, <span class="string">"1"</span>);</span><br><span class="line"> getRequest.fetchSourceContext(<span class="keyword">new</span> <span class="title class_">FetchSourceContext</span>(<span class="literal">false</span>));</span><br><span class="line"> getRequest.storedFields(<span class="string">"_none_"</span>);</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">exists</span> <span class="operator">=</span> client.exists(getRequest, RequestOptions.DEFAULT);</span><br><span class="line"> System.out.println(exists);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-6-获取文档信息"><a href="#2-6-获取文档信息" class="headerlink" title="2.6 获取文档信息"></a><strong>2.6 获取文档信息</strong></h3><figure class="highlight java"><table><tr><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">@Test</span></span><br><span class="line"><span class="keyword">void</span> <span class="title function_">testGetDocument</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="type">GetRequest</span> <span class="variable">getRequest</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">GetRequest</span>(<span class="string">"users"</span>, <span class="string">"1"</span>);</span><br><span class="line"> <span class="type">GetResponse</span> <span class="variable">getResponse</span> <span class="operator">=</span> client.get(getRequest, RequestOptions.DEFAULT);</span><br><span class="line"> System.out.println(getResponse.getSourceAsString());</span><br><span class="line"> System.out.println(getResponse);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-7-修改文档信息"><a href="#2-7-修改文档信息" class="headerlink" title="2.7 修改文档信息"></a><strong>2.7 修改文档信息</strong></h3><figure class="highlight java"><table><tr><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">@Test</span></span><br><span class="line"><span class="keyword">void</span> <span class="title function_">testUpdateRequest</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="type">UpdateRequest</span> <span class="variable">updateRequest</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">UpdateRequest</span>(<span class="string">"users"</span>, <span class="string">"1"</span>);</span><br><span class="line"> updateRequest.timeout(<span class="string">"1s"</span>);</span><br><span class="line"> <span class="type">User</span> <span class="variable">user</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"修改之后的用户名"</span>, <span class="string">"男"</span>,<span class="number">23</span>);</span><br><span class="line"> updateRequest.doc(JSON.toJSONString(user), XContentType.JSON);</span><br><span class="line"> <span class="type">UpdateResponse</span> <span class="variable">updateResponse</span> <span class="operator">=</span> client.update(updateRequest, RequestOptions.DEFAULT);</span><br><span class="line"> System.out.println(updateResponse.status());</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-8-删除文档记录"><a href="#2-8-删除文档记录" class="headerlink" title="2.8 删除文档记录"></a><strong>2.8 删除文档记录</strong></h3><figure class="highlight java"><table><tr><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">@Test</span></span><br><span class="line"><span class="keyword">void</span> <span class="title function_">testDeleteRequest</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="type">DeleteRequest</span> <span class="variable">request</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">DeleteRequest</span>(<span class="string">"users"</span>, <span class="string">"1"</span>);</span><br><span class="line"> request.timeout(<span class="string">"1s"</span>);</span><br><span class="line"> <span class="type">DeleteResponse</span> <span class="variable">deleteResponse</span> <span class="operator">=</span> client.delete(request, RequestOptions.DEFAULT);</span><br><span class="line"> System.out.println(deleteResponse.status());</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-9-批量添加"><a href="#2-9-批量添加" class="headerlink" title="2.9 批量添加"></a><strong>2.9 批量添加</strong></h3><figure class="highlight java"><table><tr><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">@Test</span></span><br><span class="line"><span class="keyword">void</span> <span class="title function_">testBulkRequest</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</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"> bulkRequest.timeout(<span class="string">"10s"</span>);</span><br><span class="line"> ArrayList<User> userList = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> userList.add(<span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"A"</span>, <span class="string">"男"</span>,<span class="number">23</span>));</span><br><span class="line"> userList.add(<span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"B"</span>, <span class="string">"男"</span>,<span class="number">32</span>));</span><br><span class="line"> userList.add(<span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"C"</span>, <span class="string">"女"</span>,<span class="number">34</span>));</span><br><span class="line"> userList.add(<span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"D"</span>, <span class="string">"女"</span>,<span class="number">56</span>));</span><br><span class="line"> userList.add(<span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"E"</span>, <span class="string">"男"</span>,<span class="number">34</span>));</span><br><span class="line"> userList.add(<span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"F"</span>, <span class="string">"女"</span>,<span class="number">65</span>));</span><br><span class="line"> <span class="comment">// 批处理请求</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < userList.size(); i++) {</span><br><span class="line"> <span class="comment">// 批量更新和批量删除,就在这里修改对应的请求就可以了</span></span><br><span class="line"> bulkRequest.add(<span class="keyword">new</span> <span class="title class_">IndexRequest</span>(<span class="string">"users"</span>).id(<span class="string">""</span> + (i + <span class="number">1</span>))</span><br><span class="line"> .source(JSON.toJSONString(userList.get(i)), XContentType.JSON));</span><br><span class="line"> }</span><br><span class="line"> <span class="type">BulkResponse</span> <span class="variable">bulkResponse</span> <span class="operator">=</span> client.bulk(bulkRequest, RequestOptions.DEFAULT);</span><br><span class="line"> System.out.println(<span class="string">"是否批量添加成功:"</span>+!bulkResponse.hasFailures());</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-10-条件查询"><a href="#2-10-条件查询" class="headerlink" title="2.10 条件查询"></a><strong>2.10 条件查询</strong></h3><figure class="highlight java"><table><tr><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">@Test</span></span><br><span class="line"><span class="keyword">void</span> <span class="title function_">testSearchRequest</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="comment">//1.创建一个检索请求</span></span><br><span class="line"> <span class="type">SearchRequest</span> <span class="variable">searchRequest</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SearchRequest</span>();</span><br><span class="line"> <span class="comment">//设置检索的索引</span></span><br><span class="line"> searchRequest.indices(<span class="string">"bank"</span>);</span><br><span class="line"> <span class="comment">//指定DSL,检索条件</span></span><br><span class="line"> <span class="type">SearchSourceBuilder</span> <span class="variable">sourceBuilder</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SearchSourceBuilder</span>();</span><br><span class="line"> sourceBuilder.query(QueryBuilders.matchQuery(<span class="string">"address"</span>, <span class="string">"mill"</span>));<span class="comment">//查询地址中包含mill的数据</span></span><br><span class="line"> sourceBuilder.aggregation(AggregationBuilders.terms(<span class="string">"ageAgg"</span>).field(<span class="string">"age"</span>).size(<span class="number">10</span>));<span class="comment">//聚合名ageAgg,根据age字段聚合,只取10条</span></span><br><span class="line"> sourceBuilder.aggregation(AggregationBuilders.avg(<span class="string">"balanceAvg"</span>).field(<span class="string">"balance"</span>));<span class="comment">//求平均工资</span></span><br><span class="line"> System.out.println(<span class="string">"检索的条件:"</span> + sourceBuilder);</span><br><span class="line"> searchRequest.source(sourceBuilder);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//2.执行检索</span></span><br><span class="line"> <span class="type">SearchResponse</span> <span class="variable">searchResponse</span> <span class="operator">=</span> client.search(searchRequest, RequestOptions.DEFAULT);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//3.分析检索的结果</span></span><br><span class="line"> System.out.println(<span class="string">"查询到的数据:"</span> + searchResponse.toString());</span><br><span class="line"> <span class="comment">//Map map = JSON.parseObject(searchResponse.toString(), Map.class);//可以转换成一个map</span></span><br><span class="line"> <span class="type">SearchHits</span> <span class="variable">hits</span> <span class="operator">=</span> searchResponse.getHits();<span class="comment">//拿到命中的记录</span></span><br><span class="line"> <span class="keyword">for</span> (SearchHit hit : hits) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">index</span> <span class="operator">=</span> hit.getIndex();<span class="comment">//获取索引信息</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">type</span> <span class="operator">=</span> hit.getType();<span class="comment">//类型信息</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">id</span> <span class="operator">=</span> hit.getId();<span class="comment">//id信息</span></span><br><span class="line"> <span class="type">float</span> <span class="variable">score</span> <span class="operator">=</span> hit.getScore();<span class="comment">//得分信息</span></span><br><span class="line"> <span class="type">TimeValue</span> <span class="variable">took</span> <span class="operator">=</span> searchResponse.getTook();</span><br><span class="line"> <span class="type">String</span> <span class="variable">sourceAsString</span> <span class="operator">=</span> hit.getSourceAsString();<span class="comment">//直接转化成对应的java对象</span></span><br><span class="line"> <span class="comment">//转换成Account对象</span></span><br><span class="line"> <span class="type">Account</span> <span class="variable">account</span> <span class="operator">=</span> JSON.parseObject(sourceAsString, Account.class);</span><br><span class="line"> System.out.println(<span class="string">"Account:"</span> + account);</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="type">Aggregations</span> <span class="variable">aggregations</span> <span class="operator">=</span> searchResponse.getAggregations();</span><br><span class="line"> <span class="type">Terms</span> <span class="variable">ageAgg</span> <span class="operator">=</span> aggregations.get(<span class="string">"ageAgg"</span>);</span><br><span class="line"> <span class="keyword">for</span> (Terms.Bucket bucket : ageAgg.getBuckets()) {</span><br><span class="line"></span><br><span class="line"> System.out.println(<span class="string">"年龄:"</span> + bucket.getKeyAsString() + <span class="string">"有"</span> + bucket.getDocCount() + <span class="string">"人"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//获取薪资的平均值</span></span><br><span class="line"> <span class="type">Avg</span> <span class="variable">balanceAvg</span> <span class="operator">=</span> aggregations.get(<span class="string">"balanceAvg"</span>);</span><br><span class="line"> System.out.println(<span class="string">"平均薪资:"</span> + balanceAvg.getValue());</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>示例的完整代码</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.gulimall.search;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.alibaba.fastjson.JSON;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.gulimall.search.config.GulimallElasticSearchConfig;</span><br><span class="line"><span class="keyword">import</span> lombok.Data;</span><br><span class="line"><span class="keyword">import</span> lombok.ToString;</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.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.action.bulk.BulkRequest;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.action.bulk.BulkResponse;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.action.delete.DeleteRequest;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.action.delete.DeleteResponse;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.action.get.GetRequest;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.action.get.GetResponse;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.action.index.IndexRequest;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.action.index.IndexResponse;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.action.search.SearchRequest;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.action.search.SearchResponse;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.action.support.master.AcknowledgedResponse;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.action.update.UpdateRequest;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.action.update.UpdateResponse;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.client.RequestOptions;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.client.RestHighLevelClient;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.client.indices.CreateIndexRequest;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.client.indices.CreateIndexResponse;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.client.indices.GetIndexRequest;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.common.unit.TimeValue;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.common.xcontent.XContentType;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.index.query.QueryBuilders;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.search.SearchHit;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.search.SearchHits;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.search.aggregations.Aggregation;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.search.aggregations.AggregationBuilder;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.search.aggregations.AggregationBuilders;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.search.aggregations.Aggregations;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.search.aggregations.bucket.terms.Terms;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.search.aggregations.metrics.Avg;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.search.builder.SearchSourceBuilder;</span><br><span class="line"><span class="keyword">import</span> org.elasticsearch.search.fetch.subphase.FetchSourceContext;</span><br><span class="line"><span class="keyword">import</span> org.junit.jupiter.api.Test;</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.boot.test.context.SpringBootTest;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</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 class="keyword">import</span> java.util.Map;</span><br><span class="line"></span><br><span class="line"><span class="meta">@Slf4j</span></span><br><span class="line"><span class="meta">@SpringBootTest</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">GulimallSearchApplicationTests</span> {</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> RestHighLevelClient client;</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_">contextLoads</span><span class="params">()</span> {</span><br><span class="line"> System.out.println(client);</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"> * 测试向es中存储数据</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">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">indexData</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="comment">//在users索引下存储数据</span></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>(<span class="string">"users"</span>);</span><br><span class="line"> <span class="comment">//存储的数据的id</span></span><br><span class="line"> indexRequest.id(<span class="string">"1"</span>);</span><br><span class="line"> <span class="comment">//第一种方式</span></span><br><span class="line"> <span class="comment">//indexRequest.source("userName","zhangSan","age",18,"gender","男");</span></span><br><span class="line"> <span class="comment">//第二种方式</span></span><br><span class="line"> <span class="type">User</span> <span class="variable">user</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"tom"</span>, <span class="string">"男"</span>, <span class="number">22</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">jsonString</span> <span class="operator">=</span> JSON.toJSONString(user);</span><br><span class="line"> indexRequest.source(jsonString, XContentType.JSON);</span><br><span class="line"> <span class="comment">//执行真正的保存操作</span></span><br><span class="line"> <span class="comment">//下面方法的第二个参数也可以使用这个参数GulimallElasticSearchConfig.COMMON_OPTIONS</span></span><br><span class="line"> <span class="type">IndexResponse</span> <span class="variable">index</span> <span class="operator">=</span> client.index(indexRequest, RequestOptions.DEFAULT);</span><br><span class="line"> log.info(<span class="string">"保存之后响应的数据:{}"</span>, index);</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testExistIndex</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="type">GetIndexRequest</span> <span class="variable">request</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">GetIndexRequest</span>(<span class="string">"users"</span>);</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">exists</span> <span class="operator">=</span> client.indices().exists(request, RequestOptions.DEFAULT);</span><br><span class="line"> log.info(<span class="string">"索引是否存在:{}"</span>, exists);</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testCreateIndex</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="type">CreateIndexRequest</span> <span class="variable">request</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">CreateIndexRequest</span>(<span class="string">"test_create"</span>);</span><br><span class="line"> <span class="type">CreateIndexResponse</span> <span class="variable">createIndexResponse</span> <span class="operator">=</span> client.indices().create(request, RequestOptions.DEFAULT);</span><br><span class="line"> log.info(<span class="string">"创建一个索引:{}"</span>, createIndexResponse);</span><br><span class="line"> }</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testDeleteIndex</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="type">DeleteIndexRequest</span> <span class="variable">request</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">DeleteIndexRequest</span>(<span class="string">"users"</span>);</span><br><span class="line"> <span class="type">AcknowledgedResponse</span> <span class="variable">delete</span> <span class="operator">=</span> client.indices().delete(request, RequestOptions.DEFAULT);</span><br><span class="line"> System.out.println(delete.isAcknowledged());</span><br><span class="line"> }</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testIsExists</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="type">GetRequest</span> <span class="variable">getRequest</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">GetRequest</span>(<span class="string">"users"</span>, <span class="string">"1"</span>);</span><br><span class="line"> getRequest.fetchSourceContext(<span class="keyword">new</span> <span class="title class_">FetchSourceContext</span>(<span class="literal">false</span>));</span><br><span class="line"> getRequest.storedFields(<span class="string">"_none_"</span>);</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">exists</span> <span class="operator">=</span> client.exists(getRequest, RequestOptions.DEFAULT);</span><br><span class="line"> System.out.println(exists);</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testGetDocument</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="type">GetRequest</span> <span class="variable">getRequest</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">GetRequest</span>(<span class="string">"users"</span>, <span class="string">"1"</span>);</span><br><span class="line"> <span class="type">GetResponse</span> <span class="variable">getResponse</span> <span class="operator">=</span> client.get(getRequest, RequestOptions.DEFAULT);</span><br><span class="line"> System.out.println(getResponse.getSourceAsString());</span><br><span class="line"> System.out.println(getResponse);</span><br><span class="line"> }</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testUpdateRequest</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="type">UpdateRequest</span> <span class="variable">updateRequest</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">UpdateRequest</span>(<span class="string">"users"</span>, <span class="string">"1"</span>);</span><br><span class="line"> updateRequest.timeout(<span class="string">"1s"</span>);</span><br><span class="line"> <span class="type">User</span> <span class="variable">user</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"修改之后的用户名"</span>, <span class="string">"男"</span>, <span class="number">23</span>);</span><br><span class="line"> updateRequest.doc(JSON.toJSONString(user), XContentType.JSON);</span><br><span class="line"> <span class="type">UpdateResponse</span> <span class="variable">updateResponse</span> <span class="operator">=</span> client.update(updateRequest, RequestOptions.DEFAULT);</span><br><span class="line"> System.out.println(updateResponse.status());</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testDeleteRequest</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="type">DeleteRequest</span> <span class="variable">request</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">DeleteRequest</span>(<span class="string">"users"</span>, <span class="string">"1"</span>);</span><br><span class="line"> request.timeout(<span class="string">"1s"</span>);</span><br><span class="line"> <span class="type">DeleteResponse</span> <span class="variable">deleteResponse</span> <span class="operator">=</span> client.delete(request, RequestOptions.DEFAULT);</span><br><span class="line"> System.out.println(deleteResponse.status());</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testBulkRequest</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</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"> bulkRequest.timeout(<span class="string">"10s"</span>);</span><br><span class="line"> ArrayList<User> userList = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> userList.add(<span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"A"</span>, <span class="string">"男"</span>, <span class="number">23</span>));</span><br><span class="line"> userList.add(<span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"B"</span>, <span class="string">"男"</span>, <span class="number">32</span>));</span><br><span class="line"> userList.add(<span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"C"</span>, <span class="string">"女"</span>, <span class="number">34</span>));</span><br><span class="line"> userList.add(<span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"D"</span>, <span class="string">"女"</span>, <span class="number">56</span>));</span><br><span class="line"> userList.add(<span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"E"</span>, <span class="string">"男"</span>, <span class="number">34</span>));</span><br><span class="line"> userList.add(<span class="keyword">new</span> <span class="title class_">User</span>(<span class="string">"F"</span>, <span class="string">"女"</span>, <span class="number">65</span>));</span><br><span class="line"> <span class="comment">// 批处理请求</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < userList.size(); i++) {</span><br><span class="line"> <span class="comment">// 批量更新和批量删除,就在这里修改对应的请求就可以了</span></span><br><span class="line"> bulkRequest.add(<span class="keyword">new</span> <span class="title class_">IndexRequest</span>(<span class="string">"users"</span>).id(<span class="string">""</span> + (i + <span class="number">1</span>))</span><br><span class="line"> .source(JSON.toJSONString(userList.get(i)), XContentType.JSON));</span><br><span class="line"> }</span><br><span class="line"> <span class="type">BulkResponse</span> <span class="variable">bulkResponse</span> <span class="operator">=</span> client.bulk(bulkRequest, RequestOptions.DEFAULT);</span><br><span class="line"> System.out.println(<span class="string">"是否批量添加成功:"</span> + !bulkResponse.hasFailures());</span><br><span class="line"> }</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">void</span> <span class="title function_">testSearchRequest</span><span class="params">()</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="comment">//1.创建一个检索请求</span></span><br><span class="line"> <span class="type">SearchRequest</span> <span class="variable">searchRequest</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SearchRequest</span>();</span><br><span class="line"> <span class="comment">//设置检索的索引</span></span><br><span class="line"> searchRequest.indices(<span class="string">"bank"</span>);</span><br><span class="line"> <span class="comment">//指定DSL,检索条件</span></span><br><span class="line"> <span class="type">SearchSourceBuilder</span> <span class="variable">sourceBuilder</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SearchSourceBuilder</span>();</span><br><span class="line"> sourceBuilder.query(QueryBuilders.matchQuery(<span class="string">"address"</span>, <span class="string">"mill"</span>));<span class="comment">//查询地址中包含mill的数据</span></span><br><span class="line"> sourceBuilder.aggregation(AggregationBuilders.terms(<span class="string">"ageAgg"</span>).field(<span class="string">"age"</span>).size(<span class="number">10</span>));<span class="comment">//聚合名ageAgg,根据age字段聚合,只取10条</span></span><br><span class="line"> sourceBuilder.aggregation(AggregationBuilders.avg(<span class="string">"balanceAvg"</span>).field(<span class="string">"balance"</span>));<span class="comment">//求平均工资</span></span><br><span class="line"> System.out.println(<span class="string">"检索的条件:"</span> + sourceBuilder);</span><br><span class="line"> searchRequest.source(sourceBuilder);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//2.执行检索</span></span><br><span class="line"> <span class="type">SearchResponse</span> <span class="variable">searchResponse</span> <span class="operator">=</span> client.search(searchRequest, RequestOptions.DEFAULT);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//3.分析检索的结果</span></span><br><span class="line"> System.out.println(<span class="string">"查询到的数据:"</span> + searchResponse.toString());</span><br><span class="line"> <span class="comment">//Map map = JSON.parseObject(searchResponse.toString(), Map.class);//可以转换成一个map</span></span><br><span class="line"> <span class="type">SearchHits</span> <span class="variable">hits</span> <span class="operator">=</span> searchResponse.getHits();<span class="comment">//拿到命中的记录</span></span><br><span class="line"> <span class="keyword">for</span> (SearchHit hit : hits) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">index</span> <span class="operator">=</span> hit.getIndex();<span class="comment">//获取索引信息</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">type</span> <span class="operator">=</span> hit.getType();<span class="comment">//类型信息</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">id</span> <span class="operator">=</span> hit.getId();<span class="comment">//id信息</span></span><br><span class="line"> <span class="type">float</span> <span class="variable">score</span> <span class="operator">=</span> hit.getScore();<span class="comment">//得分信息</span></span><br><span class="line"> <span class="type">TimeValue</span> <span class="variable">took</span> <span class="operator">=</span> searchResponse.getTook();</span><br><span class="line"> <span class="type">String</span> <span class="variable">sourceAsString</span> <span class="operator">=</span> hit.getSourceAsString();<span class="comment">//直接转化成对应的java对象</span></span><br><span class="line"> <span class="comment">//转换成Account对象</span></span><br><span class="line"> <span class="type">Account</span> <span class="variable">account</span> <span class="operator">=</span> JSON.parseObject(sourceAsString, Account.class);</span><br><span class="line"> System.out.println(<span class="string">"Account:"</span> + account);</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="type">Aggregations</span> <span class="variable">aggregations</span> <span class="operator">=</span> searchResponse.getAggregations();</span><br><span class="line"> <span class="type">Terms</span> <span class="variable">ageAgg</span> <span class="operator">=</span> aggregations.get(<span class="string">"ageAgg"</span>);</span><br><span class="line"> <span class="keyword">for</span> (Terms.Bucket bucket : ageAgg.getBuckets()) {</span><br><span class="line"></span><br><span class="line"> System.out.println(<span class="string">"年龄:"</span> + bucket.getKeyAsString() + <span class="string">"有"</span> + bucket.getDocCount() + <span class="string">"人"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//获取薪资的平均值</span></span><br><span class="line"> <span class="type">Avg</span> <span class="variable">balanceAvg</span> <span class="operator">=</span> aggregations.get(<span class="string">"balanceAvg"</span>);</span><br><span class="line"> System.out.println(<span class="string">"平均薪资:"</span> + balanceAvg.getValue());</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@ToString</span></span><br><span class="line"> <span class="meta">@Data</span></span><br><span class="line"> <span class="keyword">static</span> <span class="keyword">class</span> <span class="title class_">Account</span> {</span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span> account_number;</span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span> balance;</span><br><span class="line"> <span class="keyword">private</span> String firstname;</span><br><span class="line"> <span class="keyword">private</span> String lastname;</span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span> age;</span><br><span class="line"> <span class="keyword">private</span> String gender;</span><br><span class="line"> <span class="keyword">private</span> String address;</span><br><span class="line"> <span class="keyword">private</span> String employer;</span><br><span class="line"> <span class="keyword">private</span> String email;</span><br><span class="line"> <span class="keyword">private</span> String city;</span><br><span class="line"> <span class="keyword">private</span> String state;</span><br><span class="line"> }</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">static</span> <span class="keyword">class</span> <span class="title class_">User</span> {</span><br><span class="line"> <span class="keyword">private</span> String userName;</span><br><span class="line"> <span class="keyword">private</span> String gender;</span><br><span class="line"> <span class="keyword">private</span> Integer age;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="title function_">User</span><span class="params">(String userName, String gender, Integer age)</span> {</span><br><span class="line"> <span class="built_in">this</span>.userName = userName;</span><br><span class="line"> <span class="built_in">this</span>.gender = gender;</span><br><span class="line"> <span class="built_in">this</span>.age = age;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>ElasticSearch</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>数据校验</title>
|
||
<url>/posts/27166.html</url>
|
||
<content><![CDATA[<p> 在前端接收数据和前端向后端传递数据的时候,都需要进行数据校验,避免传入错误的信息,比如在需要传入一个非空的值时,传入了一个空字符串,需要传入邮箱号码的时候,传入的非邮箱格式的数据。同时在写接口时经常要写效验请求参数逻辑,这时候我们会常用做法是写大量的 if 与 if else 类似这样的代码,大量if-else代码看起来比较混乱,降低了代码的可读性。</p>
|
||
<h2 id="一-JSR303数据校验"><a href="#一-JSR303数据校验" class="headerlink" title="一.JSR303数据校验"></a>一.JSR303数据校验</h2><h3 id="1-引入依赖"><a href="#1-引入依赖" class="headerlink" title="1.引入依赖"></a>1.引入依赖</h3><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.hibernate<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>hibernate-validator<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>6.0.7.Final<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-给实体类添加校验注解,并定义自己的message提示"><a href="#2-给实体类添加校验注解,并定义自己的message提示" class="headerlink" title="2.给实体类添加校验注解,并定义自己的message提示"></a>2.给实体类添加校验注解,并定义自己的message提示</h3><p><strong>常用的检验注解</strong></p>
|
||
<img src="/pictures/image-20230612170704286.png" alt="image-20230612170704286" style="zoom:150%;" />
|
||
|
||
<p><strong>示例</strong></p>
|
||
<figure class="highlight java"><table><tr><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.Min;</span><br><span class="line"><span class="keyword">import</span> javax.validation.constraints.NotBlank;</span><br><span class="line"><span class="keyword">import</span> javax.validation.constraints.NotEmpty;</span><br><span class="line"><span class="keyword">import</span> javax.validation.constraints.Pattern;</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("pms_brand")</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> {</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 = "品牌名必须提交")</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 class="comment">//既不能为空,也要符合URL的格式</span></span><br><span class="line"> <span class="meta">@URL(message = "logo必须是一个合法的URL地址")</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 = "^[a-zA-Z]$", message = "检索首字母必须是一个字母")</span><span class="comment">//正则表达式的校验,在java中使用正则的时候不需要/符号</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 class="comment">//Integer类型不为空,使用@NotNull不能使用@NotEmpty</span></span><br><span class="line"> <span class="meta">@Min(value = 0, message = "排序必须大于等于0")</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">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-开启校验功能-Valid"><a href="#3-开启校验功能-Valid" class="headerlink" title="3.开启校验功能@Valid"></a>3.开启校验功能@Valid</h3><figure class="highlight java"><table><tr><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">@Valid</span>注解开启校验</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> result 检验之后响应的结果信息</span></span><br><span class="line"><span class="comment"> * 给校验的bean后紧跟一个BindingResult,就可以获取到校验的结果</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@RequestMapping("/save")</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 class="comment">/*紧跟在需要校验的字段后面*/</span>)</span>{</span><br><span class="line"> <span class="keyword">if</span>(result.hasErrors()){<span class="comment">//判断有没有校验的错误</span></span><br><span class="line"> Map<String,String> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> <span class="comment">//获取检验的错误结果, result.getFieldErrors():校验出错的字段的集合</span></span><br><span class="line"> <span class="keyword">for</span> (FieldError fieldError : result.getFieldErrors()) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">defaultMessage</span> <span class="operator">=</span> fieldError.getDefaultMessage();<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 class="comment">//获取错误的属性(字段)的名字</span></span><br><span class="line"> <span class="comment">//封装在一个集合中方便后期统一通过R返回结果</span></span><br><span class="line"> map.put(field,defaultMessage);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> R.error(<span class="number">400</span>,<span class="string">"提交的数据不合法"</span>).put(<span class="string">"data"</span>,map);</span><br><span class="line"> }<span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">//校验合格的话,就做进行业务的处理</span></span><br><span class="line"> brandService.save(brand);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> R.ok();</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>测试查看返回的数据的格式,这里我们输入的都是不合法的数据格式,返回的结果如下</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"msg"</span><span class="punctuation">:</span> <span class="string">"提交的数据不合法"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"code"</span><span class="punctuation">:</span> <span class="number">400</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"data"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"品牌名必须提交"</span><span class="punctuation">,</span><span class="comment">//字段:错误信息</span></span><br><span class="line"> <span class="attr">"logo"</span><span class="punctuation">:</span> <span class="string">"logo必须是一个合法的URL地址"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span><span class="punctuation">:</span> <span class="string">"排序必须大于等于0"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"firstLetter"</span><span class="punctuation">:</span> <span class="string">"检索首字母必须是一个字母"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>参数没有错误之后返回的数据</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"msg"</span><span class="punctuation">:</span> <span class="string">"success"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"code"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-上面的代码过于冗余-我们可以直接使用统一异常处理处理数据校验的异常"><a href="#4-上面的代码过于冗余-我们可以直接使用统一异常处理处理数据校验的异常" class="headerlink" title="4.上面的代码过于冗余,我们可以直接使用统一异常处理处理数据校验的异常"></a>4.上面的代码过于冗余,我们可以直接使用统一异常处理处理数据校验的异常</h3><p>在统一异常处理类上加上数据校验异常的异常处理</p>
|
||
<figure class="highlight java"><table><tr><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.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 = "com.atguigu.gulimall.product.controller")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">GulimallExceptionControllerAdvice</span> {</span><br><span class="line"></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>{</span><br><span class="line"> log.error(<span class="string">"数据校验出现问题:{},异常类型:{}"</span>,e.getMessage(),e.getClass());</span><br><span class="line"> Map<String,String> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</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()) {</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"> }</span><br><span class="line"> <span class="keyword">return</span> R.error(<span class="number">400</span>,<span class="string">"数据校验出现问题"</span>).put(<span class="string">"data"</span>,map);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>这个时候上面的代码就可以简化为下面的格式,数据校验出现问题之后就直接在统一异常处理中处理了</p>
|
||
<figure class="highlight java"><table><tr><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("/save")</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 )</span>{</span><br><span class="line"> brandService.save(brand);</span><br><span class="line"> <span class="keyword">return</span> R.ok();</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
<h3 id="5-分组校验功能"><a href="#5-分组校验功能" class="headerlink" title="5.分组校验功能"></a>5.分组校验功能</h3><pre><code> 例如:当我们在添加一个品牌的时候,我们不需要传入这个品牌的id信息,需要这个品牌的品牌名信息,但是在修改这个品牌的时候,我们需要这个品牌的id信息和品牌名的信息,这时我们就需要使用分组校验了
|
||
</code></pre>
|
||
<h4 id="5-1-定义空接口-作为分组校验的组"><a href="#5-1-定义空接口-作为分组校验的组" class="headerlink" title="5.1 定义空接口,作为分组校验的组"></a>5.1 定义空接口,作为分组校验的组</h4><p>添加操作的组</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.common.valid;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">interface</span> <span class="title class_">AddGroup</span> {</span><br><span class="line">}</span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>修改操作的组</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.common.valid;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">interface</span> <span class="title class_">UpdateGroup</span> {</span><br><span class="line">}</span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="5-2-在实体类上添加上分组的信息"><a href="#5-2-在实体类上添加上分组的信息" class="headerlink" title="5.2 在实体类上添加上分组的信息"></a>5.2 在实体类上添加上分组的信息</h4><p><strong>注意:使用了分组校验之后,其余的字段也要加上分组信息,否则没有加上分组信息的会失效</strong></p>
|
||
<figure class="highlight java"><table><tr><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.atguigu.common.valid.AddGroup;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.common.valid.UpdateGroup;</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="meta">@Data</span></span><br><span class="line"><span class="meta">@TableName("pms_brand")</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> {</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">@NotNull(message = "修改必须指定品牌id", groups = {UpdateGroup.class})</span><span class="comment">//在修改的时候进行校验</span></span><br><span class="line"> <span class="meta">@Null(message = "新增不能指定id", groups = {AddGroup.class})</span><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><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">@NotBlank(message = "品牌名必须提交", groups = {AddGroup.class, UpdateGroup.class})</span><span class="comment">//这个就是在添加和修改的组中都需要进行校验</span></span><br><span class="line"> <span class="keyword">private</span> String name;</span><br><span class="line">}</span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="5-3-在控制层添加上相应的注解信息-指定当前是操作属于的分组"><a href="#5-3-在控制层添加上相应的注解信息-指定当前是操作属于的分组" class="headerlink" title="5.3 在控制层添加上相应的注解信息,指定当前是操作属于的分组"></a>5.3 在控制层添加上相应的注解信息,指定当前是操作属于的分组</h4><p><strong>注意:这里如果产生数据校验的出现问题的异常,会由统一异常处理进行处理</strong></p>
|
||
<p>保存的控制器方法上添加上添加分组信息</p>
|
||
<figure class="highlight java"><table><tr><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">@Validated</span>({AddGroup.class}) 指定使用添加分组的校验</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@RequestMapping("/save")</span></span><br><span class="line"><span class="keyword">public</span> R <span class="title function_">save</span><span class="params">(<span class="meta">@Validated({AddGroup.class})</span> <span class="meta">@RequestBody</span> BrandEntity brand )</span>{</span><br><span class="line"> brandService.save(brand);</span><br><span class="line"> <span class="keyword">return</span> R.ok();</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>修改的分组上添加上修改的分组信息</p>
|
||
<figure class="highlight java"><table><tr><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("/update")</span></span><br><span class="line"><span class="keyword">public</span> R <span class="title function_">update</span><span class="params">(<span class="meta">@Validated({UpdateGroup.class})</span> <span class="meta">@RequestBody</span> BrandEntity brand)</span>{</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">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>测试:我们在新增的时候加上品牌的id,这时就会产生错误</p>
|
||
<p><img src="/pictures/image-20230614105450858.png" alt="image-20230614105450858"></p>
|
||
<p>修改的时候不带品牌的id信息</p>
|
||
<p><img src="/pictures/image-20230614111024292.png" alt="image-20230614111024292"></p>
|
||
<h3 id="6-自定义校验"><a href="#6-自定义校验" class="headerlink" title="6.自定义校验"></a>6.自定义校验</h3><p><strong>这里我们以编写一个输入的值只能是指定值的注解为例</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><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="comment">//注意:我们使用了分组校验,所以这里也要加上分组groups</span></span><br><span class="line"><span class="meta">@ListValue(vals = {0, 1}, groups = {AddGroup.class, UpdateGroup.class})</span><span class="comment">//自定义的注解,输入的时候只能是0或者1</span></span><br><span class="line"><span class="keyword">private</span> Integer showStatus;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="6-1-编写一个自定义的校验注解"><a href="#6-1-编写一个自定义的校验注解" class="headerlink" title="6.1 编写一个自定义的校验注解"></a>6.1 编写一个自定义的校验注解</h4><p>编写自定义注解</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.common.valid;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.validation.Constraint;</span><br><span class="line"><span class="keyword">import</span> javax.validation.Payload;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.lang.annotation.Documented;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.lang.annotation.Retention;</span><br><span class="line"><span class="keyword">import</span> java.lang.annotation.Target;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> <span class="keyword">static</span> java.lang.annotation.ElementType.*;</span><br><span class="line"><span class="keyword">import</span> <span class="keyword">static</span> java.lang.annotation.ElementType.TYPE_USE;</span><br><span class="line"><span class="keyword">import</span> <span class="keyword">static</span> java.lang.annotation.RetentionPolicy.RUNTIME;</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/15</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">@Documented</span></span><br><span class="line"><span class="meta">@Constraint(validatedBy = {})</span><span class="comment">//校验注解使用的校验器</span></span><br><span class="line"><span class="meta">@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})</span><span class="comment">//注解可以标注的位置</span></span><br><span class="line"><span class="meta">@Retention(RUNTIME)</span></span><br><span class="line"><span class="keyword">public</span> <span class="meta">@interface</span> ListValue {</span><br><span class="line"></span><br><span class="line"> String <span class="title function_">message</span><span class="params">()</span> <span class="keyword">default</span> <span class="string">"{com.atguigu.common.valid.ListValue.message}"</span>;<span class="comment">//在配置文件中指明</span></span><br><span class="line"></span><br><span class="line"> Class<?>[] groups() <span class="keyword">default</span> {};</span><br><span class="line"></span><br><span class="line"> Class<? <span class="keyword">extends</span> <span class="title class_">Payload</span>>[] payload() <span class="keyword">default</span> {};</span><br><span class="line"></span><br><span class="line"> <span class="type">int</span>[] vals() <span class="keyword">default</span> {};<span class="comment">//使用注解的时候会有vals属性 在属性里面指定值</span></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>编写注解中默认提示消息的配置文件</p>
|
||
<p><strong>ValidationMessages.properties</strong></p>
|
||
<figure class="highlight properties"><table><tr><td class="code"><pre><span class="line"><span class="attr">com.atguigu.common.valid.ListValue.message</span>=<span class="string">必须提交指定的值</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="6-2-编写一个自定义的校验器"><a href="#6-2-编写一个自定义的校验器" class="headerlink" title="6.2 编写一个自定义的校验器"></a>6.2 编写一个自定义的校验器</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.common.valid;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.validation.ConstraintValidator;</span><br><span class="line"><span class="keyword">import</span> javax.validation.ConstraintValidatorContext;</span><br><span class="line"><span class="keyword">import</span> java.util.HashSet;</span><br><span class="line"><span class="keyword">import</span> java.util.Set;</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/15</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">class</span> <span class="title class_">ListValueConstraintValidator</span> <span class="keyword">implements</span> <span class="title class_">ConstraintValidator</span><ListValue,Integer> {</span><br><span class="line"> <span class="keyword">private</span> Set<Integer> set = <span class="keyword">new</span> <span class="title class_">HashSet</span><>();<span class="comment">//创建一个set集合 用于存储指定输入的值0和1</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_">initialize</span><span class="params">(ListValue constraintAnnotation)</span> {</span><br><span class="line"> <span class="type">int</span>[] vals = constraintAnnotation.vals();<span class="comment">//@ListValue(vals = {0, 1})</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> val : vals) {</span><br><span class="line"> set.add(val);</span><br><span class="line"> }</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">//value:需要校验的值</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="type">boolean</span> <span class="title function_">isValid</span><span class="params">(Integer integer, ConstraintValidatorContext constraintValidatorContext)</span> {</span><br><span class="line"> <span class="keyword">return</span> set.contains(integer);<span class="comment">//判断真实树的值在不在包含0和1的这个set集合中</span></span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="6-3-关联自定义的校验器和校验注解"><a href="#6-3-关联自定义的校验器和校验注解" class="headerlink" title="6.3 关联自定义的校验器和校验注解"></a>6.3 关联自定义的校验器和校验注解</h4><p>在自定义的注解上面关联上上面自定义的校验规则</p>
|
||
<p><img src="/pictures/image-20230615151144311.png" alt="image-20230615151144311"></p>
|
||
<p>测试自定义的注解</p>
|
||
<p><img src="/pictures/image-20230615152331597.png" alt="image-20230615152331597"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>Java</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>Linux中开发环境的搭建</title>
|
||
<url>/posts/20683.html</url>
|
||
<content><![CDATA[<h2 id="一-Linux操作系统的安装与配置"><a href="#一-Linux操作系统的安装与配置" class="headerlink" title="一.Linux操作系统的安装与配置"></a>一.Linux操作系统的安装与配置</h2><p><strong>软件:VMware 、Linux镜像文件</strong><br><a href="https://qingling.icu/47407.html"><a href="https://qingling.icu/posts/47407.html">VMWare虚拟机安装Linux教程 | The Blog (qingling.icu)</a></a></p>
|
||
<h2 id="二-配置Java环境"><a href="#二-配置Java环境" class="headerlink" title="二.配置Java环境"></a>二.配置Java环境</h2><p><strong>2.1.删除自带的JDK</strong></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看系统是否有java环境</span></span><br><span class="line">java -version</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查找Linux中已有的java环境的相关文件</span></span><br><span class="line">rpm -qa |grep java</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">执行命令 删除上面的java文件</span></span><br><span class="line">rpm -e --nodeps +上面查找出来的文件</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>2.2.安装JDK</strong></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">创建一个文件夹,将JDK8上传到这个文件夹中去</span></span><br><span class="line">mkdir /opt/jdk</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">解压上传的压缩包 解压后得到一个名为jdk1.8.0_261的文件夹</span></span><br><span class="line">tar -zvxf jdk-8u261-linux-x64.tar.gz</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">创建一个目录,作为java的安装目录</span></span><br><span class="line">mkdir /usr/local/java</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">将解压后的文件移动到这个安装目录中去</span></span><br><span class="line">mv jdk1.8.0_261/ /usr/local/java/</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">进入环境变量的配置文件中</span></span><br><span class="line">vim /etc/profile</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">在文件的最后添加如下的配置</span></span><br><span class="line">export JAVA_HOME=/usr/local/java/jdk1.8.0_261</span><br><span class="line">export PATH=$JAVA_HOME/bin:$PATH</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">刷新配置文件,让新的环境变量生效</span></span><br><span class="line">source /etc/profile</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
<h2 id="三-使用Docker安装常用软件"><a href="#三-使用Docker安装常用软件" class="headerlink" title="三.使用Docker安装常用软件"></a>三.使用Docker安装常用软件</h2><p><a href="https://qingling.icu/posts/19306.html"><strong>Docker容器化技术 | The Blog (qingling.icu)</strong></a></p>
|
||
<h3 id="3-1-Docker的安装"><a href="#3-1-Docker的安装" class="headerlink" title="3.1 Docker的安装"></a><strong>3.1 Docker的安装</strong></h3><p><strong>3.1.1 安装Docker</strong></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">1、yum 包更新到最新</span> </span><br><span class="line">yum update</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">2、安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的</span> </span><br><span class="line">yum install -y yum-utils device-mapper-persistent-data lvm2</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">3、 设置yum源</span></span><br><span class="line">yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">4、 安装docker,出现输入的界面都按 y</span> </span><br><span class="line">yum install -y docker-ce</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">5、 查看docker版本,验证是否验证成功</span></span><br><span class="line">docker -v</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>3.1.2 配置镜像加速服务</strong></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">1.创建相关的目录</span></span><br><span class="line">sudo mkdir -p /etc/docker</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">2,加入配置</span></span><br><span class="line">sudo tee /etc/docker/daemon.json <<-'EOF'</span><br><span class="line">{</span><br><span class="line"> "registry-mirrors": ["https://cagfgua5.mirror.aliyuncs.com"]</span><br><span class="line">}</span><br><span class="line">EOF</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">3.重新加载,让配置文件生效</span></span><br><span class="line">sudo systemctl daemon-reload</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">4.重新启动Docker服务</span></span><br><span class="line">sudo systemctl restart docker</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>3.1.3 启动Docker服务</strong></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">启动docker服务:</span></span><br><span class="line">systemctl start docker </span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">停止docker服务:</span></span><br><span class="line">systemctl stop docker </span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">重启docker服务:</span></span><br><span class="line">systemctl restart docker</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看docker服务状态:</span></span><br><span class="line">systemctl status docker </span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置开机启动docker服务:</span></span><br><span class="line">systemctl enable docker</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-2-使用Docker安装Mysql"><a href="#3-2-使用Docker安装Mysql" class="headerlink" title="3.2 使用Docker安装Mysql"></a>3.2 使用Docker安装Mysql</h3><figure class="highlight shell"><table><tr><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='SET collation_connection = utf8_unicode_ci'</span><br><span class="line">init_connect='SET NAMES utf8'</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>
|
||
|
||
<h3 id="3-3-使用Docker安装Redis"><a href="#3-3-使用Docker安装Redis" class="headerlink" title="3.3 使用Docker安装Redis"></a>3.3 使用Docker安装Redis</h3><figure class="highlight shell"><table><tr><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> set name tom #存值</span><br><span class="line">OK</span><br><span class="line">127.0.0.1:6379> get name #取值</span><br><span class="line">"tom"</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>
|
||
|
||
<h3 id="3-4-使用Docker安装ElasticSearch"><a href="#3-4-使用Docker安装ElasticSearch" class="headerlink" title="3.4 使用Docker安装ElasticSearch"></a>3.4 使用Docker安装ElasticSearch</h3><p><strong>3.4.1 安装ElasticSearch</strong></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">拉取ElasticSearch</span></span><br><span class="line">docker pull elasticsearch:7.4.2</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">ES的配置文件存放的位置</span></span><br><span class="line">mkdir -p /mydata/elasticsearch/config</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">ES相关的数据</span></span><br><span class="line">mkdir -p /mydata/elasticsearch/data</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 class="string">"http.host: 0.0.0.0"</span>(可以被任何的机器访问)的配置写入elasticsearch.yml中(注意冒号后面的空格)</span></span><br><span class="line">echo "http.host: 0.0.0.0" >> /mydata/elasticsearch/config/elasticsearch.yml</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"><span class="meta prompt_"># </span><span class="language-bash">递归更改权限,es需要访问</span></span><br><span class="line">chmod -R 777 /mydata/elasticsearch/</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">运行容器的命令 9200端口用于发送请求使用 9300端口用于集群中节点中的通信使用</span></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">初始占用64m,最大占用5m(不指定,ES会占用所有的内存)</span></span><br><span class="line">docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \</span><br><span class="line">-e "discovery.type=single-node" \</span><br><span class="line">-e ES_JAVA_OPTS="-Xms64m -Xmx512m" \</span><br><span class="line">-v /mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \</span><br><span class="line">-v /mydata/elasticsearch/data:/usr/share/elasticsearch/data \</span><br><span class="line">-v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \</span><br><span class="line">-d elasticsearch:7.4.2 </span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置开机启动elasticsearch</span></span><br><span class="line">docker update elasticsearch --restart=always</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">http://虚拟机的ip:9200/</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>安装成功之后:</p>
|
||
<p><img src="/pictures/image-20230628191936254.png" alt="image-20230628191936254"></p>
|
||
<p><strong>3.4.2 安装Kibana(可视化界面)</strong></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">拉取Kibana</span></span><br><span class="line">docker pull kibana:7.4.2</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">这里-e是自己的elasticsearch服务地址(这里的地址一定要改为自己虚拟机的地址)</span></span><br><span class="line">docker run --name kibana -e ELASTICSEARCH_HOSTS=http://192.168.195.100:9200 -p 5601:5601 -d kibana:7.4.2</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置开机启动kibana</span></span><br><span class="line">docker update kibana --restart=always</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">访问对应的网址查看服务</span></span><br><span class="line">http://虚拟机的ip:5601</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>安装成功之后</p>
|
||
<p><img src="/pictures/image-20230701104616032.png" alt="image-20230701104616032"></p>
|
||
<p><strong>3.4.3 安装IK分词器</strong></p>
|
||
<p>安装地址: <a href="https://github.com/medcl/elasticsearch-analysis-ik">https://github.com/medcl/elasticsearch-analysis-ik</a></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">切换到es挂载在注解的plugins目录</span></span><br><span class="line">cd /mydata/elasticsearch/plugins/</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">安装wget</span></span><br><span class="line">yum install wget </span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">下载ik分词器的压缩包(下载的速度不是很快(5分钟左右),建议本地下载好了之后,上传上去)</span></span><br><span class="line">wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.4.2/elasticsearch-analysis-ik-7.4.2.zip</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">进入容器内部查看一下文件是否同步到了容器的内部</span></span><br><span class="line">docker exec -it 容器Id /bin/bash</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">切换到plugins目录中去,这时目录中也存在elasticsearch-analysis-ik-7.4.2.zip这个压缩包</span></span><br><span class="line">cd plugins/ #使用ls查看一下</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 class="language-bash">在主机下解压elasticsearch-analysis-ik-7.4.2.zip这个压缩包</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">zip的解压需要使用unzip解压命令 这里我们可以直接在本地解压一下 上传到plugins目录(解压的文件名为ik)</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">安装unzip</span></span><br><span class="line">yum install -y unzip</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看ik分词器是否安装成功</span></span><br><span class="line">docker exec -it 容器Id /bin/bash</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">切换到bin目录</span></span><br><span class="line">cd bin/</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">执行下面的命令,有ik显示即为安装成功</span></span><br><span class="line">elasticsearch-plugin list</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">退出容器,重启一下</span></span><br><span class="line">docker restart elasticsearch</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-5-使用Docker安装nginx"><a href="#3-5-使用Docker安装nginx" class="headerlink" title="3.5 使用Docker安装nginx"></a>3.5 使用Docker安装nginx</h3><p>方法一:</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">创建nginx容器挂载的目录</span></span><br><span class="line">mkdir /mydata/nginx/conf</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">拉取nginx的镜像</span></span><br><span class="line">docker pull nginx:1.10</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">随便启动一个nginx实例,为了复制其配置</span></span><br><span class="line">docker run -p 80:80 --name nginx -d nginx:1.10</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">将容器内的配置文件拷贝到conf目录(注意这里有个点和空格)</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">注意在nginx的目录下操作,(成功之后/mydata/nginx/conf目录下会有相应的配置文件和目录)</span></span><br><span class="line">docker container cp nginx:/etc/nginx /mydata/nginx/conf</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">停掉并删除之前的启动的nginx</span></span><br><span class="line">docker stop nginx</span><br><span class="line">docker rm nginx</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">正式的启动容器</span></span><br><span class="line">docker run -p 80:80 --name nginx \</span><br><span class="line">-v /mydata/nginx/html:/usr/share/nginx/html \</span><br><span class="line">-v /mydata/nginx/logs:/var/log/nginx \</span><br><span class="line">-v /mydata/nginx/conf:/etc/nginx \</span><br><span class="line">-d nginx:1.10</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置开机启动nginx</span></span><br><span class="line">docker update nginx --restart=always</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>方法二</p>
|
||
<p>先在宿主机的/opt/nginx/conf/目录下创建nginx.conf配置文件并加入相关的配置</p>
|
||
<figure class="highlight properties"><table><tr><td class="code"><pre><span class="line"><span class="attr">user</span> <span class="string">root;</span></span><br><span class="line"><span class="attr">worker_processes</span> <span class="string">1;</span></span><br><span class="line"></span><br><span class="line"><span class="attr">events</span> <span class="string">{</span></span><br><span class="line"> <span class="attr">worker_connections</span> <span class="string">1024;</span></span><br><span class="line"><span class="attr">}</span></span><br><span class="line"></span><br><span class="line"><span class="attr">http</span> <span class="string">{</span></span><br><span class="line"> <span class="attr">include</span> <span class="string">mime.types;</span></span><br><span class="line"> <span class="attr">default_type</span> <span class="string">application/octet-stream;</span></span><br><span class="line"> <span class="attr">sendfile</span> <span class="string">on;</span></span><br><span class="line"> <span class="attr">keepalive_timeout</span> <span class="string">65;</span></span><br><span class="line"> </span><br><span class="line"> </span><br><span class="line"></span><br><span class="line"> <span class="attr">server</span> <span class="string">{</span></span><br><span class="line"> <span class="attr">listen</span> <span class="string">80;</span></span><br><span class="line"> <span class="attr">server_name</span> <span class="string">localhost;</span></span><br><span class="line"> <span class="attr">charset</span> <span class="string">utf-8;</span></span><br><span class="line"><span class="comment"> </span></span><br><span class="line"><span class="comment"> # set site favicon</span></span><br><span class="line"><span class="comment"> # 这里的路径时容器的路径,不是宿主机的路径</span></span><br><span class="line"> <span class="attr">location</span> <span class="string">/favicon.ico {</span></span><br><span class="line"> <span class="attr">root</span> <span class="string">/usr/share/nginx/html/dist;</span></span><br><span class="line"> <span class="attr">}</span></span><br><span class="line"></span><br><span class="line"> <span class="attr">location</span> <span class="string">/ {</span></span><br><span class="line"><span class="comment"> # 这里的路径时容器的路径,不是宿主机的路径</span></span><br><span class="line"> <span class="attr">root</span> <span class="string">/usr/share/nginx/html/dist;</span></span><br><span class="line"> <span class="attr">try_files</span> <span class="string">$uri $uri/ /index.html; </span></span><br><span class="line"> <span class="attr">index</span> <span class="string">index.html index.htm;</span></span><br><span class="line"> <span class="attr">}</span></span><br><span class="line"> </span><br><span class="line"> <span class="attr">location</span> <span class="string">/prod-api/ {</span></span><br><span class="line"> <span class="attr">proxy_set_header</span> <span class="string">Host $http_host;</span></span><br><span class="line"> <span class="attr">proxy_set_header</span> <span class="string">X-Real-IP $remote_addr;</span></span><br><span class="line"> <span class="attr">proxy_set_header</span> <span class="string">REMOTE-HOST $remote_addr;</span></span><br><span class="line"> <span class="attr">proxy_set_header</span> <span class="string">X-Forwarded-For $proxy_add_x_forwarded_for;</span></span><br><span class="line"> <span class="attr">proxy_pass</span> <span class="string">http://8.137.109.244:8080/;</span></span><br><span class="line"> <span class="attr">}</span></span><br><span class="line"></span><br><span class="line"> <span class="attr">error_page</span> <span class="string">500 502 503 504 /50x.html;</span></span><br><span class="line"> <span class="attr">location</span> = <span class="string">/50x.html {</span></span><br><span class="line"><span class="comment"> # 这里的路径时容器的路径,不是宿主机的路径</span></span><br><span class="line"> <span class="attr">root</span> <span class="string">/usr/share/nginx/html/dist;</span></span><br><span class="line"> <span class="attr">}</span></span><br><span class="line"> <span class="attr">}</span></span><br><span class="line"><span class="attr">}</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>创建容器</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">docker run -id --name=nginx \</span><br><span class="line">-p 80:80 \</span><br><span class="line">-v /opt/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \</span><br><span class="line">-v /opt/nginx/logs:/var/log/nginx \</span><br><span class="line">-v /opt/nginx/html:/usr/share/nginx/html \</span><br><span class="line">nginx</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-6-使用Docker安装RabbitMQ"><a href="#3-6-使用Docker安装RabbitMQ" class="headerlink" title="3.6 使用Docker安装RabbitMQ"></a>3.6 使用Docker安装RabbitMQ</h3><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">直接执行运行rabbitMQ容器的命令,没有镜像会自动下载</span></span><br><span class="line">docker run -d --name rabbitmq \</span><br><span class="line">-p 5671:5671 \</span><br><span class="line">-p 5672:5672 \</span><br><span class="line">-p 4369:4369 \</span><br><span class="line">-p 25672:25672 \</span><br><span class="line">-p 15671:15671 \</span><br><span class="line">-p 15672:15672 \</span><br><span class="line">rabbitmq:management</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置开机启动rabbitmq</span></span><br><span class="line">docker update rabbitmq --restart=always</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">测试访问</span></span><br><span class="line">虚拟机的ip:15672</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>账号:guest</p>
|
||
<p>密码:guest</p>
|
||
<p><img src="/pictures/image-20230717123217404.png" alt="image-20230717123217404"></p>
|
||
<h3 id="3-7-使用docker安装nacos"><a href="#3-7-使用docker安装nacos" class="headerlink" title="3.7 使用docker安装nacos"></a>3.7 使用docker安装nacos</h3><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">拉取镜像</span></span><br><span class="line">docker pull nacos/nacos-server:1.2.0</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">MODE=standalone 单机版</span></span><br><span class="line">docker run --env MODE=standalone --name nacos --restart=always -d -p 8848:8848 nacos/nacos-server:1.2.0</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>测试访问:http://虚拟机ip:8848/nacos </p>
|
||
<p><img src="/pictures/image-20230811105925843.png" alt="image-20230811105925843"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>运维</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>环境搭建</tag>
|
||
<tag>Linux</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>开发环境的搭建</title>
|
||
<url>/posts/63333.html</url>
|
||
<content><![CDATA[<h2 id="1-后端环境搭建"><a href="#1-后端环境搭建" class="headerlink" title="1.后端环境搭建"></a>1.后端环境搭建</h2><h3 id="1-1-JDK环境的配置"><a href="#1-1-JDK环境的配置" class="headerlink" title="1.1 JDK环境的配置"></a>1.1 JDK环境的配置</h3><p>常规的安装,无需教程</p>
|
||
<p>IDEA中设置默认的JDK</p>
|
||
<p><img src="/pictures/image-20230604120610791.png" alt="image-20230604120610791"></p>
|
||
<p>选中需要设置为默认JDK的JDK</p>
|
||
<p><img src="/pictures/image-20230604120654078.png" alt="image-20230604120654078"></p>
|
||
<h3 id="1-2-Maven的安装与配置"><a href="#1-2-Maven的安装与配置" class="headerlink" title="1.2 Maven的安装与配置"></a>1.2 Maven的安装与配置</h3><p><strong>环境变量的配置</strong></p>
|
||
<p>MAVEN_HOME和Path 配置文件的配置</p>
|
||
<p>设置默认maven,每次创建新的工程的时候就会使用这个maven</p>
|
||
<p><img src="/pictures/image-20230604120307280.png" alt="image-20230604120307280"></p>
|
||
<p>然后在弹出的页面中设置,这样每次创建新的工程就会使用当前设置的maven</p>
|
||
<p><img src="/pictures/image-20230604120436139.png" alt="image-20230604120436139"></p>
|
||
<h3 id="1-3-IDEA的配置"><a href="#1-3-IDEA的配置" class="headerlink" title="1.3 IDEA的配置"></a>1.3 IDEA的配置</h3><p>展开目录树 取消勾选下面的选项</p>
|
||
<p><img src="/pictures/image-20230604151530534.png" alt="image-20230604151530534"></p>
|
||
<p>快捷键的配置 IDEA中的全局查找的快捷键会和windows的中文的繁简字体切换的快捷键冲突,直接关掉系统的快捷键</p>
|
||
<p><img src="/pictures/image-20230604121126549.png" alt="image-20230604121126549"></p>
|
||
<p>页面中字体的配置</p>
|
||
<img src="/pictures/image-20230603202245269.png" alt="image-20230603202245269" style="zoom:150%;" />
|
||
|
||
<p>代码字体的配置</p>
|
||
<img src="/pictures/image-20230603154531129.png" alt="image-20230603154531129" style="zoom:150%;" />
|
||
|
||
<p>设置代码粗体</p>
|
||
<img src="/pictures/image-20230603154622726.png" alt="image-20230603154622726" style="zoom:150%;" />
|
||
|
||
<p>打开的多个文件多行显示,不在同一行显示</p>
|
||
<p><img src="/pictures/image-20230611211438017.png" alt="image-20230611211438017"></p>
|
||
<p><strong>浅色主题的配置</strong></p>
|
||
<p><img src="/pictures/image-20230815171925527.png" alt="image-20230815171925527"></p>
|
||
<p>修改注释的颜色</p>
|
||
<p>修改多行注释的颜色: 修改Doc comment -> Text的颜色</p>
|
||
<p><img src="/pictures/image-20230815172326472.png" alt="image-20230815172326472"></p>
|
||
<h3 id="1-4-mysql的安装"><a href="#1-4-mysql的安装" class="headerlink" title="1.4 mysql的安装"></a>1.4 mysql的安装</h3><p>具体的安装教程在《MySql5.7的安装教程的博客中》</p>
|
||
<h3 id="1-5-Nacos的安装配置"><a href="#1-5-Nacos的安装配置" class="headerlink" title="1.5 Nacos的安装配置"></a>1.5 Nacos的安装配置</h3><p>github下载之后,直接解压运行</p>
|
||
<p>下载的地址:<a href="https://github.com/alibaba/nacos/releases">https://github.com/alibaba/nacos/releases</a></p>
|
||
<p>踩坑:单节点部署的话,启动的时候需要配置一下,不然启动的时候会闪退</p>
|
||
<p><img src="/pictures/image-20230603193632659.png" alt="image-20230603193632659"></p>
|
||
<h2 id="2-前端环境的搭建"><a href="#2-前端环境的搭建" class="headerlink" title="2.前端环境的搭建"></a>2.前端环境的搭建</h2><h3 id="2-1-Nodejs的安装与配置"><a href="#2-1-Nodejs的安装与配置" class="headerlink" title="2.1 Nodejs的安装与配置"></a>2.1 Nodejs的安装与配置</h3><p>下载的网址:<a href="https://nodejs.org/zh-cn/download/releases">https://nodejs.org/zh-cn/download/releases</a></p>
|
||
<p>选择.msi的下载即可</p>
|
||
<p>不用配置环境变量,一直下一步,直到安装成功过,node自带npm包管理工具</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><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></pre></td></tr></table></figure>
|
||
|
||
<h2 id="3-前后端公共环境的搭建"><a href="#3-前后端公共环境的搭建" class="headerlink" title="3.前后端公共环境的搭建"></a>3.前后端公共环境的搭建</h2><h3 id="1-Git环境的搭建"><a href="#1-Git环境的搭建" class="headerlink" title="1.Git环境的搭建"></a>1.Git环境的搭建</h3><figure class="highlight shell"><table><tr><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 "用户名" #随意</span><br><span class="line">git config --global user.email "邮箱" #自己的邮箱</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 "在码云上注册的邮箱地址" #连续三次回车</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>
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>环境搭建</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>ElementUI使用示例</title>
|
||
<url>/posts/50908.html</url>
|
||
<content><![CDATA[<p><strong><a href="https://element.eleme.cn/#/zh-CN/component/quickstart">ElementUI官网</a></strong></p>
|
||
<h2 id="一-树形显示-树形控件"><a href="#一-树形显示-树形控件" class="headerlink" title="一.树形显示-树形控件"></a>一.树形显示-树形控件</h2><h3 id="1-树形显示"><a href="#1-树形显示" class="headerlink" title="1.树形显示"></a>1.树形显示</h3><p><strong>示例-以谷粒商城项目的商品分类为例</strong></p>
|
||
<p><strong>数据中商品分类的数据表,所有的分类数据在同一张表中</strong></p>
|
||
<img src="/pictures/image-20230530174911409.png" alt="image-20230530174911409" style="zoom:150%;" />
|
||
|
||
<p><strong>商品分类的实体类</strong></p>
|
||
<figure class="highlight java"><table><tr><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.TableField;</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 class="keyword">import</span> java.util.Date;</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="keyword">import</span> lombok.Data;</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("pms_category")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">CategoryEntity</span> <span class="keyword">implements</span> <span class="title class_">Serializable</span> {</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 catId;</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 name;</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 parentCid;</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 catLevel;</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="keyword">private</span> Integer sort;</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 icon;</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 productUnit;</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 productCount;</span><br><span class="line"></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<CategoryEntity> children;<span class="comment">//这里的属性名不是瞎起的,与ElementUI中的显示相对应,这里改了,前端也要改</span></span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>封装数据,供前端显示</strong></p>
|
||
<p>controller层</p>
|
||
<figure class="highlight java"><table><tr><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("/list/tree")</span></span><br><span class="line"><span class="keyword">public</span> R <span class="title function_">list</span><span class="params">()</span>{</span><br><span class="line"> List<CategoryEntity> entities = categoryService.listWithTree();</span><br><span class="line"> <span class="keyword">return</span> R.ok().put(<span class="string">"data"</span>, entities);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>service层,这里主要有一个单独的递归方法,使用的时候会改就行</p>
|
||
<figure class="highlight java"><table><tr><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<CategoryEntity> <span class="title function_">listWithTree</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//查出所有的分类</span></span><br><span class="line"> List<CategoryEntity> 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<CategoryEntity> level1List = entities.stream().filter(categoryEntity -></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) -> {</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"> }).sorted((menu1, menu2) -> {</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"> }).collect(Collectors.toList());</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> level1List;</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 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<CategoryEntity> <span class="title function_">getChildren</span><span class="params">(CategoryEntity root, List<CategoryEntity> all)</span> {</span><br><span class="line"> List<CategoryEntity> children = all.stream().filter(categoryEntity -> {</span><br><span class="line"> <span class="keyword">return</span> categoryEntity.getParentCid().equals(root.getCatId());</span><br><span class="line"> }).map(categoryEntity -> {</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"> }).sorted((menu1, menu2) -> {</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"> }).collect(Collectors.toList());</span><br><span class="line"> <span class="keyword">return</span> children;</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>返回数据的格式</strong></p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"msg"</span><span class="punctuation">:</span> <span class="string">"success"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"code"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"data"</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"catId"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"图书、音像、电子书刊"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"parentCid"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"catLevel"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"showStatus"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"icon"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productUnit"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productCount"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"children"</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"catId"</span><span class="punctuation">:</span> <span class="number">22</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"电子书刊"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"parentCid"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"catLevel"</span><span class="punctuation">:</span> <span class="number">2</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"showStatus"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"icon"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productUnit"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productCount"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"children"</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"catId"</span><span class="punctuation">:</span> <span class="number">165</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"电子书"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"parentCid"</span><span class="punctuation">:</span> <span class="number">22</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"catLevel"</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"showStatus"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"icon"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productUnit"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productCount"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"children"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"catId"</span><span class="punctuation">:</span> <span class="number">166</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"网络原创"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"parentCid"</span><span class="punctuation">:</span> <span class="number">22</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"catLevel"</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"showStatus"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"icon"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productUnit"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productCount"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"children"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"catId"</span><span class="punctuation">:</span> <span class="number">167</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"数字杂志"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"parentCid"</span><span class="punctuation">:</span> <span class="number">22</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"catLevel"</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"showStatus"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"icon"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productUnit"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productCount"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"children"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"catId"</span><span class="punctuation">:</span> <span class="number">168</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"多媒体图书"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"parentCid"</span><span class="punctuation">:</span> <span class="number">22</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"catLevel"</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"showStatus"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"icon"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productUnit"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productCount"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"children"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"catId"</span><span class="punctuation">:</span> <span class="number">23</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"音像"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"parentCid"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"catLevel"</span><span class="punctuation">:</span> <span class="number">2</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"showStatus"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"icon"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productUnit"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productCount"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"children"</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"catId"</span><span class="punctuation">:</span> <span class="number">169</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"音乐"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"parentCid"</span><span class="punctuation">:</span> <span class="number">23</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"catLevel"</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"showStatus"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"icon"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productUnit"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productCount"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"children"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"catId"</span><span class="punctuation">:</span> <span class="number">170</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"影视"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"parentCid"</span><span class="punctuation">:</span> <span class="number">23</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"catLevel"</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"showStatus"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"icon"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productUnit"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productCount"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"children"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"catId"</span><span class="punctuation">:</span> <span class="number">171</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"教育音像"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"parentCid"</span><span class="punctuation">:</span> <span class="number">23</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"catLevel"</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"showStatus"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"sort"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"icon"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productUnit"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">null</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"productCount"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"children"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> 略.............................</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>前端代码</strong></p>
|
||
<p>模板</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><template></span><br><span class="line"> <div></span><br><span class="line"> <!-- 树形控件 --></span><br><span class="line"> <el-tree</span><br><span class="line"> :data="menus"</span><br><span class="line"> :props="defaultProps"</span><br><span class="line"> @node-click="handleNodeClick"</span><br><span class="line"> ></el-tree></span><br><span class="line"> </div></span><br><span class="line"></template></span><br><span class="line"></span><br><span class="line"><script></span><br><span class="line"> export default {</span><br><span class="line"> data() {</span><br><span class="line"> return {</span><br><span class="line"> data: [],//发送请求获取的数据(比如 return R.ok().put("data", entities);里面的data)</span><br><span class="line"> defaultProps: {</span><br><span class="line"> children: 'children',//实体类中的属性(比如:private List<CategoryEntity> children;)</span><br><span class="line"> label: 'label'//需要显示的属性的属性名(比如商品分类名,属性名是name,这里就填name)</span><br><span class="line"> }</span><br><span class="line"> };</span><br><span class="line"> },</span><br><span class="line"> methods: {</span><br><span class="line"> handleNodeClick(data) {</span><br><span class="line"> console.log(data);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> };</span><br><span class="line"></script></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>完整代码</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><template></span><br><span class="line"> <div></span><br><span class="line"> <!-- 树形控件 --></span><br><span class="line"> <el-tree</span><br><span class="line"> :data="menus"</span><br><span class="line"> :props="defaultProps"</span><br><span class="line"> @node-click="handleNodeClick"</span><br><span class="line"> ></el-tree></span><br><span class="line"> </div></span><br><span class="line"></template></span><br><span class="line"></span><br><span class="line"><script></span><br><span class="line">export default {</span><br><span class="line"> //定义变量</span><br><span class="line"> data() {</span><br><span class="line"> return {</span><br><span class="line"> menus: [],</span><br><span class="line"> defaultProps: {//这里的配置看官方的文档</span><br><span class="line"> children: "children",//父节点上的子节点</span><br><span class="line"> label: "name",//每个对象要显示的属性值,比如我们当前要显示商品分类中的分类名的值,这里就改成name</span><br><span class="line"> },</span><br><span class="line"> };</span><br><span class="line"> },</span><br><span class="line"> //钩子函数</span><br><span class="line"> created() {</span><br><span class="line"> //调用获取商品分类数据的方法</span><br><span class="line"> this.getMenus();</span><br><span class="line"> },</span><br><span class="line"></span><br><span class="line"> //方法</span><br><span class="line"> methods: {</span><br><span class="line"> handleNodeClick(data) {</span><br><span class="line"> console.log(data);</span><br><span class="line"> },</span><br><span class="line"> //获取所有的菜单</span><br><span class="line"> getMenus() {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/list/tree"),</span><br><span class="line"> method: "get",</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.menus = data.data;</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> },</span><br><span class="line">};</span><br><span class="line"></script></span><br><span class="line"></span><br><span class="line"><style></span><br><span class="line"></style></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>显示效果</strong></p>
|
||
<img src="/pictures/image-20230530181102832.png" alt="image-20230530181102832" style="zoom:150%;" />
|
||
|
||
<h3 id="2-树形控件的删除、添加"><a href="#2-树形控件的删除、添加" class="headerlink" title="2.树形控件的删除、添加"></a>2.树形控件的删除、添加</h3><p>页面的显示效果</p>
|
||
<p><img src="/pictures/image-20230605145343384.png" alt="image-20230605145343384"></p>
|
||
<p>使用的组件 在树形控件的基础上添加相关的代码</p>
|
||
<img src="/pictures/image-20230605145433594.png" alt="image-20230605145433594" style="zoom:150%;" />
|
||
|
||
<p>添加的时候弹出的对话框使用的组件</p>
|
||
<img src="/pictures/image-20230605153935967.png" alt="image-20230605153935967" style="zoom:150%;" />
|
||
|
||
<img src="/pictures/image-20230605154629290.png" alt="image-20230605154629290" style="zoom:150%;" />
|
||
|
||
<p><strong>前端代码的实现</strong></p>
|
||
<p>Tips:删除成功之后依然展开删除的节点</p>
|
||
<p>删除和添加的前端代码</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><template></span><br><span class="line"> <div></span><br><span class="line"> <!-- 树形控件--></span><br><span class="line"> <!-- :expand-on-click-node="false"设置为点击箭头的时候才会展开,避免点击删除的按钮的时候展开 --></span><br><span class="line"> <!-- show-checkbox表示开启选择框,批量选择--></span><br><span class="line"> <!-- node-key表示在整个树中唯一的表示 --></span><br><span class="line"> <el-tree</span><br><span class="line"> :data="menus"</span><br><span class="line"> :props="defaultProps"</span><br><span class="line"> :expand-on-click-node="false"</span><br><span class="line"> show-checkbox</span><br><span class="line"> node-key="catId"</span><br><span class="line"> :default-expanded-keys="expandedKey"</span><br><span class="line"> ></span><br><span class="line"> <span class="custom-tree-node" slot-scope="{ node, data }"></span><br><span class="line"> <span>{{ node.label }}</span></span><br><span class="line"> <span></span><br><span class="line"> <el-button</span><br><span class="line"> v-if="node.level <= 2"</span><br><span class="line"> type="text"</span><br><span class="line"> size="mini"</span><br><span class="line"> @click="() => append(data)"</span><br><span class="line"> ></span><br><span class="line"> 添加</span><br><span class="line"> </el-button></span><br><span class="line"> <!-- 添加判断,没有下一级节点的时候就显示删除的按钮 --></span><br><span class="line"> <el-button</span><br><span class="line"> v-if="data.children.length <= 0"</span><br><span class="line"> type="text"</span><br><span class="line"> size="mini"</span><br><span class="line"> @click="() => remove(node, data)"</span><br><span class="line"> ></span><br><span class="line"> 删除</span><br><span class="line"> </el-button></span><br><span class="line"> </span></span><br><span class="line"> </span></el-tree</span><br><span class="line"> ></span><br><span class="line"> <!-- 添加分类的时候弹出的对话框 --></span><br><span class="line"> <el-dialog title="提示" :visible.sync="dialogVisible" width="30%"></span><br><span class="line"> <el-form :model="category"></span><br><span class="line"> <el-form-item label="分类名称"></span><br><span class="line"> <el-input v-model="category.name" autocomplete="off"></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> </el-form></span><br><span class="line"> <span slot="footer" class="dialog-footer"></span><br><span class="line"> <el-button @click="dialogVisible = false">取 消</el-button></span><br><span class="line"> <el-button type="primary" @click="addCategory">确 定</el-button></span><br><span class="line"> </span></span><br><span class="line"> </el-dialog></span><br><span class="line"> </div></span><br><span class="line"></template></span><br><span class="line"></span><br><span class="line"><script></span><br><span class="line">export default {</span><br><span class="line"> //定义变量</span><br><span class="line"> data() {</span><br><span class="line"> return {</span><br><span class="line"> menus: [],</span><br><span class="line"> defaultProps: {</span><br><span class="line"> //这里的配置看官方的文档</span><br><span class="line"> children: "children", //父节点上的子节点</span><br><span class="line"> label: "name", //每个对象要显示的属性值,比如我们当前要显示商品分类中的分类名的值,这里就改成name</span><br><span class="line"> },</span><br><span class="line"> expandedKey: [], //需要展开的数组,用于删除之后树形控件仍然展开</span><br><span class="line"> dialogVisible: false, //添加菜单的对话框的开启或者关闭</span><br><span class="line"> //表单绑定的对象</span><br><span class="line"> category: {</span><br><span class="line"> name: "", //分类的名称</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"> },</span><br><span class="line"> };</span><br><span class="line"> },</span><br><span class="line"> //钩子函数</span><br><span class="line"> created() {</span><br><span class="line"> //调用获取商品分类数据的方法</span><br><span class="line"> this.getMenus();</span><br><span class="line"> },</span><br><span class="line"></span><br><span class="line"> //方法</span><br><span class="line"> methods: {</span><br><span class="line"> //添加分类(弹出的对话框确定按钮执行的方法)</span><br><span class="line"> addCategory() {</span><br><span class="line"> console.log("提交的数据:", this.category);</span><br><span class="line"> //将添加的数据返回给后端</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/save"),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData(this.category, false),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "菜单添加成功",</span><br><span class="line"> type: "success",</span><br><span class="line"> });</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"> });</span><br><span class="line"> //关闭对话框</span><br><span class="line"> this.dialogVisible = false;</span><br><span class="line"> },</span><br><span class="line"> //添加分类的方法</span><br><span class="line"> append(data) {</span><br><span class="line"> //清空一下表单的数据</span><br><span class="line"> this.category.name = "";</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"> },</span><br><span class="line"> //删除节点的方法</span><br><span class="line"> remove(node, data) {</span><br><span class="line"> var ids = [data.catId];</span><br><span class="line"> this.$confirm(`是否要删除[${data.name}]菜单?`, "提示", {</span><br><span class="line"> confirmButtonText: "确定",</span><br><span class="line"> cancelButtonText: "取消",</span><br><span class="line"> type: "warning",</span><br><span class="line"> })</span><br><span class="line"> .then(() => {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/delete"),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData(ids, false),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "菜单删除成功",</span><br><span class="line"> type: "success",</span><br><span class="line"> });</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"> });</span><br><span class="line"> })</span><br><span class="line"> .catch(() => {</span><br><span class="line"> this.$message({</span><br><span class="line"> type: "info",</span><br><span class="line"> message: "已取消删除",</span><br><span class="line"> });</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> //获取所有的菜单</span><br><span class="line"> getMenus() {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/list/tree"),</span><br><span class="line"> method: "get",</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.menus = data.data;</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> },</span><br><span class="line">};</span><br><span class="line"></script></span><br><span class="line"></span><br><span class="line"><style></span><br><span class="line"></style></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>后端代码</strong></p>
|
||
<p>删除的后端代码</p>
|
||
<figure class="highlight java"><table><tr><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("/delete")</span></span><br><span class="line"> <span class="comment">//@RequiresPermissions("product:category:delete")</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> {</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"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>添加的后端代码</p>
|
||
<figure class="highlight java"><table><tr><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("/save")</span></span><br><span class="line"><span class="comment">//@RequiresPermissions("product:category:save")</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> {</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">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>实现的效果</p>
|
||
<p><img src="/pictures/image-20230605163004850.png" alt="image-20230605163004850"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>前端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>前端</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>Mybatis-Plus的使用教程</title>
|
||
<url>/posts/53306.html</url>
|
||
<content><![CDATA[<p><strong>官方文档:<a href="https://www.baomidou.com/">MyBatis-Plus</a></strong></p>
|
||
<h1 id="常用插件"><a href="#常用插件" class="headerlink" title="常用插件"></a>常用插件</h1><h2 id="1-公共字段填充"><a href="#1-公共字段填充" class="headerlink" title="1.公共字段填充"></a>1.公共字段填充</h2><p> <strong>对于每个实体类共有的属性字段,例如创建时间、修改时间、创建人、修改人,我们可以使用公共字段填充,来统一填充这些字段,这样我们在创建这些实体类的对象的时候就不需要set这些属性,实现丝滑开发</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@TableField(fill = FieldFill.INSERT)</span> <span class="comment">//插入的时候填充</span></span><br><span class="line"><span class="keyword">private</span> String gmtCreate;</span><br><span class="line"><span class="meta">@TableField(fill = FieldFill.INSERT_UPDATE)</span><span class="comment">//插入和修改的时候填充</span></span><br><span class="line"><span class="keyword">private</span> String gmtModified;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>第一种配置的方法</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.itheima.config;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;</span><br><span class="line"><span class="keyword">import</span> org.apache.ibatis.reflection.MetaObject;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Component;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.time.LocalDateTime;</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/25</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">@Component</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MyMetaObjectHandler</span> <span class="keyword">implements</span> <span class="title class_">MetaObjectHandler</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 class="doctag">@param</span> metaObject 元对象</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_">insertFill</span><span class="params">(MetaObject metaObject)</span> {</span><br><span class="line"> <span class="comment">//创建时间的字段填充</span></span><br><span class="line"> metaObject.setValue(<span class="string">"gmtCreate"</span>, LocalDateTime.now());</span><br><span class="line"> <span class="comment">//修改时间的字段填充</span></span><br><span class="line"> metaObject.setValue(<span class="string">"gmtModified"</span>, LocalDateTime.now());</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 class="doctag">@param</span> metaObject 元对象</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_">updateFill</span><span class="params">(MetaObject metaObject)</span> {</span><br><span class="line"> <span class="comment">//修改时间的字段填充</span></span><br><span class="line"> metaObject.setValue(<span class="string">"gmtModified"</span>, LocalDateTime.now());</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>第二种配置的方法</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Component</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MyMetaObjectHandler</span> <span class="keyword">implements</span> <span class="title class_">MetaObjectHandler</span> {</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> <span class="keyword">void</span> <span class="title function_">insertFill</span><span class="params">(MetaObject metaObject)</span> {</span><br><span class="line"> <span class="comment">// 起始版本 3.3.0(推荐使用)</span></span><br><span class="line"> <span class="built_in">this</span>.strictInsertFill(metaObject, <span class="string">"createTime"</span>, LocalDateTime.class, LocalDateTime.now()); </span><br><span class="line"> <span class="comment">// 或者</span></span><br><span class="line"> <span class="built_in">this</span>.strictInsertFill(metaObject, <span class="string">"createTime"</span>, () -> LocalDateTime.now(), LocalDateTime.class); <span class="comment">// 起始版本 3.3.3(推荐)</span></span><br><span class="line"> <span class="comment">// 或者</span></span><br><span class="line"> <span class="comment">// 也可以使用(3.3.0 该方法有bug)</span></span><br><span class="line"> <span class="built_in">this</span>.fillStrategy(metaObject, <span class="string">"createTime"</span>, LocalDateTime.now()); </span><br><span class="line"> }</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> <span class="keyword">void</span> <span class="title function_">updateFill</span><span class="params">(MetaObject metaObject)</span> {</span><br><span class="line"> <span class="comment">// 起始版本 3.3.0(推荐)</span></span><br><span class="line"> <span class="built_in">this</span>.strictUpdateFill(metaObject, <span class="string">"updateTime"</span>, LocalDateTime.class, LocalDateTime.now());</span><br><span class="line"> <span class="comment">// 或者</span></span><br><span class="line"> <span class="built_in">this</span>.strictUpdateFill(metaObject, <span class="string">"updateTime"</span>, () -> LocalDateTime.now(), LocalDateTime.class); <span class="comment">// 起始版本 3.3.3(推荐)</span></span><br><span class="line"> <span class="comment">// 或者</span></span><br><span class="line"> <span class="comment">// 也可以使用(3.3.0 该方法有bug)</span></span><br><span class="line"> <span class="built_in">this</span>.fillStrategy(metaObject, <span class="string">"updateTime"</span>, LocalDateTime.now()); </span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="2-逻辑删除"><a href="#2-逻辑删除" class="headerlink" title="2.逻辑删除"></a>2.逻辑删除</h2><p><strong>1.配置全局的配置文件(可以省略)</strong></p>
|
||
<figure class="highlight yaml"><table><tr><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><strong>2.配置逻辑删除的组件(3.1.1版本之后不需要这一步,可以省略)</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.core.injector.ISqlInjector;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;</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="meta">@Configuration</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MyBatisPlusConfiguration</span> {</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> ISqlInjector <span class="title function_">sqlInjector</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">LogicSqlInjector</span>();</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>3.在实体类上逻辑删除的字段上加上逻辑删除的注解</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">//value:表示不删除对应的值</span></span><br><span class="line"><span class="comment">//delval:表示删除对应的值</span></span><br><span class="line"><span class="comment">//正常的情况下1代表删除,0代表未删除,这里我们没有使用这个规则,下面设置的是自己的规则</span></span><br><span class="line"><span class="meta">@TableLogic(value = "1",delval = "0")</span></span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>SSM</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>Git命令速查</title>
|
||
<url>/posts/18459.html</url>
|
||
<content><![CDATA[<p><strong>安装教程</strong></p>
|
||
<p>官网下载:<a href="https://git-scm.com/downloads">https://git-scm.com/downloads</a></p>
|
||
<figure class="highlight shell"><table><tr><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 "用户名" #随意</span><br><span class="line">git config --global user.email "邮箱" #自己的邮箱</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 "在码云上注册的邮箱地址" #连续三次回车</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>
|
||
<p><img src="/pictures/image-20230520173824247.png" alt="image-20230520173824247"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>Git</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>项目实战-谷粒商城</title>
|
||
<url>/posts/45726.html</url>
|
||
<content><![CDATA[<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/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://qingling.icu/posts/47407.html">VMWare虚拟机安装Linux教程 | The Blog (qingling.icu)</a></strong></p>
|
||
<p>将Linxu的IP地址固定下来</p>
|
||
<p><strong><a href="https://qingling.icu/posts/21883.html">Linux设置静态IP | The Blog (qingling.icu)</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://qingling.icu/posts/19306.html">Docker容器化技术 | The Blog (qingling.icu)</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="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='SET collation_connection = utf8_unicode_ci'</span><br><span class="line">init_connect='SET NAMES utf8'</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="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> set name tom #存值</span><br><span class="line">OK</span><br><span class="line">127.0.0.1:6379> get name #取值</span><br><span class="line">"tom"</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://qingling.icu/posts/63333.html">开发环境的搭建 | The Blog (qingling.icu)</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 href="https://git-scm.com/downloads">https://git-scm.com/downloads</a></strong></p>
|
||
<figure class="highlight shell"><table><tr><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 "用户名" #随意</span><br><span class="line">git config --global user.email "邮箱" #自己的邮箱</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 "在码云上注册的邮箱地址" #连续三次回车</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 href="https://gitee.com/renrenio">https://gitee.com/renrenio</a></strong></p>
|
||
<p><strong>后端renren-fast:<a href="https://gitee.com/renrenio/renren-fast.git">https://gitee.com/renrenio/renren-fast.git</a></strong></p>
|
||
<p><strong>前端renren-fast-vue:<a 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="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="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="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 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 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="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 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="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&characterEncoding=UTF-8&useSSL=false&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="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="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&characterEncoding=UTF-8&useSSL=false&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="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&characterEncoding=UTF-8&useSSL=false&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="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 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 :注册中心(服务发现/注册)</strong></p>
|
||
<p><strong>SpringCloud Alibaba - Nacos :配置中心(动态的配置管理)</strong></p>
|
||
<p><strong>SpringCloud - Ribbon: 负载均衡</strong></p>
|
||
<p><strong>SpringCloud - Feign: 声明式HTTP客户端(远程调用服务/服务调用)</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="code"><pre><span class="line"><span class="tag"><<span class="name">dependencyManagement</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependencies</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.alibaba.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-alibaba-dependencies<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.2.0.RELEASE<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">type</span>></span>pom<span class="tag"></<span class="name">type</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">scope</span>></span>import<span class="tag"></<span class="name">scope</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependencies</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependencyManagement</span>></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="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.alibaba.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-starter-alibaba-nacos-discovery<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>配置中心中配置Nacos的地址</p>
|
||
<figure class="highlight yaml"><table><tr><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="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="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="code"><pre><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-starter-openfeign<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>编写代码测试远程调用,这里我们以用户模块调用优惠卷模块来获取用户的拥有的优惠卷为例来测试远程调用。</p>
|
||
<p><em><strong>会员模块提供获取用户名下优惠卷的方法</strong></em></p>
|
||
<figure class="highlight java"><table><tr><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("member/list")</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"> <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">"满一百减五十"</span>);</span><br><span class="line"> <span class="keyword">return</span> R.ok().put(<span class="string">"coupons"</span>,Arrays.asList(couponEntity));</span><br><span class="line">}</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="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 = "com.atguigu.gulimall.member.feign")</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><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("gulimall-coupon")</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> {</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("/coupon/coupon/member/list")</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">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><em><strong>测试远程调用</strong></em></p>
|
||
<figure class="highlight java"><table><tr><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("/coupons")</span></span><br><span class="line"><span class="keyword">public</span> R <span class="title function_">test</span><span class="params">()</span>{</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">"张三"</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">"member"</span>, memberEntity).put(<span class="string">"coupons"</span>, membercoupons.get(<span class="string">"coupons"</span>));</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>测试的时候出现的小问题</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!--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中的依赖改成如下的依赖--></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.alibaba.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-starter-alibaba-nacos-discovery<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">exclusions</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">exclusion</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-starter-netflix-ribbon<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">exclusion</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">exclusions</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-loadbalancer<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.2.2.RELEASE<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>处理完上面的报错之后,浏览器访问 <a 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="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.alibaba.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-starter-alibaba-nacos-config<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></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="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="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="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("${user.name}")</span></span><br><span class="line"><span class="keyword">private</span> String name;</span><br><span class="line"><span class="meta">@Value("${user.age}")</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("/test")</span></span><br><span class="line"><span class="keyword">public</span> R <span class="title function_">test</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> R.ok().put(<span class="string">"name"</span>,name).put(<span class="string">"age"</span>,age);</span><br><span class="line">}</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="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-starter-bootstrap<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>4.0.1<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></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="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="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.alibaba.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-starter-alibaba-nacos-config<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure></li>
|
||
<li><p>创建一个bootstrap.properties的配置文件,添加如下的内容:</p>
|
||
<figure class="highlight properties"><table><tr><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="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="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="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="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="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 = {DataSourceAutoConfiguration.class})解决。</p>
|
||
</li>
|
||
<li><p>转发测试</p>
|
||
<p><strong>测试案例:</strong>我们在浏览器的地址栏输入localhost:88?url=baidu,就给我们转发到百度,输入localhost:88?url=qq就给我们转发到腾讯qq</p>
|
||
<p><strong>实现:</strong>创建一个yml的配置文件,在配置文件中添加如下的配置</p>
|
||
<figure class="highlight yaml"><table><tr><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://qingling.icu/posts/432.html">前端基础知识 | The Blog (qingling.icu)</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="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("/list/tree")</span></span><br><span class="line"> <span class="keyword">public</span> R <span class="title function_">list</span><span class="params">()</span>{</span><br><span class="line"> List<CategoryEntity> entities = categoryService.listWithTree();</span><br><span class="line"> <span class="keyword">return</span> R.ok().put(<span class="string">"data"</span>, entities);</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>service</strong></p>
|
||
<figure class="highlight java"><table><tr><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("categoryService")</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><CategoryDao, CategoryEntity> <span class="keyword">implements</span> <span class="title class_">CategoryService</span> {</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<String, Object> params)</span> {</span><br><span class="line"> IPage<CategoryEntity> page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span><CategoryEntity>().getPage(params),</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">QueryWrapper</span><CategoryEntity>()</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"> }</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<CategoryEntity> <span class="title function_">listWithTree</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//查出所有的分类</span></span><br><span class="line"> List<CategoryEntity> 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<CategoryEntity> level1List = entities.stream().filter(categoryEntity -></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) -> {</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"> }).sorted((menu1, menu2) -> {</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"> }).collect(Collectors.toList());</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> level1List;</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 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<CategoryEntity> <span class="title function_">getChildren</span><span class="params">(CategoryEntity root, List<CategoryEntity> all)</span> {</span><br><span class="line"> List<CategoryEntity> children = all.stream().filter(categoryEntity -> {</span><br><span class="line"> <span class="keyword">return</span> categoryEntity.getParentCid().equals(root.getCatId());</span><br><span class="line"> }).map(categoryEntity -> {</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"> }).sorted((menu1, menu2) -> {</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"> }).collect(Collectors.toList());</span><br><span class="line"> <span class="keyword">return</span> children;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</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="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>) {</span><br><span class="line"> <span class="variable language_">window</span>.<span class="property">SITE_CONFIG</span> = {};</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">'baseUrl'</span>] = <span class="string">'http://localhost:88'</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">'domain'</span>] = <span class="string">'./'</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">'version'</span>] = <span class="string">''</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">'cdnUrl'</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">})();</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="code"><pre><span class="line"><span class="comment"><!-- 修改springBoot的版本 --></span></span><br><span class="line"><span class="tag"><<span class="name">parent</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-parent<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.2.6.RELEASE<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">relativePath</span>/></span> </span><br><span class="line"><span class="tag"></<span class="name">parent</span>></span></span><br><span class="line"><span class="comment"><!-- 依赖common文件,获取nacos相关的注解 --></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.atguigu<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>gulimall-common<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>1.0-SNAPSHOT<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>在启动类上添加@EnableDiscoveryClient注解,在配置文件中添加上nacos地址的配置</p>
|
||
<figure class="highlight yaml"><table><tr><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="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/(?<segment>.*),/renren-fast/$\{segment}</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 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="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> {</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>{</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">"*"</span>);</span><br><span class="line"> <span class="comment">//允许所有的请求方式跨域</span></span><br><span class="line"> corsConfiguration.addAllowedMethod(<span class="string">"*"</span>);</span><br><span class="line"> <span class="comment">//任意请求来源都可以跨域</span></span><br><span class="line"> <span class="comment">//corsConfiguration.addAllowedOrigin("*"); 老版本的springBoot使用这个,新版本的使用下面这个</span></span><br><span class="line"> corsConfiguration.addAllowedOriginPattern(<span class="string">"*"</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">"/**"</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"> }</span><br><span class="line">}</span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>注掉renren-fast工程中的跨域配置,避免产生两次跨域的问题</p>
|
||
<figure class="highlight java"><table><tr><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> {</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) {</span></span><br><span class="line"><span class="comment">// registry.addMapping("/**")</span></span><br><span class="line"><span class="comment">// .allowedOrigins("*")</span></span><br><span class="line"><span class="comment">// .allowCredentials(true)</span></span><br><span class="line"><span class="comment">// .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")</span></span><br><span class="line"><span class="comment">// .maxAge(3600);</span></span><br><span class="line"><span class="comment">// }</span></span><br><span class="line">}</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="code"><pre><span class="line"><template></span><br><span class="line"> <div></span><br><span class="line"> <!-- 树形控件 --></span><br><span class="line"> <el-tree</span><br><span class="line"> :data="data"</span><br><span class="line"> :props="defaultProps"</span><br><span class="line"> @node-click="handleNodeClick"</span><br><span class="line"> ></el-tree></span><br><span class="line"> </div></span><br><span class="line"></template></span><br><span class="line"></span><br><span class="line"><script></span><br><span class="line">export default {</span><br><span class="line"> //定义变量</span><br><span class="line"> data() {</span><br><span class="line"> return {</span><br><span class="line"> data: [],</span><br><span class="line"> defaultProps: {</span><br><span class="line"> children: "children",</span><br><span class="line"> label: "label",</span><br><span class="line"> },</span><br><span class="line"> };</span><br><span class="line"> },</span><br><span class="line"> //钩子函数</span><br><span class="line"> created() {</span><br><span class="line"> this.getMenus();</span><br><span class="line"> },</span><br><span class="line"></span><br><span class="line"> //方法</span><br><span class="line"> methods: {</span><br><span class="line"> handleNodeClick(data) {</span><br><span class="line"> console.log(data);</span><br><span class="line"> },</span><br><span class="line"> //获取所有的菜单</span><br><span class="line"> getMenus() {</span><br><span class="line"> //正式的发送请求</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/list/tree"),</span><br><span class="line"> method: "get",</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> console.log(data);</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> },</span><br><span class="line">};</span><br><span class="line"></script></span><br><span class="line"><style></span><br><span class="line"></style></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>6.树形显示商品的分类信息</p>
|
||
<p>前端修改网关商品模块的路由(注意:匹配精确的路由放在模糊的路由的上面)</p>
|
||
<figure class="highlight yaml"><table><tr><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/(?<segment>.*),/$\{segment}</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/(?<segment>.*),/renren-fast/$\{segment}</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="code"><pre><span class="line"><template></span><br><span class="line"> <div></span><br><span class="line"> <!-- 树形控件 --></span><br><span class="line"> <el-tree</span><br><span class="line"> :data="menus"</span><br><span class="line"> :props="defaultProps"</span><br><span class="line"> @node-click="handleNodeClick"</span><br><span class="line"> ></el-tree></span><br><span class="line"> </div></span><br><span class="line"></template></span><br><span class="line"></span><br><span class="line"><script></span><br><span class="line">export default {</span><br><span class="line"> //定义变量</span><br><span class="line"> data() {</span><br><span class="line"> return {</span><br><span class="line"> menus: [],</span><br><span class="line"> defaultProps: {//这里的配置看官方的文档</span><br><span class="line"> children: "children",//父节点上的子节点</span><br><span class="line"> label: "name",//每个对象要显示的属性值,比如我们当前要显示商品分类中的分类名的值,这里就改成name</span><br><span class="line"> },</span><br><span class="line"> };</span><br><span class="line"> },</span><br><span class="line"> //钩子函数</span><br><span class="line"> created() {</span><br><span class="line"> //调用获取商品分类数据的方法</span><br><span class="line"> this.getMenus();</span><br><span class="line"> },</span><br><span class="line"></span><br><span class="line"> //方法</span><br><span class="line"> methods: {</span><br><span class="line"> handleNodeClick(data) {</span><br><span class="line"> console.log(data);</span><br><span class="line"> },</span><br><span class="line"> //获取所有的菜单</span><br><span class="line"> getMenus() {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/list/tree"),</span><br><span class="line"> method: "get",</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.menus = data.data;</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> },</span><br><span class="line">};</span><br><span class="line"></script></span><br><span class="line"></span><br><span class="line"><style></span><br><span class="line"></style></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="code"><pre><span class="line"><template></span><br><span class="line"> <!-- 树形控件--></span><br><span class="line"> <!-- :expand-on-click-node="false"设置为点击箭头的时候才会展开,避免点击删除的按钮的时候展开 --></span><br><span class="line"> <!-- show-checkbox表示开启选择框,批量选择--></span><br><span class="line"> <!-- node-key表示在整个树中唯一的表示 --></span><br><span class="line"> <el-tree</span><br><span class="line"> :data="menus"</span><br><span class="line"> :props="defaultProps"</span><br><span class="line"> :expand-on-click-node="false"</span><br><span class="line"> show-checkbox</span><br><span class="line"> node-key="catId"</span><br><span class="line"> :default-expanded-keys="expandedKey"</span><br><span class="line"> ></span><br><span class="line"> <span class="custom-tree-node" slot-scope="{ node, data }"></span><br><span class="line"> <span>{{ node.label }}</span></span><br><span class="line"> <span></span><br><span class="line"> <el-button</span><br><span class="line"> v-if="node.level <= 2"</span><br><span class="line"> type="text"</span><br><span class="line"> size="mini"</span><br><span class="line"> @click="() => append(data)"</span><br><span class="line"> ></span><br><span class="line"> 添加</span><br><span class="line"> </el-button></span><br><span class="line"> <!-- 添加判断,没有下一级节点的时候就显示删除的按钮 --></span><br><span class="line"> <el-button</span><br><span class="line"> v-if="data.children.length <= 0"</span><br><span class="line"> type="text"</span><br><span class="line"> size="mini"</span><br><span class="line"> @click="() => remove(node, data)"</span><br><span class="line"> ></span><br><span class="line"> 删除</span><br><span class="line"> </el-button></span><br><span class="line"> </span></span><br><span class="line"> </span></el-tree</span><br><span class="line"> ></span><br><span class="line"></template></span><br><span class="line"></span><br><span class="line"><script></span><br><span class="line">export default {</span><br><span class="line"> //定义变量</span><br><span class="line"> data() {</span><br><span class="line"> return {</span><br><span class="line"> menus: [],</span><br><span class="line"> defaultProps: {</span><br><span class="line"> //这里的配置看官方的文档</span><br><span class="line"> children: "children", //父节点上的子节点</span><br><span class="line"> label: "name", //每个对象要显示的属性值,比如我们当前要显示商品分类中的分类名的值,这里就改成name</span><br><span class="line"> },</span><br><span class="line"> expandedKey:[] //需要展开的数组,用于删除之后树形控件仍然展开</span><br><span class="line"> };</span><br><span class="line"> },</span><br><span class="line"> //钩子函数</span><br><span class="line"> created() {</span><br><span class="line"> //调用获取商品分类数据的方法</span><br><span class="line"> this.getMenus();</span><br><span class="line"> },</span><br><span class="line"></span><br><span class="line"> //方法</span><br><span class="line"> methods: {</span><br><span class="line"> append(data) {</span><br><span class="line"> console.log("append: ", data);</span><br><span class="line"> },</span><br><span class="line"> //删除节点的方法</span><br><span class="line"> remove(node, data) {</span><br><span class="line"> var ids = [data.catId];</span><br><span class="line"> this.$confirm(`是否要删除[${data.name}]菜单?`, "提示", {</span><br><span class="line"> confirmButtonText: "确定",</span><br><span class="line"> cancelButtonText: "取消",</span><br><span class="line"> type: "warning",</span><br><span class="line"> })</span><br><span class="line"> .then(() => {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/delete"),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData(ids, false),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "菜单删除成功",</span><br><span class="line"> type: "success",</span><br><span class="line"> });</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"> });</span><br><span class="line"> })</span><br><span class="line"> .catch(() => {</span><br><span class="line"> this.$message({</span><br><span class="line"> type: "info",</span><br><span class="line"> message: "已取消删除",</span><br><span class="line"> });</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> //获取所有的菜单</span><br><span class="line"> getMenus() {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/list/tree"),</span><br><span class="line"> method: "get",</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.menus = data.data;</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> },</span><br><span class="line">};</span><br><span class="line"></script></span><br><span class="line"></span><br><span class="line"><style></span><br><span class="line"></style></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>配置逻辑删除</strong></p>
|
||
<p>配置全局的逻辑删除规则</p>
|
||
<figure class="highlight yaml"><table><tr><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="code"><pre><span class="line"><span class="meta">@TableLogic(value = "1",delval = "0")</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>后端代码的实现</p>
|
||
<p>controlller</p>
|
||
<figure class="highlight java"><table><tr><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("/delete")</span></span><br><span class="line"><span class="comment">//@RequiresPermissions("product:category:delete")</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> {</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">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>service 这里后面需要优化</p>
|
||
<figure class="highlight java"><table><tr><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<Long> list)</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"> categoryDao.deleteBatchIds(list);</span><br><span class="line">}</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="code"><pre><span class="line"><template></span><br><span class="line"> <div></span><br><span class="line"> <!-- 树形控件--></span><br><span class="line"> <!-- :expand-on-click-node="false"设置为点击箭头的时候才会展开,避免点击删除的按钮的时候展开 --></span><br><span class="line"> <!-- show-checkbox表示开启选择框,批量选择--></span><br><span class="line"> <!-- node-key表示在整个树中唯一的表示 --></span><br><span class="line"> <el-tree</span><br><span class="line"> :data="menus"</span><br><span class="line"> :props="defaultProps"</span><br><span class="line"> :expand-on-click-node="false"</span><br><span class="line"> show-checkbox</span><br><span class="line"> node-key="catId"</span><br><span class="line"> :default-expanded-keys="expandedKey"</span><br><span class="line"> ></span><br><span class="line"> <span class="custom-tree-node" slot-scope="{ node, data }"></span><br><span class="line"> <span>{{ node.label }}</span></span><br><span class="line"> <span></span><br><span class="line"> <el-button</span><br><span class="line"> v-if="node.level <= 2"</span><br><span class="line"> type="text"</span><br><span class="line"> size="mini"</span><br><span class="line"> @click="() => append(data)"</span><br><span class="line"> ></span><br><span class="line"> 添加</span><br><span class="line"> </el-button></span><br><span class="line"> <!-- 添加判断,没有下一级节点的时候就显示删除的按钮 --></span><br><span class="line"> <el-button</span><br><span class="line"> v-if="data.children.length <= 0"</span><br><span class="line"> type="text"</span><br><span class="line"> size="mini"</span><br><span class="line"> @click="() => remove(node, data)"</span><br><span class="line"> ></span><br><span class="line"> 删除</span><br><span class="line"> </el-button></span><br><span class="line"> </span></span><br><span class="line"> </span></el-tree</span><br><span class="line"> ></span><br><span class="line"> <!-- 添加分类的时候弹出的对话框 --></span><br><span class="line"> <el-dialog title="提示" :visible.sync="dialogVisible" width="30%"></span><br><span class="line"> <el-form :model="category"></span><br><span class="line"> <el-form-item label="分类名称"></span><br><span class="line"> <el-input v-model="category.name" autocomplete="off"></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> </el-form></span><br><span class="line"> <span slot="footer" class="dialog-footer"></span><br><span class="line"> <el-button @click="dialogVisible = false">取 消</el-button></span><br><span class="line"> <el-button type="primary" @click="addCategory">确 定</el-button></span><br><span class="line"> </span></span><br><span class="line"> </el-dialog></span><br><span class="line"> </div></span><br><span class="line"></template></span><br><span class="line"></span><br><span class="line"><script></span><br><span class="line">export default {</span><br><span class="line"> //定义变量</span><br><span class="line"> data() {</span><br><span class="line"> return {</span><br><span class="line"> menus: [],</span><br><span class="line"> defaultProps: {</span><br><span class="line"> //这里的配置看官方的文档</span><br><span class="line"> children: "children", //父节点上的子节点</span><br><span class="line"> label: "name", //每个对象要显示的属性值,比如我们当前要显示商品分类中的分类名的值,这里就改成name</span><br><span class="line"> },</span><br><span class="line"> expandedKey: [], //需要展开的数组,用于删除之后树形控件仍然展开</span><br><span class="line"> dialogVisible: false, //添加菜单的对话框的开启或者关闭</span><br><span class="line"> //表单绑定的对象</span><br><span class="line"> category: {</span><br><span class="line"> name: "", //分类的名称</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"> },</span><br><span class="line"> };</span><br><span class="line"> },</span><br><span class="line"> //钩子函数</span><br><span class="line"> created() {</span><br><span class="line"> //调用获取商品分类数据的方法</span><br><span class="line"> this.getMenus();</span><br><span class="line"> },</span><br><span class="line"></span><br><span class="line"> //方法</span><br><span class="line"> methods: {</span><br><span class="line"> //添加分类(弹出的对话框确定按钮执行的方法)</span><br><span class="line"> addCategory() {</span><br><span class="line"> console.log("提交的数据:", this.category);</span><br><span class="line"> //将添加的数据返回给后端</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/save"),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData(this.category, false),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "菜单添加成功",</span><br><span class="line"> type: "success",</span><br><span class="line"> });</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"> });</span><br><span class="line"> //关闭对话框</span><br><span class="line"> this.dialogVisible = false;</span><br><span class="line"> },</span><br><span class="line"> //添加分类的方法</span><br><span class="line"> append(data) {</span><br><span class="line"> //清空一下表单的数据</span><br><span class="line"> this.category.name = "";</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"> },</span><br><span class="line"> //删除节点的方法</span><br><span class="line"> remove(node, data) {</span><br><span class="line"> var ids = [data.catId];</span><br><span class="line"> this.$confirm(`是否要删除[${data.name}]菜单?`, "提示", {</span><br><span class="line"> confirmButtonText: "确定",</span><br><span class="line"> cancelButtonText: "取消",</span><br><span class="line"> type: "warning",</span><br><span class="line"> })</span><br><span class="line"> .then(() => {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/delete"),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData(ids, false),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "菜单删除成功",</span><br><span class="line"> type: "success",</span><br><span class="line"> });</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"> });</span><br><span class="line"> })</span><br><span class="line"> .catch(() => {</span><br><span class="line"> this.$message({</span><br><span class="line"> type: "info",</span><br><span class="line"> message: "已取消删除",</span><br><span class="line"> });</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> //获取所有的菜单</span><br><span class="line"> getMenus() {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/list/tree"),</span><br><span class="line"> method: "get",</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.menus = data.data;</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> },</span><br><span class="line">};</span><br><span class="line"></script></span><br><span class="line"></span><br><span class="line"><style></span><br><span class="line"></style></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>后端代码</p>
|
||
<figure class="highlight java"><table><tr><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("/save")</span></span><br><span class="line"><span class="comment">//@RequiresPermissions("product:category:save")</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> {</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">}</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="code"><pre><span class="line"><template></span><br><span class="line"> <div></span><br><span class="line"> <!-- 树形控件--></span><br><span class="line"> <!-- :expand-on-click-node="false"设置为点击箭头的时候才会展开,避免点击删除的按钮的时候展开 --></span><br><span class="line"> <!-- show-checkbox表示开启选择框,批量选择--></span><br><span class="line"> <!-- node-key表示在整个树中唯一的表示 --></span><br><span class="line"> <!-- draggable 实现节点自由拖拽的效果 --></span><br><span class="line"> <el-tree</span><br><span class="line"> :data="menus"</span><br><span class="line"> :props="defaultProps"</span><br><span class="line"> :expand-on-click-node="false"</span><br><span class="line"> show-checkbox</span><br><span class="line"> node-key="catId"</span><br><span class="line"> :default-expanded-keys="expandedKey"</span><br><span class="line"> draggable</span><br><span class="line"> :allow-drop="allowDrop"</span><br><span class="line"> @node-drop="handleDrop"</span><br><span class="line"> ></span><br><span class="line"> <span class="custom-tree-node" slot-scope="{ node, data }"></span><br><span class="line"> <span>{{ node.label }}</span></span><br><span class="line"> <span></span><br><span class="line"> <el-button</span><br><span class="line"> v-if="node.level <= 2"</span><br><span class="line"> type="text"</span><br><span class="line"> size="mini"</span><br><span class="line"> @click="() => append(data)"</span><br><span class="line"> ></span><br><span class="line"> 添加</span><br><span class="line"> </el-button></span><br><span class="line"> <el-button type="text" size="mini" @click="() => edit(data)"></span><br><span class="line"> 修改</span><br><span class="line"> </el-button></span><br><span class="line"> <!-- 添加判断,没有下一级节点的时候就显示删除的按钮 --></span><br><span class="line"> <el-button</span><br><span class="line"> v-if="data.children.length <= 0"</span><br><span class="line"> type="text"</span><br><span class="line"> size="mini"</span><br><span class="line"> @click="() => remove(node, data)"</span><br><span class="line"> ></span><br><span class="line"> 删除</span><br><span class="line"> </el-button></span><br><span class="line"> </span></span><br><span class="line"> </span></el-tree</span><br><span class="line"> ></span><br><span class="line"> <!-- 添加分类的时候弹出的对话框 --></span><br><span class="line"> <el-dialog</span><br><span class="line"> :title="title"</span><br><span class="line"> :visible.sync="dialogVisible"</span><br><span class="line"> width="30%"</span><br><span class="line"> :close-on-click-modal="false"</span><br><span class="line"> ></span><br><span class="line"> <el-form :model="category"></span><br><span class="line"> <el-form-item label="分类名称"></span><br><span class="line"> <el-input v-model="category.name" autocomplete="off"></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item label="图标"></span><br><span class="line"> <el-input v-model="category.icon" autocomplete="off"></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item label="计量单位"></span><br><span class="line"> <el-input</span><br><span class="line"> v-model="category.productUnit"</span><br><span class="line"> autocomplete="off"</span><br><span class="line"> ></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> </el-form></span><br><span class="line"> <span slot="footer" class="dialog-footer"></span><br><span class="line"> <el-button @click="dialogVisible = false">取 消</el-button></span><br><span class="line"> <el-button type="primary" @click="submitDate">确 定</el-button></span><br><span class="line"> </span></span><br><span class="line"> </el-dialog></span><br><span class="line"> </div></span><br><span class="line"></template></span><br><span class="line"></span><br><span class="line"><script></span><br><span class="line">export default {</span><br><span class="line"> //定义变量</span><br><span class="line"> data() {</span><br><span class="line"> return {</span><br><span class="line"> updateNodes: [], //经过修改之后的节点的信息</span><br><span class="line"> maxLevel: 0, //最大的层级</span><br><span class="line"> title: "", //弹出框的提示信息</span><br><span class="line"> dialogType: "", //弹出的对话框的类型 edit/add</span><br><span class="line"> menus: [],</span><br><span class="line"> defaultProps: {</span><br><span class="line"> //这里的配置看官方的文档</span><br><span class="line"> children: "children", //父节点上的子节点</span><br><span class="line"> label: "name", //每个对象要显示的属性值,比如我们当前要显示商品分类中的分类名的值,这里就改成name</span><br><span class="line"> },</span><br><span class="line"> expandedKey: [], //需要展开的数组,用于删除之后树形控件仍然展开</span><br><span class="line"> dialogVisible: false, //添加菜单的对话框的开启或者关闭</span><br><span class="line"> //表单绑定的对象</span><br><span class="line"> category: {</span><br><span class="line"> name: "", //分类的名称</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: "", //商品分类的图标</span><br><span class="line"> productUnit: "", //计量单位</span><br><span class="line"> },</span><br><span class="line"> };</span><br><span class="line"> },</span><br><span class="line"> //钩子函数</span><br><span class="line"> created() {</span><br><span class="line"> //调用获取商品分类数据的方法</span><br><span class="line"> this.getMenus();</span><br><span class="line"> },</span><br><span class="line"></span><br><span class="line"> //方法</span><br><span class="line"> methods: {</span><br><span class="line"> //拖拽成功之后调用这个函数进行回调的处理</span><br><span class="line"> handleDrop(draggingNode, dropNode, dropType, ev) {</span><br><span class="line"> console.log("handleDrop: ", 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 == "before" || dropType == "after") {</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"> } else {</span><br><span class="line"> pCid = dropNode.data.catId;</span><br><span class="line"> siblings = dropNode.childNodes;</span><br><span class="line"> }</span><br><span class="line"> //当前的节点的最新的顺序</span><br><span class="line"> for (let i = 0; i < siblings.length; i++) {</span><br><span class="line"> if (siblings[i].data.catId == draggingNode.data.catId) {</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) {</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"> }</span><br><span class="line"> this.updateNodes.push({</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"> });</span><br><span class="line"> } else {</span><br><span class="line"> this.updateNodes.push({ catId: siblings[i].data.catId, sort: i });</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> //当前的拖拽节点的最新的层级</span><br><span class="line"> console.log("updateNodes:", this.updateNodes);</span><br><span class="line"> },</span><br><span class="line"> //递归修改子节点的层级</span><br><span class="line"> updateChildNodeLevel(node) {</span><br><span class="line"> if ((node.childNodes, length > 0)) {</span><br><span class="line"> for (let i = 0; i < node.childNodes.length; i++) {</span><br><span class="line"> var cNode = node.childNodes[i].data;</span><br><span class="line"> this.updateNodes.push({</span><br><span class="line"> catId: cNode.catId,</span><br><span class="line"> catLevel: node.childNodes[i].level,</span><br><span class="line"> });</span><br><span class="line"> //递归调用</span><br><span class="line"> this.updateChildNodeLevel(node.childNodes[i]);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> },</span><br><span class="line"> //拖拽之后节点的位置的判断 是否的可以放在该位置上面</span><br><span class="line"> allowDrop(draggingNode, dropNode, type) {</span><br><span class="line"> //判断被拖动的当前节点以及所在的父节点的总层数不能大于三</span><br><span class="line"> //被拖动的当前节点的总层数</span><br><span class="line"> console.log("allowDrop:", 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("深度:", deep);</span><br><span class="line"> if ((type = "inner")) {</span><br><span class="line"> return deep + dropNode.level <= 3;</span><br><span class="line"> } else {</span><br><span class="line"> return deep + dropNode.parent.level <= 3;</span><br><span class="line"> }</span><br><span class="line"> },</span><br><span class="line"> //统计当前的节点的总层数</span><br><span class="line"> countNodeLevel(node) {</span><br><span class="line"> //找到所有子节点 求出最大深度</span><br><span class="line"> if (node.children != null && node.children.length > 0) {</span><br><span class="line"> for (let i = 0; i < node.children.length; i++) {</span><br><span class="line"> if (node.children[i].catLevel > this.maxLevel) {</span><br><span class="line"> this.maxLevel = node.children[i].catLevel;</span><br><span class="line"> }</span><br><span class="line"> //递归一下</span><br><span class="line"> this.countNodeLevel(node.children[i]);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> },</span><br><span class="line"> //弹出修改的对话框,并做数据的回显</span><br><span class="line"> edit(data) {</span><br><span class="line"> //修改的title</span><br><span class="line"> this.title = "修改分类";</span><br><span class="line"> //设置弹出的对话框为修改的类型</span><br><span class="line"> this.dialogType = "edit";</span><br><span class="line"> //发送请求回显数据</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl(`/product/category/info/${data.catId}`),</span><br><span class="line"> method: "get",</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> //请求成功 回显数据</span><br><span class="line"> console.log("回显的数据:", 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"> });</span><br><span class="line"> //弹出对话框</span><br><span class="line"> this.dialogVisible = true;</span><br><span class="line"> },</span><br><span class="line"> //保存或者添加数据</span><br><span class="line"> submitDate() {</span><br><span class="line"> if (this.dialogType == "add") {</span><br><span class="line"> //调用添加的方法</span><br><span class="line"> this.addCategory();</span><br><span class="line"> }</span><br><span class="line"> if (this.dialogType == "edit") {</span><br><span class="line"> //修改的方法</span><br><span class="line"> this.editCategory();</span><br><span class="line"> }</span><br><span class="line"> },</span><br><span class="line"> //修改商品的分类信息</span><br><span class="line"> editCategory() {</span><br><span class="line"> //只发送我们要修改的数据</span><br><span class="line"> var { catId, name, icon, productUnit } = this.category;</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/update"),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData({ catId, name, icon, productUnit }, false),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "分类修改成功",</span><br><span class="line"> type: "success",</span><br><span class="line"> });</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"> });</span><br><span class="line"> },</span><br><span class="line"> //添加分类(弹出的对话框确定按钮执行的方法)</span><br><span class="line"> addCategory() {</span><br><span class="line"> console.log("提交的数据:", this.category);</span><br><span class="line"> //将添加的数据返回给后端</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/save"),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData(this.category, false),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "分类添加成功",</span><br><span class="line"> type: "success",</span><br><span class="line"> });</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"> });</span><br><span class="line"> //关闭对话框</span><br><span class="line"> this.dialogVisible = false;</span><br><span class="line"> },</span><br><span class="line"> //添加分类的方法</span><br><span class="line"> append(data) {</span><br><span class="line"> //添加的title</span><br><span class="line"> this.title = "添加分类";</span><br><span class="line"> //设置当前提交的对话框为添加的对话框</span><br><span class="line"> this.dialogType = "add";</span><br><span class="line"> //清空一下表单的数据</span><br><span class="line"> this.category.name = "";</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 = "";</span><br><span class="line"> this.category.productUnit = "";</span><br><span class="line"> this.category.sort = 0;</span><br><span class="line"> this.category.showStatus = 1;</span><br><span class="line"> },</span><br><span class="line"> //删除节点的方法</span><br><span class="line"> remove(node, data) {</span><br><span class="line"> var ids = [data.catId];</span><br><span class="line"> this.$confirm(`是否要删除[${data.name}]菜单?`, "提示", {</span><br><span class="line"> confirmButtonText: "确定",</span><br><span class="line"> cancelButtonText: "取消",</span><br><span class="line"> type: "warning",</span><br><span class="line"> })</span><br><span class="line"> .then(() => {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/delete"),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData(ids, false),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "菜单删除成功",</span><br><span class="line"> type: "success",</span><br><span class="line"> });</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"> });</span><br><span class="line"> })</span><br><span class="line"> .catch(() => {</span><br><span class="line"> this.$message({</span><br><span class="line"> type: "info",</span><br><span class="line"> message: "已取消删除",</span><br><span class="line"> });</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> //获取所有的菜单</span><br><span class="line"> getMenus() {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/list/tree"),</span><br><span class="line"> method: "get",</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.menus = data.data;</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> },</span><br><span class="line">};</span><br><span class="line"></script></span><br><span class="line"></span><br><span class="line"><style></span><br><span class="line"></style></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>老师的前端的代码</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><template></span><br><span class="line"> <div></span><br><span class="line"> <el-switch v-model="draggable" active-text="开启拖拽" inactive-text="关闭拖拽"></el-switch></span><br><span class="line"> <el-button v-if="draggable" @click="batchSave">批量保存</el-button></span><br><span class="line"> <el-button type="danger" @click="batchDelete">批量删除</el-button></span><br><span class="line"> <el-tree</span><br><span class="line"> :data="menus"</span><br><span class="line"> :props="defaultProps"</span><br><span class="line"> :expand-on-click-node="false"</span><br><span class="line"> show-checkbox</span><br><span class="line"> node-key="catId"</span><br><span class="line"> :default-expanded-keys="expandedKey"</span><br><span class="line"> :draggable="draggable"</span><br><span class="line"> :allow-drop="allowDrop"</span><br><span class="line"> @node-drop="handleDrop"</span><br><span class="line"> ref="menuTree"</span><br><span class="line"> ></span><br><span class="line"> <span class="custom-tree-node" slot-scope="{ node, data }"></span><br><span class="line"> <span>{{ node.label }}</span></span><br><span class="line"> <span></span><br><span class="line"> <el-button</span><br><span class="line"> v-if="node.level <=2"</span><br><span class="line"> type="text"</span><br><span class="line"> size="mini"</span><br><span class="line"> @click="() => append(data)"</span><br><span class="line"> >Append</el-button></span><br><span class="line"> <el-button type="text" size="mini" @click="edit(data)">edit</el-button></span><br><span class="line"> <el-button</span><br><span class="line"> v-if="node.childNodes.length==0"</span><br><span class="line"> type="text"</span><br><span class="line"> size="mini"</span><br><span class="line"> @click="() => remove(node, data)"</span><br><span class="line"> >Delete</el-button></span><br><span class="line"> </span></span><br><span class="line"> </span></span><br><span class="line"> </el-tree></span><br><span class="line"></span><br><span class="line"> <el-dialog</span><br><span class="line"> :title="title"</span><br><span class="line"> :visible.sync="dialogVisible"</span><br><span class="line"> width="30%"</span><br><span class="line"> :close-on-click-modal="false"</span><br><span class="line"> ></span><br><span class="line"> <el-form :model="category"></span><br><span class="line"> <el-form-item label="分类名称"></span><br><span class="line"> <el-input v-model="category.name" autocomplete="off"></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item label="图标"></span><br><span class="line"> <el-input v-model="category.icon" autocomplete="off"></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item label="计量单位"></span><br><span class="line"> <el-input v-model="category.productUnit" autocomplete="off"></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> </el-form></span><br><span class="line"> <span slot="footer" class="dialog-footer"></span><br><span class="line"> <el-button @click="dialogVisible = false">取 消</el-button></span><br><span class="line"> <el-button type="primary" @click="submitData">确 定</el-button></span><br><span class="line"> </span></span><br><span class="line"> </el-dialog></span><br><span class="line"> </div></span><br><span class="line"></template></span><br><span class="line"></span><br><span class="line"><script></span><br><span class="line">//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)</span><br><span class="line">//例如:import 《组件名称》 from '《组件路径》';</span><br><span class="line"></span><br><span class="line">export default {</span><br><span class="line"> //import引入的组件需要注入到对象中才能使用</span><br><span class="line"> components: {},</span><br><span class="line"> props: {},</span><br><span class="line"> data() {</span><br><span class="line"> return {</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: "",</span><br><span class="line"> dialogType: "", //edit,add</span><br><span class="line"> category: {</span><br><span class="line"> name: "",</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: "",</span><br><span class="line"> icon: "",</span><br><span class="line"> catId: null</span><br><span class="line"> },</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: {</span><br><span class="line"> children: "children",</span><br><span class="line"> label: "name"</span><br><span class="line"> }</span><br><span class="line"> };</span><br><span class="line"> },</span><br><span class="line"></span><br><span class="line"> //计算属性 类似于data概念</span><br><span class="line"> computed: {},</span><br><span class="line"> //监控data中的数据变化</span><br><span class="line"> watch: {},</span><br><span class="line"> //方法集合</span><br><span class="line"> methods: {</span><br><span class="line"> getMenus() {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/list/tree"),</span><br><span class="line"> method: "get"</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> console.log("成功获取到菜单数据...", data.data);</span><br><span class="line"> this.menus = data.data;</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> batchDelete() {</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("被选中的元素", checkedNodes);</span><br><span class="line"> for (let i = 0; i < checkedNodes.length; i++) {</span><br><span class="line"> catIds.push(checkedNodes[i].catId);</span><br><span class="line"> }</span><br><span class="line"> this.$confirm(`是否批量删除【${catIds}】菜单?`, "提示", {</span><br><span class="line"> confirmButtonText: "确定",</span><br><span class="line"> cancelButtonText: "取消",</span><br><span class="line"> type: "warning"</span><br><span class="line"> })</span><br><span class="line"> .then(() => {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/delete"),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData(catIds, false)</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "菜单批量删除成功",</span><br><span class="line"> type: "success"</span><br><span class="line"> });</span><br><span class="line"> this.getMenus();</span><br><span class="line"> });</span><br><span class="line"> })</span><br><span class="line"> .catch(() => {});</span><br><span class="line"> },</span><br><span class="line"> batchSave() {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/update/sort"),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData(this.updateNodes, false)</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "菜单顺序等修改成功",</span><br><span class="line"> type: "success"</span><br><span class="line"> });</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"> });</span><br><span class="line"> },</span><br><span class="line"> handleDrop(draggingNode, dropNode, dropType, ev) {</span><br><span class="line"> console.log("handleDrop: ", 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 == "before" || dropType == "after") {</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"> } else {</span><br><span class="line"> pCid = dropNode.data.catId;</span><br><span class="line"> siblings = dropNode.childNodes;</span><br><span class="line"> }</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 < siblings.length; i++) {</span><br><span class="line"> if (siblings[i].data.catId == draggingNode.data.catId) {</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) {</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"> }</span><br><span class="line"> this.updateNodes.push({</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"> });</span><br><span class="line"> } else {</span><br><span class="line"> this.updateNodes.push({ catId: siblings[i].data.catId, sort: i });</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> //3、当前拖拽节点的最新层级</span><br><span class="line"> console.log("updateNodes", this.updateNodes);</span><br><span class="line"> },</span><br><span class="line"> updateChildNodeLevel(node) {</span><br><span class="line"> if (node.childNodes.length > 0) {</span><br><span class="line"> for (let i = 0; i < node.childNodes.length; i++) {</span><br><span class="line"> var cNode = node.childNodes[i].data;</span><br><span class="line"> this.updateNodes.push({</span><br><span class="line"> catId: cNode.catId,</span><br><span class="line"> catLevel: node.childNodes[i].level</span><br><span class="line"> });</span><br><span class="line"> this.updateChildNodeLevel(node.childNodes[i]);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> },</span><br><span class="line"> allowDrop(draggingNode, dropNode, type) {</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("allowDrop:", 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("深度:", deep);</span><br><span class="line"></span><br><span class="line"> // this.maxLevel</span><br><span class="line"> if (type == "inner") {</span><br><span class="line"> // console.log(</span><br><span class="line"> // `this.maxLevel:${this.maxLevel};draggingNode.data.catLevel:${draggingNode.data.catLevel};dropNode.level:${dropNode.level}`</span><br><span class="line"> // );</span><br><span class="line"> return deep + dropNode.level <= 3;</span><br><span class="line"> } else {</span><br><span class="line"> return deep + dropNode.parent.level <= 3;</span><br><span class="line"> }</span><br><span class="line"> },</span><br><span class="line"> countNodeLevel(node) {</span><br><span class="line"> //找到所有子节点,求出最大深度</span><br><span class="line"> if (node.childNodes != null && node.childNodes.length > 0) {</span><br><span class="line"> for (let i = 0; i < node.childNodes.length; i++) {</span><br><span class="line"> if (node.childNodes[i].level > this.maxLevel) {</span><br><span class="line"> this.maxLevel = node.childNodes[i].level;</span><br><span class="line"> }</span><br><span class="line"> this.countNodeLevel(node.childNodes[i]);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> },</span><br><span class="line"> edit(data) {</span><br><span class="line"> console.log("要修改的数据", data);</span><br><span class="line"> this.dialogType = "edit";</span><br><span class="line"> this.title = "修改分类";</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({</span><br><span class="line"> url: this.$http.adornUrl(`/product/category/info/${data.catId}`),</span><br><span class="line"> method: "get"</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> //请求成功</span><br><span class="line"> console.log("要回显的数据", 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"> });</span><br><span class="line"> },</span><br><span class="line"> append(data) {</span><br><span class="line"> console.log("append", data);</span><br><span class="line"> this.dialogType = "add";</span><br><span class="line"> this.title = "添加分类";</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 = "";</span><br><span class="line"> this.category.icon = "";</span><br><span class="line"> this.category.productUnit = "";</span><br><span class="line"> this.category.sort = 0;</span><br><span class="line"> this.category.showStatus = 1;</span><br><span class="line"> },</span><br><span class="line"></span><br><span class="line"> submitData() {</span><br><span class="line"> if (this.dialogType == "add") {</span><br><span class="line"> this.addCategory();</span><br><span class="line"> }</span><br><span class="line"> if (this.dialogType == "edit") {</span><br><span class="line"> this.editCategory();</span><br><span class="line"> }</span><br><span class="line"> },</span><br><span class="line"> //修改三级分类数据</span><br><span class="line"> editCategory() {</span><br><span class="line"> var { catId, name, icon, productUnit } = this.category;</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/update"),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData({ catId, name, icon, productUnit }, false)</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "菜单修改成功",</span><br><span class="line"> type: "success"</span><br><span class="line"> });</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"> });</span><br><span class="line"> },</span><br><span class="line"> //添加三级分类</span><br><span class="line"> addCategory() {</span><br><span class="line"> console.log("提交的三级分类数据", this.category);</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/save"),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData(this.category, false)</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "菜单保存成功",</span><br><span class="line"> type: "success"</span><br><span class="line"> });</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"> });</span><br><span class="line"> },</span><br><span class="line"></span><br><span class="line"> remove(node, data) {</span><br><span class="line"> var ids = [data.catId];</span><br><span class="line"> this.$confirm(`是否删除【${data.name}】菜单?`, "提示", {</span><br><span class="line"> confirmButtonText: "确定",</span><br><span class="line"> cancelButtonText: "取消",</span><br><span class="line"> type: "warning"</span><br><span class="line"> })</span><br><span class="line"> .then(() => {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/delete"),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData(ids, false)</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "菜单删除成功",</span><br><span class="line"> type: "success"</span><br><span class="line"> });</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"> });</span><br><span class="line"> })</span><br><span class="line"> .catch(() => {});</span><br><span class="line"></span><br><span class="line"> console.log("remove", node, data);</span><br><span class="line"> }</span><br><span class="line"> },</span><br><span class="line"> //生命周期 - 创建完成(可以访问当前this实例)</span><br><span class="line"> created() {</span><br><span class="line"> this.getMenus();</span><br><span class="line"> },</span><br><span class="line"> //生命周期 - 挂载完成(可以访问DOM元素)</span><br><span class="line"> mounted() {},</span><br><span class="line"> beforeCreate() {}, //生命周期 - 创建之前</span><br><span class="line"> beforeMount() {}, //生命周期 - 挂载之前</span><br><span class="line"> beforeUpdate() {}, //生命周期 - 更新之前</span><br><span class="line"> updated() {}, //生命周期 - 更新之后</span><br><span class="line"> beforeDestroy() {}, //生命周期 - 销毁之前</span><br><span class="line"> destroyed() {}, //生命周期 - 销毁完成</span><br><span class="line"> activated() {} //如果页面有keep-alive缓存功能,这个函数会触发</span><br><span class="line">};</span><br><span class="line"></script></span><br><span class="line"><style scoped></span><br><span class="line"></style></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>后端的代码</p>
|
||
<figure class="highlight java"><table><tr><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("/update/sort")</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> {</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">}</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="code"><pre><span class="line"><template></span><br><span class="line"> <div class="mod-config"></span><br><span class="line"> <el-form</span><br><span class="line"> :inline="true"</span><br><span class="line"> :model="dataForm"</span><br><span class="line"> @keyup.enter.native="getDataList()"</span><br><span class="line"> ></span><br><span class="line"> <el-form-item></span><br><span class="line"> <el-input</span><br><span class="line"> v-model="dataForm.key"</span><br><span class="line"> placeholder="参数名"</span><br><span class="line"> clearable</span><br><span class="line"> ></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item></span><br><span class="line"> <el-button @click="getDataList()">查询</el-button></span><br><span class="line"> <el-button</span><br><span class="line"> v-if="isAuth('product:brand:save')"</span><br><span class="line"> type="primary"</span><br><span class="line"> @click="addOrUpdateHandle()"</span><br><span class="line"> >新增</el-button</span><br><span class="line"> ></span><br><span class="line"> <el-button</span><br><span class="line"> v-if="isAuth('product:brand:delete')"</span><br><span class="line"> type="danger"</span><br><span class="line"> @click="deleteHandle()"</span><br><span class="line"> :disabled="dataListSelections.length <= 0"</span><br><span class="line"> >批量删除</el-button</span><br><span class="line"> ></span><br><span class="line"> </el-form-item></span><br><span class="line"> </el-form></span><br><span class="line"> <el-table</span><br><span class="line"> :data="dataList"</span><br><span class="line"> border</span><br><span class="line"> v-loading="dataListLoading"</span><br><span class="line"> @selection-change="selectionChangeHandle"</span><br><span class="line"> style="width: 100%"</span><br><span class="line"> ></span><br><span class="line"> <el-table-column</span><br><span class="line"> type="selection"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> width="50"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="brandId"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="品牌id"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="name"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="品牌名"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="logo"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="品牌logo地址"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="descript"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="介绍"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="showStatus"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="显示状态"</span><br><span class="line"> ></span><br><span class="line"> <template slot-scope="scope"></span><br><span class="line"> <el-switch</span><br><span class="line"> v-model="scope.row.showStatus"</span><br><span class="line"> active-color="#13ce66"</span><br><span class="line"> inactive-color="#ff4949"</span><br><span class="line"> :active-value="1"</span><br><span class="line"> :inactive-value="0"</span><br><span class="line"> @change="updateBrandStatus(scope.row)"</span><br><span class="line"> ></span><br><span class="line"> </el-switch></span><br><span class="line"> </template></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="firstLetter"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="检索首字母"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="sort"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="排序"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> fixed="right"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> width="150"</span><br><span class="line"> label="操作"</span><br><span class="line"> ></span><br><span class="line"> <template slot-scope="scope"></span><br><span class="line"> <el-button</span><br><span class="line"> type="text"</span><br><span class="line"> size="small"</span><br><span class="line"> @click="addOrUpdateHandle(scope.row.brandId)"</span><br><span class="line"> >修改</el-button</span><br><span class="line"> ></span><br><span class="line"> <el-button</span><br><span class="line"> type="text"</span><br><span class="line"> size="small"</span><br><span class="line"> @click="deleteHandle(scope.row.brandId)"</span><br><span class="line"> >删除</el-button</span><br><span class="line"> ></span><br><span class="line"> </template></span><br><span class="line"> </el-table-column></span><br><span class="line"> </el-table></span><br><span class="line"> <el-pagination</span><br><span class="line"> @size-change="sizeChangeHandle"</span><br><span class="line"> @current-change="currentChangeHandle"</span><br><span class="line"> :current-page="pageIndex"</span><br><span class="line"> :page-sizes="[10, 20, 50, 100]"</span><br><span class="line"> :page-size="pageSize"</span><br><span class="line"> :total="totalPage"</span><br><span class="line"> layout="total, sizes, prev, pager, next, jumper"</span><br><span class="line"> ></span><br><span class="line"> </el-pagination></span><br><span class="line"> <!-- 弹窗, 新增 / 修改 --></span><br><span class="line"> <add-or-update</span><br><span class="line"> v-if="addOrUpdateVisible"</span><br><span class="line"> ref="addOrUpdate"</span><br><span class="line"> @refreshDataList="getDataList"</span><br><span class="line"> ></add-or-update></span><br><span class="line"> </div></span><br><span class="line"></template></span><br><span class="line"></span><br><span class="line"><script></span><br><span class="line">import AddOrUpdate from "./brand-add-or-update";</span><br><span class="line">export default {</span><br><span class="line"> data() {</span><br><span class="line"> return {</span><br><span class="line"> dataForm: {</span><br><span class="line"> key: "",</span><br><span class="line"> },</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"> };</span><br><span class="line"> },</span><br><span class="line"> components: {</span><br><span class="line"> AddOrUpdate,</span><br><span class="line"> },</span><br><span class="line"> activated() {</span><br><span class="line"> this.getDataList();</span><br><span class="line"> },</span><br><span class="line"> methods: {</span><br><span class="line"> //修改品牌的显示的状态的</span><br><span class="line"> updateBrandStatus(data) {</span><br><span class="line"> console.log("修改的状态信息:", data);</span><br><span class="line"> let { brandId, showStatus } = data;</span><br><span class="line"> //发送修改状态的请求</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl(`/product/brand/update`),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData(</span><br><span class="line"> { brandId: brandId, showStatus: showStatus },</span><br><span class="line"> false</span><br><span class="line"> ),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "状态更新成功",</span><br><span class="line"> type: "success",</span><br><span class="line"> });</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> // 获取数据列表</span><br><span class="line"> getDataList() {</span><br><span class="line"> this.dataListLoading = true;</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/brand/list"),</span><br><span class="line"> method: "get",</span><br><span class="line"> params: this.$http.adornParams({</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"> }),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> if (data && data.code === 0) {</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"> } else {</span><br><span class="line"> this.dataList = [];</span><br><span class="line"> this.totalPage = 0;</span><br><span class="line"> }</span><br><span class="line"> this.dataListLoading = false;</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> // 每页数</span><br><span class="line"> sizeChangeHandle(val) {</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"> },</span><br><span class="line"> // 当前页</span><br><span class="line"> currentChangeHandle(val) {</span><br><span class="line"> this.pageIndex = val;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> },</span><br><span class="line"> // 多选</span><br><span class="line"> selectionChangeHandle(val) {</span><br><span class="line"> this.dataListSelections = val;</span><br><span class="line"> },</span><br><span class="line"> // 新增 / 修改</span><br><span class="line"> addOrUpdateHandle(id) {</span><br><span class="line"> this.addOrUpdateVisible = true;</span><br><span class="line"> this.$nextTick(() => {</span><br><span class="line"> this.$refs.addOrUpdate.init(id);</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> // 删除</span><br><span class="line"> deleteHandle(id) {</span><br><span class="line"> var ids = id</span><br><span class="line"> ? [id]</span><br><span class="line"> : this.dataListSelections.map((item) => {</span><br><span class="line"> return item.brandId;</span><br><span class="line"> });</span><br><span class="line"> this.$confirm(</span><br><span class="line"> `确定对[id=${ids.join(",")}]进行[${id ? "删除" : "批量删除"}]操作?`,</span><br><span class="line"> "提示",</span><br><span class="line"> {</span><br><span class="line"> confirmButtonText: "确定",</span><br><span class="line"> cancelButtonText: "取消",</span><br><span class="line"> type: "warning",</span><br><span class="line"> }</span><br><span class="line"> ).then(() => {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/brand/delete"),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData(ids, false),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> if (data && data.code === 0) {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "操作成功",</span><br><span class="line"> type: "success",</span><br><span class="line"> duration: 1500,</span><br><span class="line"> onClose: () => {</span><br><span class="line"> this.getDataList();</span><br><span class="line"> },</span><br><span class="line"> });</span><br><span class="line"> } else {</span><br><span class="line"> this.$message.error(data.msg);</span><br><span class="line"> }</span><br><span class="line"> });</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> },</span><br><span class="line">};</span><br><span class="line"></script></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>后端代码(修改品牌的显示状态)</p>
|
||
<figure class="highlight java"><table><tr><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("/update")</span></span><br><span class="line"><span class="comment">//@RequiresPermissions("product:brand:update")</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>{</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">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>品牌添加功能</strong></p>
|
||
<p><strong><a href="https://qingling.icu/posts/6319.html">阿里云对象存储OSS | The Blog (qingling.icu)</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="code"><pre><span class="line"><template></span><br><span class="line"> <div class="mod-config"></span><br><span class="line"> <el-form</span><br><span class="line"> :inline="true"</span><br><span class="line"> :model="dataForm"</span><br><span class="line"> @keyup.enter.native="getDataList()"</span><br><span class="line"> ></span><br><span class="line"> <el-form-item></span><br><span class="line"> <el-input</span><br><span class="line"> v-model="dataForm.key"</span><br><span class="line"> placeholder="参数名"</span><br><span class="line"> clearable</span><br><span class="line"> ></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item></span><br><span class="line"> <el-button @click="getDataList()">查询</el-button></span><br><span class="line"> <el-button</span><br><span class="line"> v-if="isAuth('product:brand:save')"</span><br><span class="line"> type="primary"</span><br><span class="line"> @click="addOrUpdateHandle()"</span><br><span class="line"> >新增</el-button</span><br><span class="line"> ></span><br><span class="line"> <el-button</span><br><span class="line"> v-if="isAuth('product:brand:delete')"</span><br><span class="line"> type="danger"</span><br><span class="line"> @click="deleteHandle()"</span><br><span class="line"> :disabled="dataListSelections.length <= 0"</span><br><span class="line"> >批量删除</el-button</span><br><span class="line"> ></span><br><span class="line"> </el-form-item></span><br><span class="line"> </el-form></span><br><span class="line"> <el-table</span><br><span class="line"> :data="dataList"</span><br><span class="line"> border</span><br><span class="line"> v-loading="dataListLoading"</span><br><span class="line"> @selection-change="selectionChangeHandle"</span><br><span class="line"> style="width: 100%"</span><br><span class="line"> ></span><br><span class="line"> <el-table-column</span><br><span class="line"> type="selection"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> width="50"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="brandId"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="品牌id"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="name"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="品牌名"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="logo"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="品牌logo地址"</span><br><span class="line"> ></span><br><span class="line"> <template slot-scope="scope"></span><br><span class="line"> <img :src="scope.row.logo" style="width: 100px; height: 80px"></span><br><span class="line"> </template></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="descript"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="介绍"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="showStatus"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="显示状态"</span><br><span class="line"> ></span><br><span class="line"> <template slot-scope="scope"></span><br><span class="line"> <el-switch</span><br><span class="line"> v-model="scope.row.showStatus"</span><br><span class="line"> active-color="#13ce66"</span><br><span class="line"> inactive-color="#ff4949"</span><br><span class="line"> :active-value="1"</span><br><span class="line"> :inactive-value="0"</span><br><span class="line"> @change="updateBrandStatus(scope.row)"</span><br><span class="line"> ></span><br><span class="line"> </el-switch></span><br><span class="line"> </template></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="firstLetter"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="检索首字母"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="sort"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="排序"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> fixed="right"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> width="150"</span><br><span class="line"> label="操作"</span><br><span class="line"> ></span><br><span class="line"> <template slot-scope="scope"></span><br><span class="line"> <el-button</span><br><span class="line"> type="text"</span><br><span class="line"> size="small"</span><br><span class="line"> @click="addOrUpdateHandle(scope.row.brandId)"</span><br><span class="line"> >修改</el-button</span><br><span class="line"> ></span><br><span class="line"> <el-button</span><br><span class="line"> type="text"</span><br><span class="line"> size="small"</span><br><span class="line"> @click="deleteHandle(scope.row.brandId)"</span><br><span class="line"> >删除</el-button</span><br><span class="line"> ></span><br><span class="line"> </template></span><br><span class="line"> </el-table-column></span><br><span class="line"> </el-table></span><br><span class="line"> <el-pagination</span><br><span class="line"> @size-change="sizeChangeHandle"</span><br><span class="line"> @current-change="currentChangeHandle"</span><br><span class="line"> :current-page="pageIndex"</span><br><span class="line"> :page-sizes="[10, 20, 50, 100]"</span><br><span class="line"> :page-size="pageSize"</span><br><span class="line"> :total="totalPage"</span><br><span class="line"> layout="total, sizes, prev, pager, next, jumper"</span><br><span class="line"> ></span><br><span class="line"> </el-pagination></span><br><span class="line"> <!-- 弹窗, 新增 / 修改 --></span><br><span class="line"> <add-or-update</span><br><span class="line"> v-if="addOrUpdateVisible"</span><br><span class="line"> ref="addOrUpdate"</span><br><span class="line"> @refreshDataList="getDataList"</span><br><span class="line"> ></add-or-update></span><br><span class="line"> </div></span><br><span class="line"></template></span><br><span class="line"></span><br><span class="line"><script></span><br><span class="line">import AddOrUpdate from "./brand-add-or-update";</span><br><span class="line">export default {</span><br><span class="line"> data() {</span><br><span class="line"> return {</span><br><span class="line"> dataForm: {</span><br><span class="line"> key: "",</span><br><span class="line"> },</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"> };</span><br><span class="line"> },</span><br><span class="line"> components: {</span><br><span class="line"> AddOrUpdate,</span><br><span class="line"> },</span><br><span class="line"> activated() {</span><br><span class="line"> this.getDataList();</span><br><span class="line"> },</span><br><span class="line"> methods: {</span><br><span class="line"> //修改品牌的显示的状态的</span><br><span class="line"> updateBrandStatus(data) {</span><br><span class="line"> console.log("修改的状态信息:", data);</span><br><span class="line"> let { brandId, showStatus } = data;</span><br><span class="line"> //发送修改状态的请求</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl(`/product/brand/update`),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData(</span><br><span class="line"> { brandId: brandId, showStatus: showStatus },</span><br><span class="line"> false</span><br><span class="line"> ),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "状态更新成功",</span><br><span class="line"> type: "success",</span><br><span class="line"> });</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> // 获取数据列表</span><br><span class="line"> getDataList() {</span><br><span class="line"> this.dataListLoading = true;</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/brand/list"),</span><br><span class="line"> method: "get",</span><br><span class="line"> params: this.$http.adornParams({</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"> }),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> if (data && data.code === 0) {</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"> } else {</span><br><span class="line"> this.dataList = [];</span><br><span class="line"> this.totalPage = 0;</span><br><span class="line"> }</span><br><span class="line"> this.dataListLoading = false;</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> // 每页数</span><br><span class="line"> sizeChangeHandle(val) {</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"> },</span><br><span class="line"> // 当前页</span><br><span class="line"> currentChangeHandle(val) {</span><br><span class="line"> this.pageIndex = val;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> },</span><br><span class="line"> // 多选</span><br><span class="line"> selectionChangeHandle(val) {</span><br><span class="line"> this.dataListSelections = val;</span><br><span class="line"> },</span><br><span class="line"> // 新增 / 修改</span><br><span class="line"> addOrUpdateHandle(id) {</span><br><span class="line"> this.addOrUpdateVisible = true;</span><br><span class="line"> this.$nextTick(() => {</span><br><span class="line"> this.$refs.addOrUpdate.init(id);</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> // 删除</span><br><span class="line"> deleteHandle(id) {</span><br><span class="line"> var ids = id</span><br><span class="line"> ? [id]</span><br><span class="line"> : this.dataListSelections.map((item) => {</span><br><span class="line"> return item.brandId;</span><br><span class="line"> });</span><br><span class="line"> this.$confirm(</span><br><span class="line"> `确定对[id=${ids.join(",")}]进行[${id ? "删除" : "批量删除"}]操作?`,</span><br><span class="line"> "提示",</span><br><span class="line"> {</span><br><span class="line"> confirmButtonText: "确定",</span><br><span class="line"> cancelButtonText: "取消",</span><br><span class="line"> type: "warning",</span><br><span class="line"> }</span><br><span class="line"> ).then(() => {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/brand/delete"),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData(ids, false),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> if (data && data.code === 0) {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "操作成功",</span><br><span class="line"> type: "success",</span><br><span class="line"> duration: 1500,</span><br><span class="line"> onClose: () => {</span><br><span class="line"> this.getDataList();</span><br><span class="line"> },</span><br><span class="line"> });</span><br><span class="line"> } else {</span><br><span class="line"> this.$message.error(data.msg);</span><br><span class="line"> }</span><br><span class="line"> });</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> },</span><br><span class="line">};</span><br><span class="line"></script></span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>品牌管理的添加和修改组件</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><template></span><br><span class="line"> <el-dialog</span><br><span class="line"> :title="!dataForm.brandId ? '新增' : '修改'"</span><br><span class="line"> :close-on-click-modal="false"</span><br><span class="line"> :visible.sync="visible"</span><br><span class="line"> ></span><br><span class="line"> <el-form</span><br><span class="line"> :model="dataForm"</span><br><span class="line"> :rules="dataRule"</span><br><span class="line"> ref="dataForm"</span><br><span class="line"> @keyup.enter.native="dataFormSubmit()"</span><br><span class="line"> label-width="140px"</span><br><span class="line"> ></span><br><span class="line"> <el-form-item label="品牌名" prop="name"></span><br><span class="line"> <el-input v-model="dataForm.name" placeholder="品牌名"></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item label="品牌logo地址" prop="logo"></span><br><span class="line"> <!-- <el-input v-model="dataForm.logo" placeholder="品牌logo地址"></el-input> --></span><br><span class="line"> <!-- 自定义的组件 --></span><br><span class="line"> <SingleUpload v-model="dataForm.logo"></SingleUpload></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item label="介绍" prop="descript"></span><br><span class="line"> <el-input v-model="dataForm.descript" placeholder="介绍"></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item label="显示状态" prop="showStatus"></span><br><span class="line"> <el-switch</span><br><span class="line"> v-model="dataForm.showStatus"</span><br><span class="line"> active-color="#13ce66"</span><br><span class="line"> inactive-color="#ff4949"</span><br><span class="line"> :active-value="1"</span><br><span class="line"> :inactive-value="0"</span><br><span class="line"> ></span><br><span class="line"> </el-switch></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item label="检索首字母" prop="firstLetter"></span><br><span class="line"> <el-input</span><br><span class="line"> v-model="dataForm.firstLetter"</span><br><span class="line"> placeholder="检索首字母"</span><br><span class="line"> ></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item label="排序" prop="sort"></span><br><span class="line"> <el-input v-model.number="dataForm.sort" placeholder="排序"></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> </el-form></span><br><span class="line"> <span slot="footer" class="dialog-footer"></span><br><span class="line"> <el-button @click="visible = false">取消</el-button></span><br><span class="line"> <el-button type="primary" @click="dataFormSubmit()">确定</el-button></span><br><span class="line"> </span></span><br><span class="line"> </el-dialog></span><br><span class="line"></template></span><br><span class="line"></span><br><span class="line"><script></span><br><span class="line">import SingleUpload from "@/components/upload/singleUpload";</span><br><span class="line">export default {</span><br><span class="line"> components: { SingleUpload }, //声明一下组件</span><br><span class="line"> data() {</span><br><span class="line"> return {</span><br><span class="line"> visible: false,</span><br><span class="line"> dataForm: {</span><br><span class="line"> brandId: 0,</span><br><span class="line"> name: "",</span><br><span class="line"> logo: "",</span><br><span class="line"> descript: "",</span><br><span class="line"> showStatus: 1,</span><br><span class="line"> firstLetter: "",</span><br><span class="line"> sort: 0,</span><br><span class="line"> },</span><br><span class="line"> dataRule: {</span><br><span class="line"> name: [{ required: true, message: "品牌名不能为空", trigger: "blur" }],</span><br><span class="line"> logo: [</span><br><span class="line"> { required: true, message: "品牌logo地址不能为空", trigger: "blur" },</span><br><span class="line"> ],</span><br><span class="line"> descript: [</span><br><span class="line"> { required: true, message: "介绍不能为空", trigger: "blur" },</span><br><span class="line"> ],</span><br><span class="line"> showStatus: [</span><br><span class="line"> {</span><br><span class="line"> required: true,</span><br><span class="line"> message: "显示状态[0-不显示;1-显示]不能为空",</span><br><span class="line"> trigger: "blur",</span><br><span class="line"> },</span><br><span class="line"> ],</span><br><span class="line"> firstLetter: [</span><br><span class="line"> {</span><br><span class="line"> validator: (rule, value, callback) => {</span><br><span class="line"> if (value == "") {</span><br><span class="line"> //检测是不是空串</span><br><span class="line"> callback(new Error("检索首字母不能为空"));</span><br><span class="line"> } else if (!/^[a-zA-Z]$/.test(value)) {</span><br><span class="line"> //检测输入的是不是字母</span><br><span class="line"> callback(new Error("首字母必须是a-z或者A-Z"));</span><br><span class="line"> } else {</span><br><span class="line"> //成功</span><br><span class="line"> callback();</span><br><span class="line"> }</span><br><span class="line"> },</span><br><span class="line"> trigger: "blur",</span><br><span class="line"> },</span><br><span class="line"> ],</span><br><span class="line"> sort: [</span><br><span class="line"> {</span><br><span class="line"> validator: (rule, value, callback) => {</span><br><span class="line"> if (value === "") {</span><br><span class="line"> //检测是不是空串</span><br><span class="line"> callback(new Error("排序不能为空"));</span><br><span class="line"> } else if (!Number.isInteger(value) || value < 0) {</span><br><span class="line"> //检测输入的是不是字母</span><br><span class="line"> callback(new Error("排序必须为整数并且大于0"));</span><br><span class="line"> } else {</span><br><span class="line"> //成功</span><br><span class="line"> callback();</span><br><span class="line"> }</span><br><span class="line"> },</span><br><span class="line"> trigger: "blur",</span><br><span class="line"> },</span><br><span class="line"> ],</span><br><span class="line"> },</span><br><span class="line"> };</span><br><span class="line"> },</span><br><span class="line"> methods: {</span><br><span class="line"> init(id) {</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(() => {</span><br><span class="line"> this.$refs["dataForm"].resetFields();</span><br><span class="line"> if (this.dataForm.brandId) {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl(</span><br><span class="line"> `/product/brand/info/${this.dataForm.brandId}`</span><br><span class="line"> ),</span><br><span class="line"> method: "get",</span><br><span class="line"> params: this.$http.adornParams(),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> if (data && data.code === 0) {</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"> }</span><br><span class="line"> });</span><br><span class="line"> }</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> // 表单提交</span><br><span class="line"> dataFormSubmit() {</span><br><span class="line"> this.$refs["dataForm"].validate((valid) => {</span><br><span class="line"> if (valid) {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl(</span><br><span class="line"> `/product/brand/${!this.dataForm.brandId ? "save" : "update"}`</span><br><span class="line"> ),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData({</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"> }),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> if (data && data.code === 0) {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "操作成功",</span><br><span class="line"> type: "success",</span><br><span class="line"> duration: 1500,</span><br><span class="line"> onClose: () => {</span><br><span class="line"> this.visible = false;</span><br><span class="line"> this.$emit("refreshDataList");</span><br><span class="line"> },</span><br><span class="line"> });</span><br><span class="line"> } else {</span><br><span class="line"> this.$message.error(data.msg);</span><br><span class="line"> }</span><br><span class="line"> });</span><br><span class="line"> }</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> },</span><br><span class="line">};</span><br><span class="line"></script></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="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="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> {</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("${spring.cloud.alicloud.oss.endpoint}")</span></span><br><span class="line"> <span class="keyword">private</span> String endpoint;</span><br><span class="line"> <span class="meta">@Value("${spring.cloud.alicloud.oss.bucket}")</span></span><br><span class="line"> <span class="keyword">private</span> String bucket;</span><br><span class="line"> <span class="meta">@Value("${spring.cloud.alicloud.access-key}")</span></span><br><span class="line"> <span class="keyword">private</span> String accessId;</span><br><span class="line"> <span class="meta">@Value("${spring.cloud.alicloud.secret-key}")</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("/oss/policy")</span></span><br><span class="line"> <span class="keyword">public</span> R <span class="title function_">policy</span><span class="params">()</span> {</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">"https://"</span>+bucket+<span class="string">"."</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 = "https://192.168.0.0:8888";</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">"yyyy/MM/dd"</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">"/"</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<String, String> respMap = <span class="literal">null</span>;</span><br><span class="line"> <span class="keyword">try</span> {</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">"utf-8"</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><String, String>();</span><br><span class="line"> respMap.put(<span class="string">"accessId"</span>, accessId);</span><br><span class="line"> respMap.put(<span class="string">"policy"</span>, encodedPolicy);</span><br><span class="line"> respMap.put(<span class="string">"signature"</span>, postSignature);</span><br><span class="line"> respMap.put(<span class="string">"dir"</span>, dir);</span><br><span class="line"> respMap.put(<span class="string">"host"</span>, host);</span><br><span class="line"> respMap.put(<span class="string">"expire"</span>, String.valueOf(expireEndTime / <span class="number">1000</span>));</span><br><span class="line"> <span class="comment">// respMap.put("expire", formatISO8601Date(expiration));</span></span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> System.out.println(e.getMessage());</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> R.ok().put(<span class="string">"data"</span>,respMap);</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>配置网关,通过网关访问到该接口</p>
|
||
<figure class="highlight yaml"><table><tr><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/(?<segment>.*),/$\{segment}</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://qingling.icu/posts/27166.html">数据校验 | The Blog (qingling.icu)</a></strong></p>
|
||
<p>1.依赖文件</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.hibernate<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>hibernate-validator<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>6.0.7.Final<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.在实体类上添加上校验的规则</p>
|
||
<figure class="highlight java"><table><tr><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("pms_brand")</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> {</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 = "品牌名必须提交")</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 = "logo必须是一个合法的URL地址")</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 = "^[a-zA-Z]$", message = "检索首字母必须是一个字母")</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 = "排序必须大于等于0")</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">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3.接口上开启检验,并自定义校验出错时的返回值</p>
|
||
<figure class="highlight java"><table><tr><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">@Valid</span>" 开启校验</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("/save")</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>{</span><br><span class="line"> <span class="keyword">if</span>(result.hasErrors()){</span><br><span class="line"> Map<String,String> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> <span class="comment">//获取检验的错误结果</span></span><br><span class="line"> <span class="keyword">for</span> (FieldError fieldError : result.getFieldErrors()) {</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"> }</span><br><span class="line"> <span class="keyword">return</span> R.error(<span class="number">400</span>,<span class="string">"提交的数据不合法"</span>).put(<span class="string">"data"</span>,map);</span><br><span class="line"> }<span class="keyword">else</span> {</span><br><span class="line"> brandService.save(brand);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> R.ok();</span><br><span class="line">}</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://qingling.icu/posts/31385.html">统一异常处理 | The Blog (qingling.icu)</a></strong></p>
|
||
<p>统一异常返回状态码</p>
|
||
<figure class="highlight java"><table><tr><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> {</span><br><span class="line"> UNKNOWN_EXCEPTION(<span class="number">10000</span>,<span class="string">"系统未知异常"</span>),</span><br><span class="line"> VALID_EXCEPTION(<span class="number">10001</span>,<span class="string">"参数格式校验"</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) {</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"> }</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> {</span><br><span class="line"> <span class="keyword">return</span> code;</span><br><span class="line"> }</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> {</span><br><span class="line"> <span class="keyword">return</span> msg;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>创建异常处理类</p>
|
||
<figure class="highlight java"><table><tr><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 = "com.atguigu.gulimall.product.controller")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">GulimallExceptionControllerAdvice</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 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>{</span><br><span class="line"> log.error(<span class="string">"数据校验出现问题:{},异常类型:{}"</span>,e.getMessage(),e.getClass());</span><br><span class="line"> Map<String,String> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</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()) {</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"> }</span><br><span class="line"> <span class="keyword">return</span> R.error(BizCodeEnum.VALID_EXCEPTION.getCode(),BizCodeEnum.VALID_EXCEPTION.getMsg()).put(<span class="string">"data"</span>,map);</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="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>{</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"> }</span><br><span class="line">}</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="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("/catelog/list")</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("brandId")</span> Long brandId)</span>{</span><br><span class="line"> LambdaQueryWrapper<CategoryBrandRelationEntity> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><>();</span><br><span class="line"> queryWrapper.eq(CategoryBrandRelationEntity::getBrandId,brandId);</span><br><span class="line"> List<CategoryBrandRelationEntity> categoryBrandRelationEntityList = categoryBrandRelationService.list(queryWrapper);</span><br><span class="line"> <span class="keyword">return</span> R.ok().put(<span class="string">"data"</span>, categoryBrandRelationEntityList);</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>新增品牌和商品的关联关系</p>
|
||
<p>controller</p>
|
||
<figure class="highlight java"><table><tr><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("/save")</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>{</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"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>service</p>
|
||
<figure class="highlight java"><table><tr><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> {</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"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>注意</strong>:这里品牌和关联分类之间的关系表中使用了冗余的字段,所以在修改品牌的时候,关系表中的字段也要修改一下</p>
|
||
<figure class="highlight java"><table><tr><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> {</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())) {</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"> }</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>关联的分类也是冗余的字段 也要同步修改</p>
|
||
<figure class="highlight java"><table><tr><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> {</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"> }</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 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="code"><pre><span class="line"><template></span><br><span class="line"> <el-tree</span><br><span class="line"> :data="menus"</span><br><span class="line"> :props="defaultProps"</span><br><span class="line"> node-key="catId"</span><br><span class="line"> ref="menuTree"</span><br><span class="line"> ></el-tree></span><br><span class="line"></template></span><br><span class="line"> <script></span><br><span class="line">export default {</span><br><span class="line"> components: {},</span><br><span class="line"> data() {</span><br><span class="line"> return {</span><br><span class="line"> menus: [],</span><br><span class="line"> expandedKey: [],</span><br><span class="line"> defaultProps: {</span><br><span class="line"> children: "children",</span><br><span class="line"> label: "name",</span><br><span class="line"> },</span><br><span class="line"> };</span><br><span class="line"> },</span><br><span class="line"> created() {</span><br><span class="line"> this.getMenus();</span><br><span class="line"> },</span><br><span class="line"> methods: {</span><br><span class="line"> getMenus() {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/list/tree"),</span><br><span class="line"> method: "get",</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> console.log("商品分类数据:", data.data);</span><br><span class="line"> this.menus = data.data;</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> },</span><br><span class="line">};</span><br><span class="line"></script></span><br><span class="line"> </span><br><span class="line"> <style></span><br><span class="line"></style></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>属性分组页面</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><template></span><br><span class="line"> <el-row :gutter="20"></span><br><span class="line"> <el-col :span="6"> <category></category></el-col></span><br><span class="line"> <el-col :span="18"></span><br><span class="line"> <div class="mod-config"></span><br><span class="line"> <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"></span><br><span class="line"> <el-form-item></span><br><span class="line"> <el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item></span><br><span class="line"> <el-button @click="getDataList()">查询</el-button></span><br><span class="line"> <el-button v-if="isAuth('product:attrgroup:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button></span><br><span class="line"> <el-button v-if="isAuth('product:attrgroup:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button></span><br><span class="line"> </el-form-item></span><br><span class="line"> </el-form></span><br><span class="line"> <el-table</span><br><span class="line"> :data="dataList"</span><br><span class="line"> border</span><br><span class="line"> v-loading="dataListLoading"</span><br><span class="line"> @selection-change="selectionChangeHandle"</span><br><span class="line"> style="width: 100%;"></span><br><span class="line"> <el-table-column</span><br><span class="line"> type="selection"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> width="50"></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="attrGroupId"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="分组id"></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="attrGroupName"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="组名"></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="sort"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="排序"></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="descript"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="描述"></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="icon"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="组图标"></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="catelogId"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="所属分类id"></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> fixed="right"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> width="150"</span><br><span class="line"> label="操作"></span><br><span class="line"> <template slot-scope="scope"></span><br><span class="line"> <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.attrGroupId)">修改</el-button></span><br><span class="line"> <el-button type="text" size="small" @click="deleteHandle(scope.row.attrGroupId)">删除</el-button></span><br><span class="line"> </template></span><br><span class="line"> </el-table-column></span><br><span class="line"> </el-table></span><br><span class="line"> <el-pagination</span><br><span class="line"> @size-change="sizeChangeHandle"</span><br><span class="line"> @current-change="currentChangeHandle"</span><br><span class="line"> :current-page="pageIndex"</span><br><span class="line"> :page-sizes="[10, 20, 50, 100]"</span><br><span class="line"> :page-size="pageSize"</span><br><span class="line"> :total="totalPage"</span><br><span class="line"> layout="total, sizes, prev, pager, next, jumper"></span><br><span class="line"> </el-pagination></span><br><span class="line"> <!-- 弹窗, 新增 / 修改 --></span><br><span class="line"> <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update></span><br><span class="line"> </div></el-col></span><br><span class="line"> </el-row></span><br><span class="line"></template></span><br><span class="line"><script></span><br><span class="line">import Category from "../common/category.vue";</span><br><span class="line">import AddOrUpdate from './attrgroup-add-or-update'</span><br><span class="line">export default {</span><br><span class="line"> data () {</span><br><span class="line"> return {</span><br><span class="line"> dataForm: {</span><br><span class="line"> key: ''</span><br><span class="line"> },</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"> }</span><br><span class="line"> },</span><br><span class="line"> components: {</span><br><span class="line"> AddOrUpdate,Category</span><br><span class="line"> },</span><br><span class="line"> activated () {</span><br><span class="line"> this.getDataList()</span><br><span class="line"> },</span><br><span class="line"> methods: {</span><br><span class="line"> // 获取数据列表</span><br><span class="line"> getDataList () {</span><br><span class="line"> this.dataListLoading = true</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl('/product/attrgroup/list'),</span><br><span class="line"> method: 'get',</span><br><span class="line"> params: this.$http.adornParams({</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"> })</span><br><span class="line"> }).then(({data}) => {</span><br><span class="line"> if (data && data.code === 0) {</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"> } else {</span><br><span class="line"> this.dataList = []</span><br><span class="line"> this.totalPage = 0</span><br><span class="line"> }</span><br><span class="line"> this.dataListLoading = false</span><br><span class="line"> })</span><br><span class="line"> },</span><br><span class="line"> // 每页数</span><br><span class="line"> sizeChangeHandle (val) {</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"> },</span><br><span class="line"> // 当前页</span><br><span class="line"> currentChangeHandle (val) {</span><br><span class="line"> this.pageIndex = val</span><br><span class="line"> this.getDataList()</span><br><span class="line"> },</span><br><span class="line"> // 多选</span><br><span class="line"> selectionChangeHandle (val) {</span><br><span class="line"> this.dataListSelections = val</span><br><span class="line"> },</span><br><span class="line"> // 新增 / 修改</span><br><span class="line"> addOrUpdateHandle (id) {</span><br><span class="line"> this.addOrUpdateVisible = true</span><br><span class="line"> this.$nextTick(() => {</span><br><span class="line"> this.$refs.addOrUpdate.init(id)</span><br><span class="line"> })</span><br><span class="line"> },</span><br><span class="line"> // 删除</span><br><span class="line"> deleteHandle (id) {</span><br><span class="line"> var ids = id ? [id] : this.dataListSelections.map(item => {</span><br><span class="line"> return item.attrGroupId</span><br><span class="line"> })</span><br><span class="line"> this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {</span><br><span class="line"> confirmButtonText: '确定',</span><br><span class="line"> cancelButtonText: '取消',</span><br><span class="line"> type: 'warning'</span><br><span class="line"> }).then(() => {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl('/product/attrgroup/delete'),</span><br><span class="line"> method: 'post',</span><br><span class="line"> data: this.$http.adornData(ids, false)</span><br><span class="line"> }).then(({data}) => {</span><br><span class="line"> if (data && data.code === 0) {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: '操作成功',</span><br><span class="line"> type: 'success',</span><br><span class="line"> duration: 1500,</span><br><span class="line"> onClose: () => {</span><br><span class="line"> this.getDataList()</span><br><span class="line"> }</span><br><span class="line"> })</span><br><span class="line"> } else {</span><br><span class="line"> this.$message.error(data.msg)</span><br><span class="line"> }</span><br><span class="line"> })</span><br><span class="line"> })</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></script></span><br><span class="line"><style></span><br><span class="line"></style></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="code"><pre><span class="line"><template></span><br><span class="line"> <el-tree</span><br><span class="line"> :data="menus"</span><br><span class="line"> :props="defaultProps"</span><br><span class="line"> node-key="catId"</span><br><span class="line"> ref="menuTree"</span><br><span class="line"> @node-click="nodeclick"</span><br><span class="line"> ></el-tree></span><br><span class="line"></template></span><br><span class="line"> <script></span><br><span class="line">export default {</span><br><span class="line"> components: {},</span><br><span class="line"> data() {</span><br><span class="line"> return {</span><br><span class="line"> menus: [],</span><br><span class="line"> expandedKey: [],</span><br><span class="line"> defaultProps: {</span><br><span class="line"> children: "children",</span><br><span class="line"> label: "name",</span><br><span class="line"> },</span><br><span class="line"> };</span><br><span class="line"> },</span><br><span class="line"> created() {</span><br><span class="line"> this.getMenus();</span><br><span class="line"> },</span><br><span class="line"> methods: {</span><br><span class="line"> getMenus() {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/category/list/tree"),</span><br><span class="line"> method: "get",</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> console.log("商品分类数据:", data.data);</span><br><span class="line"> this.menus = data.data;</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> nodeclick(data,node,component) {</span><br><span class="line"> console.log("子组件被点击,传递的数据有:data:",data,"node:",node,"component:",component);</span><br><span class="line"> //子组件向父组件传递数据</span><br><span class="line"> this.$emit("tree-node-click",data,node,component);</span><br><span class="line"> },</span><br><span class="line"> },</span><br><span class="line">};</span><br><span class="line"></script></span><br><span class="line"> </span><br><span class="line"> <style></span><br><span class="line"></style></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>父组件接受相应的数据</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><template></span><br><span class="line"> <el-row :gutter="20"></span><br><span class="line"> <el-col :span="6"></span><br><span class="line"> <category @tree-node-click="treeNodeClick"></category</span><br><span class="line"> ></el-col></span><br><span class="line"> <el-col :span="18"></span><br><span class="line"> <div class="mod-config"></span><br><span class="line"> <el-form</span><br><span class="line"> :inline="true"</span><br><span class="line"> :model="dataForm"</span><br><span class="line"> @keyup.enter.native="getDataList()"</span><br><span class="line"> ></span><br><span class="line"> <el-form-item></span><br><span class="line"> <el-input</span><br><span class="line"> v-model="dataForm.key"</span><br><span class="line"> placeholder="参数名"</span><br><span class="line"> clearable</span><br><span class="line"> ></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item></span><br><span class="line"> <el-button @click="getDataList()">查询</el-button></span><br><span class="line"> <el-button</span><br><span class="line"> v-if="isAuth('product:attrgroup:save')"</span><br><span class="line"> type="primary"</span><br><span class="line"> @click="addOrUpdateHandle()"</span><br><span class="line"> >新增</el-button</span><br><span class="line"> ></span><br><span class="line"> <el-button</span><br><span class="line"> v-if="isAuth('product:attrgroup:delete')"</span><br><span class="line"> type="danger"</span><br><span class="line"> @click="deleteHandle()"</span><br><span class="line"> :disabled="dataListSelections.length <= 0"</span><br><span class="line"> >批量删除</el-button</span><br><span class="line"> ></span><br><span class="line"> </el-form-item></span><br><span class="line"> </el-form></span><br><span class="line"> <el-table</span><br><span class="line"> :data="dataList"</span><br><span class="line"> border</span><br><span class="line"> v-loading="dataListLoading"</span><br><span class="line"> @selection-change="selectionChangeHandle"</span><br><span class="line"> style="width: 100%"</span><br><span class="line"> ></span><br><span class="line"> <el-table-column</span><br><span class="line"> type="selection"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> width="50"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="attrGroupId"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="分组id"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="attrGroupName"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="组名"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="sort"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="排序"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="descript"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="描述"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="icon"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="组图标"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> prop="catelogId"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> label="所属分类id"</span><br><span class="line"> ></span><br><span class="line"> </el-table-column></span><br><span class="line"> <el-table-column</span><br><span class="line"> fixed="right"</span><br><span class="line"> header-align="center"</span><br><span class="line"> align="center"</span><br><span class="line"> width="150"</span><br><span class="line"> label="操作"</span><br><span class="line"> ></span><br><span class="line"> <template slot-scope="scope"></span><br><span class="line"> <el-button</span><br><span class="line"> type="text"</span><br><span class="line"> size="small"</span><br><span class="line"> @click="addOrUpdateHandle(scope.row.attrGroupId)"</span><br><span class="line"> >修改</el-button</span><br><span class="line"> ></span><br><span class="line"> <el-button</span><br><span class="line"> type="text"</span><br><span class="line"> size="small"</span><br><span class="line"> @click="deleteHandle(scope.row.attrGroupId)"</span><br><span class="line"> >删除</el-button</span><br><span class="line"> ></span><br><span class="line"> </template></span><br><span class="line"> </el-table-column></span><br><span class="line"> </el-table></span><br><span class="line"> <el-pagination</span><br><span class="line"> @size-change="sizeChangeHandle"</span><br><span class="line"> @current-change="currentChangeHandle"</span><br><span class="line"> :current-page="pageIndex"</span><br><span class="line"> :page-sizes="[10, 20, 50, 100]"</span><br><span class="line"> :page-size="pageSize"</span><br><span class="line"> :total="totalPage"</span><br><span class="line"> layout="total, sizes, prev, pager, next, jumper"</span><br><span class="line"> ></span><br><span class="line"> </el-pagination></span><br><span class="line"> <!-- 弹窗, 新增 / 修改 --></span><br><span class="line"> <add-or-update</span><br><span class="line"> v-if="addOrUpdateVisible"</span><br><span class="line"> ref="addOrUpdate"</span><br><span class="line"> @refreshDataList="getDataList"</span><br><span class="line"> ></add-or-update></div</span><br><span class="line"> ></el-col></span><br><span class="line"> </el-row></span><br><span class="line"></template></span><br><span class="line"><script></span><br><span class="line">import Category from "../common/category.vue";</span><br><span class="line">import AddOrUpdate from "./attrgroup-add-or-update";</span><br><span class="line">export default {</span><br><span class="line"> data() {</span><br><span class="line"> return {</span><br><span class="line"> catId: 0,</span><br><span class="line"> dataForm: {</span><br><span class="line"> key: "",</span><br><span class="line"> },</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"> };</span><br><span class="line"> },</span><br><span class="line"> components: {</span><br><span class="line"> AddOrUpdate,</span><br><span class="line"> Category,</span><br><span class="line"> },</span><br><span class="line"> activated() {</span><br><span class="line"> this.getDataList();</span><br><span class="line"> },</span><br><span class="line"> methods: {</span><br><span class="line"> treeNodeClick(data, node, component) {</span><br><span class="line"> //获取子组件传递过来的值</span><br><span class="line"> console.log(</span><br><span class="line"> "获取子组件传递过来的值:data:",</span><br><span class="line"> data,</span><br><span class="line"> "node",</span><br><span class="line"> node,</span><br><span class="line"> "component:",</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){</span><br><span class="line"> this.catId = data.catId;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> }</span><br><span class="line"> },</span><br><span class="line"> // 获取数据列表</span><br><span class="line"> getDataList() {</span><br><span class="line"> this.dataListLoading = true;</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl(`/product/attrgroup/list/${this.catId}`),</span><br><span class="line"> method: "get",</span><br><span class="line"> params: this.$http.adornParams({</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"> }),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> if (data && data.code === 0) {</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"> } else {</span><br><span class="line"> this.dataList = [];</span><br><span class="line"> this.totalPage = 0;</span><br><span class="line"> }</span><br><span class="line"> this.dataListLoading = false;</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> // 每页数</span><br><span class="line"> sizeChangeHandle(val) {</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"> },</span><br><span class="line"> // 当前页</span><br><span class="line"> currentChangeHandle(val) {</span><br><span class="line"> this.pageIndex = val;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> },</span><br><span class="line"> // 多选</span><br><span class="line"> selectionChangeHandle(val) {</span><br><span class="line"> this.dataListSelections = val;</span><br><span class="line"> },</span><br><span class="line"> // 新增 / 修改</span><br><span class="line"> addOrUpdateHandle(id) {</span><br><span class="line"> this.addOrUpdateVisible = true;</span><br><span class="line"> this.$nextTick(() => {</span><br><span class="line"> this.$refs.addOrUpdate.init(id);</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> // 删除</span><br><span class="line"> deleteHandle(id) {</span><br><span class="line"> var ids = id</span><br><span class="line"> ? [id]</span><br><span class="line"> : this.dataListSelections.map((item) => {</span><br><span class="line"> return item.attrGroupId;</span><br><span class="line"> });</span><br><span class="line"> this.$confirm(</span><br><span class="line"> `确定对[id=${ids.join(",")}]进行[${id ? "删除" : "批量删除"}]操作?`,</span><br><span class="line"> "提示",</span><br><span class="line"> {</span><br><span class="line"> confirmButtonText: "确定",</span><br><span class="line"> cancelButtonText: "取消",</span><br><span class="line"> type: "warning",</span><br><span class="line"> }</span><br><span class="line"> ).then(() => {</span><br><span class="line"> this.$http({</span><br><span class="line"> url: this.$http.adornUrl("/product/attrgroup/delete"),</span><br><span class="line"> method: "post",</span><br><span class="line"> data: this.$http.adornData(ids, false),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> if (data && data.code === 0) {</span><br><span class="line"> this.$message({</span><br><span class="line"> message: "操作成功",</span><br><span class="line"> type: "success",</span><br><span class="line"> duration: 1500,</span><br><span class="line"> onClose: () => {</span><br><span class="line"> this.getDataList();</span><br><span class="line"> },</span><br><span class="line"> });</span><br><span class="line"> } else {</span><br><span class="line"> this.$message.error(data.msg);</span><br><span class="line"> }</span><br><span class="line"> });</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> },</span><br><span class="line">};</span><br><span class="line"></script></span><br><span class="line"></span><br><span class="line"><style></span><br><span class="line"></style></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>后端代码</p>
|
||
<figure class="highlight java"><table><tr><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<String, Object> params, Long catelogId)</span> {</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>) {</span><br><span class="line"> IPage<AttrGroupEntity> page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span><AttrGroupEntity>().getPage(params),</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">QueryWrapper</span><AttrGroupEntity>()</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"> } <span class="keyword">else</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">"key"</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<AttrGroupEntity> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><>();</span><br><span class="line"> queryWrapper.eq(AttrGroupEntity::getCatelogId, catelogId);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(key)) {</span><br><span class="line"> queryWrapper.and((obj) -> {</span><br><span class="line"> obj.eq(AttrGroupEntity::getAttrGroupId, key).or().like(AttrGroupEntity::getAttrGroupName, key);</span><br><span class="line"> });</span><br><span class="line"> }</span><br><span class="line"> IPage<AttrGroupEntity> page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span><AttrGroupEntity>().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"> }</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>属性分组的添加功能</strong></p>
|
||
<p>前端代码</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><template></span><br><span class="line"> <el-dialog</span><br><span class="line"> :title=<span class="string">"!dataForm.attrGroupId ? '新增' : '修改'"</span></span><br><span class="line"> :close-on-click-modal=<span class="string">"false"</span></span><br><span class="line"> :visible.sync=<span class="string">"visible"</span></span><br><span class="line"> <span class="meta">@closed</span>=<span class="string">"dialogClose"</span></span><br><span class="line"> ></span><br><span class="line"> <el-form</span><br><span class="line"> :model=<span class="string">"dataForm"</span></span><br><span class="line"> :rules=<span class="string">"dataRule"</span></span><br><span class="line"> ref=<span class="string">"dataForm"</span></span><br><span class="line"> <span class="meta">@keyup</span>.enter.<span class="keyword">native</span>=<span class="string">"dataFormSubmit()"</span></span><br><span class="line"> label-width=<span class="string">"100px"</span></span><br><span class="line"> ></span><br><span class="line"> <el-form-item label=<span class="string">"组名"</span> prop=<span class="string">"attrGroupName"</span>></span><br><span class="line"> <el-input</span><br><span class="line"> v-model=<span class="string">"dataForm.attrGroupName"</span></span><br><span class="line"> placeholder=<span class="string">"组名"</span></span><br><span class="line"> ></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item label=<span class="string">"排序"</span> prop=<span class="string">"sort"</span>></span><br><span class="line"> <el-input v-model=<span class="string">"dataForm.sort"</span> placeholder=<span class="string">"排序"</span>></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item label=<span class="string">"描述"</span> prop=<span class="string">"descript"</span>></span><br><span class="line"> <el-input v-model=<span class="string">"dataForm.descript"</span> placeholder=<span class="string">"描述"</span>></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item label=<span class="string">"组图标"</span> prop=<span class="string">"icon"</span>></span><br><span class="line"> <el-input v-model=<span class="string">"dataForm.icon"</span> placeholder=<span class="string">"组图标"</span>></el-input></span><br><span class="line"> </el-form-item></span><br><span class="line"> <el-form-item label=<span class="string">"所属分类id"</span> prop=<span class="string">"catelogId"</span>></span><br><span class="line"> <!-- <el-input v-model=<span class="string">"dataForm.catelogId"</span> placeholder=<span class="string">"所属分类id"</span>></el-input> --></span><br><span class="line"> <el-cascader</span><br><span class="line"> v-model=<span class="string">"dataForm.catelogPath"</span></span><br><span class="line"> :options=<span class="string">"categorys"</span></span><br><span class="line"> :props=<span class="string">"props"</span></span><br><span class="line"> placeholder=<span class="string">"试试搜索:手机"</span></span><br><span class="line"> filterable</span><br><span class="line"> ></el-cascader></span><br><span class="line"> </el-form-item></span><br><span class="line"> </el-form></span><br><span class="line"> <span slot=<span class="string">"footer"</span> class=<span class="string">"dialog-footer"</span>></span><br><span class="line"> <el-button <span class="meta">@click</span>=<span class="string">"visible = false"</span>>取消</el-button></span><br><span class="line"> <el-button type=<span class="string">"primary"</span> <span class="meta">@click</span>=<span class="string">"dataFormSubmit()"</span>>确定</el-button></span><br><span class="line"> </span></span><br><span class="line"> </el-dialog></span><br><span class="line"></template></span><br><span class="line"></span><br><span class="line"><script></span><br><span class="line"><span class="keyword">import</span> Category from <span class="string">"../common/category.vue"</span>;</span><br><span class="line"></span><br><span class="line">export <span class="keyword">default</span> {</span><br><span class="line"> data() {</span><br><span class="line"> <span class="keyword">return</span> {</span><br><span class="line"> props: {</span><br><span class="line"> value: <span class="string">"catId"</span>,</span><br><span class="line"> label: <span class="string">"name"</span>,</span><br><span class="line"> children: <span class="string">"children"</span>,</span><br><span class="line"> },</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: {</span><br><span class="line"> attrGroupId: <span class="number">0</span>,</span><br><span class="line"> attrGroupName: <span class="string">""</span>,</span><br><span class="line"> sort: <span class="string">""</span>,</span><br><span class="line"> descript: <span class="string">""</span>,</span><br><span class="line"> icon: <span class="string">""</span>,</span><br><span class="line"> catelogPath: [],</span><br><span class="line"> catelogId: <span class="number">0</span>,</span><br><span class="line"> },</span><br><span class="line"> dataRule: {</span><br><span class="line"> attrGroupName: [</span><br><span class="line"> { required: <span class="literal">true</span>, message: <span class="string">"组名不能为空"</span>, trigger: <span class="string">"blur"</span> },</span><br><span class="line"> ],</span><br><span class="line"> sort: [{ required: <span class="literal">true</span>, message: <span class="string">"排序不能为空"</span>, trigger: <span class="string">"blur"</span> }],</span><br><span class="line"> descript: [</span><br><span class="line"> { required: <span class="literal">true</span>, message: <span class="string">"描述不能为空"</span>, trigger: <span class="string">"blur"</span> },</span><br><span class="line"> ],</span><br><span class="line"> icon: [{ required: <span class="literal">true</span>, message: <span class="string">"组图标不能为空"</span>, trigger: <span class="string">"blur"</span> }],</span><br><span class="line"> catelogId: [</span><br><span class="line"> { required: <span class="literal">true</span>, message: <span class="string">"所属分类id不能为空"</span>, trigger: <span class="string">"blur"</span> },</span><br><span class="line"> ],</span><br><span class="line"> },</span><br><span class="line"> };</span><br><span class="line"> },</span><br><span class="line"> created() {</span><br><span class="line"> <span class="built_in">this</span>.getCategorys();</span><br><span class="line"> },</span><br><span class="line"> methods: {</span><br><span class="line"> dialogClose() {</span><br><span class="line"> <span class="built_in">this</span>.dataForm.catelogPath = [];</span><br><span class="line"> },</span><br><span class="line"> getCategorys() {</span><br><span class="line"> <span class="built_in">this</span>.$http({</span><br><span class="line"> url: <span class="built_in">this</span>.$http.adornUrl(<span class="string">"/product/category/list/tree"</span>),</span><br><span class="line"> method: <span class="string">"get"</span>,</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> <span class="built_in">this</span>.categorys = data.data;</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> init(id) {</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(() => {</span><br><span class="line"> <span class="built_in">this</span>.$refs[<span class="string">"dataForm"</span>].resetFields();</span><br><span class="line"> <span class="keyword">if</span> (<span class="built_in">this</span>.dataForm.attrGroupId) {</span><br><span class="line"> <span class="built_in">this</span>.$http({</span><br><span class="line"> url: <span class="built_in">this</span>.$http.adornUrl(</span><br><span class="line"> `/product/attrgroup/info/${<span class="built_in">this</span>.dataForm.attrGroupId}`</span><br><span class="line"> ),</span><br><span class="line"> method: <span class="string">"get"</span>,</span><br><span class="line"> params: <span class="built_in">this</span>.$http.adornParams(),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> <span class="keyword">if</span> (data && data.code === <span class="number">0</span>) {</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"> }</span><br><span class="line"> });</span><br><span class="line"> }</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> <span class="comment">// 表单提交</span></span><br><span class="line"> dataFormSubmit() {</span><br><span class="line"> <span class="built_in">this</span>.$refs[<span class="string">"dataForm"</span>].validate((valid) => {</span><br><span class="line"> <span class="keyword">if</span> (valid) {</span><br><span class="line"> <span class="built_in">this</span>.$http({</span><br><span class="line"> url: <span class="built_in">this</span>.$http.adornUrl(</span><br><span class="line"> `/product/attrgroup/${</span><br><span class="line"> !<span class="built_in">this</span>.dataForm.attrGroupId ? <span class="string">"save"</span> : <span class="string">"update"</span></span><br><span class="line"> }`</span><br><span class="line"> ),</span><br><span class="line"> method: <span class="string">"post"</span>,</span><br><span class="line"> data: <span class="built_in">this</span>.$http.adornData({</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"> }),</span><br><span class="line"> }).then(({ data }) => {</span><br><span class="line"> <span class="keyword">if</span> (data && data.code === <span class="number">0</span>) {</span><br><span class="line"> <span class="built_in">this</span>.$message({</span><br><span class="line"> message: <span class="string">"操作成功"</span>,</span><br><span class="line"> type: <span class="string">"success"</span>,</span><br><span class="line"> duration: <span class="number">1500</span>,</span><br><span class="line"> onClose: () => {</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">"refreshDataList"</span>);</span><br><span class="line"> },</span><br><span class="line"> });</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="built_in">this</span>.$message.error(data.msg);</span><br><span class="line"> }</span><br><span class="line"> });</span><br><span class="line"> }</span><br><span class="line"> });</span><br><span class="line"> },</span><br><span class="line"> },</span><br><span class="line">};</span><br><span class="line"></script></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>后端代码</p>
|
||
<p>在商品分类的children上加上@JsonInclude注解,解决后面的级联选择多出一个空白的选择的问题</p>
|
||
<figure class="highlight java"><table><tr><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<CategoryEntity> children;<span class="comment">//这里的属性名不是瞎起的,与ElementUI中的显示相对应,这里改了,前端也要改</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>修改的时候,级联选择部分数据的回显</p>
|
||
<figure class="highlight plaintext"><table><tr><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) {</span><br><span class="line"> List<Long> paths = new ArrayList<>();</span><br><span class="line"> List<Long> 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"> }</span><br><span class="line"> /**</span><br><span class="line"> * 递归找出所有的路径</span><br><span class="line"> */</span><br><span class="line"> private List<Long> findParentPath(Long catelogId,List<Long> paths){</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){</span><br><span class="line"> findParentPath(category.getParentCid(),paths);</span><br><span class="line"> }</span><br><span class="line"> return paths;</span><br><span class="line"> }</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="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<AttrEntity> <span class="title function_">getRelationAttr</span><span class="params">(Long attrgroupId)</span> {</span><br><span class="line"> <span class="comment">//根据中间表查询出属性分组的id信息</span></span><br><span class="line"> List<AttrAttrgroupRelationEntity> relationEntityList = relationDao.selectList(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><AttrAttrgroupRelationEntity>().eq(AttrAttrgroupRelationEntity::getAttrGroupId, attrgroupId));</span><br><span class="line"> List<Long> attrIds = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> <span class="keyword">for</span> (AttrAttrgroupRelationEntity relationEntity : relationEntityList) {</span><br><span class="line"> attrIds.add(relationEntity.getAttrId());</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//根据属性分组的id查询属性分组的详细信息</span></span><br><span class="line"> <span class="keyword">return</span> (List<AttrEntity>) <span class="built_in">this</span>.listByIds(attrIds);</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>移除关联属性分组的功能后端的关键代码</p>
|
||
<p>service层的代码</p>
|
||
<figure class="highlight java"><table><tr><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> {</span><br><span class="line"> List<AttrAttrgroupRelationEntity> entities = Arrays.asList(vos).stream().map((item) -> {</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"> }).collect(Collectors.toList());</span><br><span class="line"> relationDao.deleteBatchRelation(entities);</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>dao层的代码</p>
|
||
<p>使用动态的sql批量的删除属性和分组的关联关系</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!--void deleteBatchRelation(List<AttrAttrgroupRelationEntity> entities);--></span></span><br><span class="line"> <span class="tag"><<span class="name">delete</span> <span class="attr">id</span>=<span class="string">"deleteBatchRelation"</span>></span></span><br><span class="line"> delete from `pms_attr_attrgroup_relation` where</span><br><span class="line"> <span class="tag"><<span class="name">foreach</span> <span class="attr">collection</span>=<span class="string">"entities"</span> <span class="attr">item</span>=<span class="string">"item"</span> <span class="attr">separator</span>=<span class="string">" OR "</span>></span></span><br><span class="line"> (attr_id = #{item.attrId}) and attr_group_id = #{item.attrGroupId}</span><br><span class="line"> <span class="tag"></<span class="name">foreach</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">delete</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>查询属性分组没有关联的属性</p>
|
||
<figure class="highlight java"><table><tr><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<String, Object> params, Long attrgroupId)</span> {</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<AttrGroupEntity> groups = attrGroupDao.selectList(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><AttrGroupEntity>().eq(AttrGroupEntity::getCatelogId, catelogId));</span><br><span class="line"> List<Long> collect = groups.stream().map((item) -> {</span><br><span class="line"> <span class="keyword">return</span> item.getAttrGroupId();</span><br><span class="line"> }).collect(Collectors.toList());</span><br><span class="line"> List<AttrAttrgroupRelationEntity> groupId = relationDao.selectList(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><AttrAttrgroupRelationEntity>().in(AttrAttrgroupRelationEntity::getAttrGroupId, collect));</span><br><span class="line"> List<Long> attrIds = groupId.stream().map((item) -> {</span><br><span class="line"> <span class="keyword">return</span> item.getAttrId();</span><br><span class="line"> }).collect(Collectors.toList());</span><br><span class="line"> LambdaQueryWrapper<AttrEntity> queryWrapper =</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><AttrEntity>().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> && attrIds.size() > <span class="number">0</span>) {</span><br><span class="line"> queryWrapper.notIn(AttrEntity::getAttrId, attrIds);</span><br><span class="line"> }</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">"key"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(key)) {</span><br><span class="line"> queryWrapper.eq(AttrEntity::getAttrId, key).or().like(AttrEntity::getAttrName, key);</span><br><span class="line"> }</span><br><span class="line"> IPage<AttrEntity> page = <span class="built_in">this</span>.page(<span class="keyword">new</span> <span class="title class_">Query</span><AttrEntity>().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"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>给属性关联相关的规格参数和销售属性</p>
|
||
<figure class="highlight java"><table><tr><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<AttrGroupRelationVo> vos)</span> {</span><br><span class="line"> List<AttrAttrgroupRelationEntity> entities = vos.stream().map((item) -> {</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"> }).collect(Collectors.toList());</span><br><span class="line"> <span class="built_in">this</span>.saveBatch(entities);</span><br><span class="line"> }</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="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> {</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"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>查询列表后端的关键代码</p>
|
||
<p>这里使用的stream流处理数据,没有使用多表联合查询来查询数据</p>
|
||
<figure class="highlight java"><table><tr><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<String, Object> params, Long catelogId)</span> {</span><br><span class="line"> LambdaQueryWrapper<AttrEntity> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><>();</span><br><span class="line"> <span class="keyword">if</span> (catelogId != <span class="number">0</span>) {<span class="comment">//等于0就是查询所有的分类信息下的规格参数信息</span></span><br><span class="line"> queryWrapper.eq(AttrEntity::getCatelogId, catelogId);</span><br><span class="line"> }</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">"key"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(key)) {</span><br><span class="line"> queryWrapper.like(AttrEntity::getAttrName, key).or().eq(AttrEntity::getAttrId, key);</span><br><span class="line"> }</span><br><span class="line"> IPage<AttrEntity> page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span><AttrEntity>().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<AttrEntity> records = page.getRecords();</span><br><span class="line"> List<AttrRespVo> respVos = records.stream().map((attrEntity) -> {</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>) {</span><br><span class="line"> attrRespVo.setCatelogName(categoryEntity.getName());</span><br><span class="line"> }</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><AttrAttrgroupRelationEntity>().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>) {</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"> }</span><br><span class="line"> <span class="keyword">return</span> attrRespVo;</span><br><span class="line"> }).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"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>规格参数修改功能后端的关键代码</p>
|
||
<p>修改前的数据回显</p>
|
||
<p>查询属性的详情信息</p>
|
||
<figure class="highlight java"><table><tr><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> {</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><AttrAttrgroupRelationEntity>().eq(AttrAttrgroupRelationEntity::getAttrId, attrRespVo.getAttrId()));</span><br><span class="line"> <span class="keyword">if</span> (relationEntity != <span class="literal">null</span>) {</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>) {</span><br><span class="line"> attrRespVo.setGroupName(attrGroupEntity.getAttrGroupName());</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="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>) {</span><br><span class="line"> attrRespVo.setCatelogPath(catelogPath);</span><br><span class="line"> }</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>) {</span><br><span class="line"> attrRespVo.setCatelogName(category.getName());</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> attrRespVo;</span><br><span class="line"> }</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="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> {</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<AttrAttrgroupRelationEntity> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><>();</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 > <span class="number">0</span>) {<span class="comment">//判断是修改还是添加的操作</span></span><br><span class="line"> relationDao.update(relationEntity, queryWrapper);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> relationDao.insert(relationEntity);</span><br><span class="line"> }</span><br><span class="line"> }</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="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * /product/attr/sale/list/{catelogId}</span></span><br><span class="line"><span class="comment"> * 路径 /product/attr/base/list/{catelogId}</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("/{attrType}/list/{catelogId}")</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<String, Object> params, <span class="meta">@PathVariable</span> Long catelogId, <span class="meta">@PathVariable("attrType")</span> String type)</span> {</span><br><span class="line"> log.warn(<span class="string">"规格参数分页的查询条件:{},商品分类的id:{}"</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">"page"</span>, page);</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>service层的代码</p>
|
||
<figure class="highlight java"><table><tr><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<String, Object> params, Long catelogId, String type)</span> {</span><br><span class="line"> LambdaQueryWrapper<AttrEntity> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><>();</span><br><span class="line"> <span class="comment">//路径中属性的attrType是base就是基本属性,否则就代表的是销售属性</span></span><br><span class="line"> queryWrapper.eq(AttrEntity::getAttrType, <span class="string">"base"</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>) {<span class="comment">//等于0就是查询所有的分类信息下的规格参数信息</span></span><br><span class="line"> queryWrapper.eq(AttrEntity::getCatelogId, catelogId);</span><br><span class="line"> }</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">"key"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(key)) {</span><br><span class="line"> queryWrapper.like(AttrEntity::getAttrName, key).or().eq(AttrEntity::getAttrId, key);</span><br><span class="line"> }</span><br><span class="line"> IPage<AttrEntity> page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span><AttrEntity>().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<AttrEntity> records = page.getRecords();</span><br><span class="line"> List<AttrRespVo> respVos = records.stream().map((attrEntity) -> {</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>) {</span><br><span class="line"> attrRespVo.setCatelogName(categoryEntity.getName());</span><br><span class="line"> }</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><AttrAttrgroupRelationEntity>().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>) {</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>) {</span><br><span class="line"> attrRespVo.setGroupName(attrGroupEntity.getAttrGroupName());</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> attrRespVo;</span><br><span class="line"> }).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"> }</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="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<String, Object> params)</span> {</span><br><span class="line"> LambdaQueryWrapper<SpuInfoEntity> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</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">"key"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(key)) {</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) -> {</span><br><span class="line"> wrapper.like(SpuInfoEntity::getSpuName, key).or().eq(SpuInfoEntity::getId, key);</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="type">String</span> <span class="variable">catelogId</span> <span class="operator">=</span> (String) params.get(<span class="string">"catelogId"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(catelogId)) {</span><br><span class="line"> queryWrapper.eq(SpuInfoEntity::getCatalogId, catelogId);</span><br><span class="line"> }</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">"brandId"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(brandId)) {</span><br><span class="line"> queryWrapper.eq(SpuInfoEntity::getBrandId, brandId);</span><br><span class="line"> }</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">"status"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(status)) {</span><br><span class="line"> queryWrapper.eq(SpuInfoEntity::getPublishStatus, status);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> IPage<SpuInfoEntity> page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span><SpuInfoEntity>().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"> }</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="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="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/{spuId}</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@GetMapping("/base/listforspu/{spuId}")</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("spuId")</span> Long spuId)</span>{</span><br><span class="line"> List<ProductAttrValueEntity> entities = productAttrValueService.baseAttrListForSpu(spuId);</span><br><span class="line"> <span class="keyword">return</span> R.ok().put(<span class="string">"data"</span>,entities);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>修改商品的规格</strong></p>
|
||
<figure class="highlight java"><table><tr><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<ProductAttrValueEntity> productAttrValueEntities)</span> {</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><ProductAttrValueEntity>().eq(ProductAttrValueEntity::getSpuId,spuId));</span><br><span class="line"> <span class="comment">//2.添加修改之后的商品的属性信息</span></span><br><span class="line"> List<ProductAttrValueEntity> collect = productAttrValueEntities.stream().map(item -> {</span><br><span class="line"> item.setSpuId(spuId);</span><br><span class="line"> <span class="keyword">return</span> item;</span><br><span class="line"> }).collect(Collectors.toList());</span><br><span class="line"> <span class="built_in">this</span>.saveBatch(collect);</span><br><span class="line"> }</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="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">'规格维护'</span>, <span class="string">'product/attrupdate'</span>, <span class="string">''</span>, <span class="number">2</span>, <span class="string">'log'</span>, <span class="number">0</span>);</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>第二步:将前端src/router/index.js替换成如下的内容</p>
|
||
<figure class="highlight js"><table><tr><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">'vue'</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">'vue-router'</span></span><br><span class="line"><span class="keyword">import</span> http <span class="keyword">from</span> <span class="string">'@/utils/httpRequest'</span></span><br><span class="line"><span class="keyword">import</span> { isURL } <span class="keyword">from</span> <span class="string">'@/utils/validate'</span></span><br><span class="line"><span class="keyword">import</span> { clearLoginInfo } <span class="keyword">from</span> <span class="string">'@/utils'</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">'./import-'</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"> { <span class="attr">path</span>: <span class="string">'/404'</span>, <span class="attr">component</span>: <span class="title function_">_import</span>(<span class="string">'common/404'</span>), <span class="attr">name</span>: <span class="string">'404'</span>, <span class="attr">meta</span>: { <span class="attr">title</span>: <span class="string">'404未找到'</span> } },</span><br><span class="line"> { <span class="attr">path</span>: <span class="string">'/login'</span>, <span class="attr">component</span>: <span class="title function_">_import</span>(<span class="string">'common/login'</span>), <span class="attr">name</span>: <span class="string">'login'</span>, <span class="attr">meta</span>: { <span class="attr">title</span>: <span class="string">'登录'</span> } }</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 = {</span><br><span class="line"> <span class="attr">path</span>: <span class="string">'/'</span>,</span><br><span class="line"> <span class="attr">component</span>: <span class="title function_">_import</span>(<span class="string">'main'</span>),</span><br><span class="line"> <span class="attr">name</span>: <span class="string">'main'</span>,</span><br><span class="line"> <span class="attr">redirect</span>: { <span class="attr">name</span>: <span class="string">'home'</span> },</span><br><span class="line"> <span class="attr">meta</span>: { <span class="attr">title</span>: <span class="string">'主入口整体布局'</span> },</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嵌套展示内容, '以http[s]://开头': 是, '': 否</span></span><br><span class="line"> <span class="comment">// 提示: 如需要通过iframe嵌套展示内容, 但不通过tab打开, 请自行创建组件使用iframe处理!</span></span><br><span class="line"> { <span class="attr">path</span>: <span class="string">'/home'</span>, <span class="attr">component</span>: <span class="title function_">_import</span>(<span class="string">'common/home'</span>), <span class="attr">name</span>: <span class="string">'home'</span>, <span class="attr">meta</span>: { <span class="attr">title</span>: <span class="string">'首页'</span> } },</span><br><span class="line"> { <span class="attr">path</span>: <span class="string">'/theme'</span>, <span class="attr">component</span>: <span class="title function_">_import</span>(<span class="string">'common/theme'</span>), <span class="attr">name</span>: <span class="string">'theme'</span>, <span class="attr">meta</span>: { <span class="attr">title</span>: <span class="string">'主题'</span> } },</span><br><span class="line"> { <span class="attr">path</span>: <span class="string">'/demo-echarts'</span>, <span class="attr">component</span>: <span class="title function_">_import</span>(<span class="string">'demo/echarts'</span>), <span class="attr">name</span>: <span class="string">'demo-echarts'</span>, <span class="attr">meta</span>: { <span class="attr">title</span>: <span class="string">'demo-echarts'</span>, <span class="attr">isTab</span>: <span class="literal">true</span> } },</span><br><span class="line"> { <span class="attr">path</span>: <span class="string">'/demo-ueditor'</span>, <span class="attr">component</span>: <span class="title function_">_import</span>(<span class="string">'demo/ueditor'</span>), <span class="attr">name</span>: <span class="string">'demo-ueditor'</span>, <span class="attr">meta</span>: { <span class="attr">title</span>: <span class="string">'demo-ueditor'</span>, <span class="attr">isTab</span>: <span class="literal">true</span> } },</span><br><span class="line"> { <span class="attr">path</span>: <span class="string">'/product-attrupdate'</span>, <span class="attr">component</span>: <span class="title function_">_import</span>(<span class="string">'modules/product/attrupdate'</span>), <span class="attr">name</span>: <span class="string">'attr-update'</span>, <span class="attr">meta</span>: { <span class="attr">title</span>: <span class="string">'规格维护'</span>, <span class="attr">isTab</span>: <span class="literal">true</span> } }</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>) {</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">'token'</span>)</span><br><span class="line"> <span class="keyword">if</span> (!token || !<span class="regexp">/\S/</span>.<span class="title function_">test</span>(token)) {</span><br><span class="line"> <span class="title function_">clearLoginInfo</span>()</span><br><span class="line"> <span class="title function_">next</span>({ <span class="attr">name</span>: <span class="string">'login'</span> })</span><br><span class="line"> }</span><br><span class="line"> <span class="title function_">next</span>()</span><br><span class="line"> }</span><br><span class="line">}</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>({</span><br><span class="line"> <span class="attr">mode</span>: <span class="string">'hash'</span>,</span><br><span class="line"> <span class="attr">scrollBehavior</span>: <span class="function">() =></span> ({ <span class="attr">y</span>: <span class="number">0</span> }),</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">})</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>) =></span> {</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">'global'</span>) {</span><br><span class="line"> <span class="title function_">next</span>()</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="title function_">http</span>({</span><br><span class="line"> <span class="attr">url</span>: http.<span class="title function_">adornUrl</span>(<span class="string">'/sys/menu/nav'</span>),</span><br><span class="line"> <span class="attr">method</span>: <span class="string">'get'</span>,</span><br><span class="line"> <span class="attr">params</span>: http.<span class="title function_">adornParams</span>()</span><br><span class="line"> }).<span class="title function_">then</span>(<span class="function">(<span class="params">{ data }</span>) =></span> {</span><br><span class="line"> <span class="keyword">if</span> (data && data.<span class="property">code</span> === <span class="number">0</span>) {</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">'menuList'</span>, <span class="title class_">JSON</span>.<span class="title function_">stringify</span>(data.<span class="property">menuList</span> || <span class="string">'[]'</span>))</span><br><span class="line"> <span class="variable language_">sessionStorage</span>.<span class="title function_">setItem</span>(<span class="string">'permissions'</span>, <span class="title class_">JSON</span>.<span class="title function_">stringify</span>(data.<span class="property">permissions</span> || <span class="string">'[]'</span>))</span><br><span class="line"> <span class="title function_">next</span>({ ...to, <span class="attr">replace</span>: <span class="literal">true</span> })</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="variable language_">sessionStorage</span>.<span class="title function_">setItem</span>(<span class="string">'menuList'</span>, <span class="string">'[]'</span>)</span><br><span class="line"> <span class="variable language_">sessionStorage</span>.<span class="title function_">setItem</span>(<span class="string">'permissions'</span>, <span class="string">'[]'</span>)</span><br><span class="line"> <span class="title function_">next</span>()</span><br><span class="line"> }</span><br><span class="line"> }).<span class="title function_">catch</span>(<span class="function">(<span class="params">e</span>) =></span> {</span><br><span class="line"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">`%c<span class="subst">${e}</span> 请求菜单列表和权限失败,跳转至登录页!!`</span>, <span class="string">'color:blue'</span>)</span><br><span class="line"> router.<span class="title function_">push</span>({ <span class="attr">name</span>: <span class="string">'login'</span> })</span><br><span class="line"> })</span><br><span class="line"> }</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"> * 判断当前路由类型, global: 全局路由, main: 主入口路由</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> {<span class="type">*</span>} 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>) {</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 < globalRoutes.<span class="property">length</span>; i++) {</span><br><span class="line"> <span class="keyword">if</span> (route.<span class="property">path</span> === globalRoutes[i].<span class="property">path</span>) {</span><br><span class="line"> <span class="keyword">return</span> <span class="string">'global'</span></span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (globalRoutes[i].<span class="property">children</span> && globalRoutes[i].<span class="property">children</span>.<span class="property">length</span> >= <span class="number">1</span>) {</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"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> temp.<span class="property">length</span> >= <span class="number">1</span> ? <span class="title function_">fnCurrentRouteType</span>(route, temp) : <span class="string">'main'</span></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 class="doctag">@param</span> {<span class="type">*</span>} menuList 菜单列表</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> {<span class="type">*</span>} 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>) {</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 < menuList.<span class="property">length</span>; i++) {</span><br><span class="line"> <span class="keyword">if</span> (menuList[i].<span class="property">list</span> && menuList[i].<span class="property">list</span>.<span class="property">length</span> >= <span class="number">1</span>) {</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"> } <span class="keyword">else</span> <span class="keyword">if</span> (menuList[i].<span class="property">url</span> && <span class="regexp">/\S/</span>.<span class="title function_">test</span>(menuList[i].<span class="property">url</span>)) {</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">''</span>)</span><br><span class="line"> <span class="keyword">var</span> route = {</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">'/'</span>, <span class="string">'-'</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">'/'</span>, <span class="string">'-'</span>),</span><br><span class="line"> <span class="attr">meta</span>: {</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">''</span></span><br><span class="line"> }</span><br><span class="line"> }</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>)) {</span><br><span class="line"> route[<span class="string">'path'</span>] = <span class="string">`i-<span class="subst">${menuList[i].menuId}</span>`</span></span><br><span class="line"> route[<span class="string">'name'</span>] = <span class="string">`i-<span class="subst">${menuList[i].menuId}</span>`</span></span><br><span class="line"> route[<span class="string">'meta'</span>][<span class="string">'iframeUrl'</span>] = menuList[i].<span class="property">url</span></span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> route[<span class="string">'component'</span>] = <span class="title function_">_import</span>(<span class="string">`modules/<span class="subst">${menuList[i].url}</span>`</span>) || <span class="literal">null</span></span><br><span class="line"> } <span class="keyword">catch</span> (e) { }</span><br><span class="line"> }</span><br><span class="line"> routes.<span class="title function_">push</span>(route)</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (temp.<span class="property">length</span> >= <span class="number">1</span>) {</span><br><span class="line"> <span class="title function_">fnAddDynamicMenuRoutes</span>(temp, routes)</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> mainRoutes.<span class="property">name</span> = <span class="string">'main-dynamic'</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"> { <span class="attr">path</span>: <span class="string">'*'</span>, <span class="attr">redirect</span>: { <span class="attr">name</span>: <span class="string">'404'</span> } }</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">'dynamicMenuRoutes'</span>, <span class="title class_">JSON</span>.<span class="title function_">stringify</span>(mainRoutes.<span class="property">children</span> || <span class="string">'[]'</span>))</span><br><span class="line"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">'\n'</span>)</span><br><span class="line"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">'%c!<-------------------- 动态(菜单)路由 s -------------------->'</span>, <span class="string">'color:blue'</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">'%c!<-------------------- 动态(菜单)路由 e -------------------->'</span>, <span class="string">'color:blue'</span>)</span><br><span class="line"> }</span><br><span class="line">}</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="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<BrandEntity> <span class="title function_">getBrandsByCatId</span><span class="params">(Long catId)</span> {</span><br><span class="line"> List<CategoryBrandRelationEntity> categoryBrandRelationEntityList = relationDao.selectList(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><CategoryBrandRelationEntity>().eq(CategoryBrandRelationEntity::getCatelogId, catId));</span><br><span class="line"> List<BrandEntity> brandEntityList = categoryBrandRelationEntityList.stream().map(item -> {</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"> }).collect(Collectors.toList());</span><br><span class="line"> <span class="keyword">return</span> brandEntityList;</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>根据JSON数据生成实体类</strong></p>
|
||
<p>生成工具: <a 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="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"spuName"</span><span class="punctuation">:</span> <span class="string">"华为Mate30 Pro"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"spuDescription"</span><span class="punctuation">:</span> <span class="string">"华为手机"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"catalogId"</span><span class="punctuation">:</span> <span class="number">225</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"brandId"</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"weight"</span><span class="punctuation">:</span> <span class="number">0.198</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"publishStatus"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"decript"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/7b9f237d-9d37-4087-83bd-13d0ea76eda4_73366cc235d68202.jpg"</span><span class="punctuation">,</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/e5c4fbe5-0685-4a12-8623-a4972c623d6c_528211b97272d88a.jpg"</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"images"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/7627fc94-1ac7-4406-8e1c-3866a002918b_0d40c24b264aa511.jpg"</span><span class="punctuation">,</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/e5364a2e-9f46-433b-827b-33c1ff8c991c_919c850652e98031.jpg"</span><span class="punctuation">,</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/997dd5dd-be60-4547-871c-23b1273df596_1f15cdbcf9e1273c.jpg"</span><span class="punctuation">,</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/788f45d7-d399-4482-88db-4dd939a51f4a_2b1837c6c50add30.jpg"</span><span class="punctuation">,</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/b18dd3f9-3a38-4e9a-86a0-8c24db552a09_3c24f9cd69534030.jpg"</span><span class="punctuation">,</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/d19426e9-c518-4fc8-85dd-7fae758a4000_23d9fbb256ea5d4a.jpg"</span><span class="punctuation">,</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/7200dec5-af25-4264-87dc-19985c4cbe23_335b2c690e43a8f8.jpg"</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"bounds"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"buyBounds"</span><span class="punctuation">:</span> <span class="number">500</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"growBounds"</span><span class="punctuation">:</span> <span class="number">500</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"baseAttrs"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attrId"</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrValues"</span><span class="punctuation">:</span> <span class="string">"2019"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"showDesc"</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attrId"</span><span class="punctuation">:</span> <span class="number">4</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrValues"</span><span class="punctuation">:</span> <span class="string">"mate30pro"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"showDesc"</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attrId"</span><span class="punctuation">:</span> <span class="number">10</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrValues"</span><span class="punctuation">:</span> <span class="string">"45W"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"showDesc"</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attrId"</span><span class="punctuation">:</span> <span class="number">11</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrValues"</span><span class="punctuation">:</span> <span class="string">"LCD;OLED"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"showDesc"</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attrId"</span><span class="punctuation">:</span> <span class="number">8</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrValues"</span><span class="punctuation">:</span> <span class="string">"16GB"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"showDesc"</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skus"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attr"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attrId"</span><span class="punctuation">:</span> <span class="number">7</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrName"</span><span class="punctuation">:</span> <span class="string">"手机颜色"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrValue"</span><span class="punctuation">:</span> <span class="string">"星河银"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attrId"</span><span class="punctuation">:</span> <span class="number">9</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrName"</span><span class="punctuation">:</span> <span class="string">"商品产地"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrValue"</span><span class="punctuation">:</span> <span class="string">"中国"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skuName"</span><span class="punctuation">:</span> <span class="string">"华为Mate30 Pro 星河银 中国"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"price"</span><span class="punctuation">:</span> <span class="string">"5799"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skuTitle"</span><span class="punctuation">:</span> <span class="string">"华为(HUAWEI) 华为Mate30 Pro全网通智能手机 (5G/4G)"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skuSubtitle"</span><span class="punctuation">:</span> <span class="string">"星河银的副标题"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"images"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/7627fc94-1ac7-4406-8e1c-3866a002918b_0d40c24b264aa511.jpg"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/e5364a2e-9f46-433b-827b-33c1ff8c991c_919c850652e98031.jpg"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/788f45d7-d399-4482-88db-4dd939a51f4a_2b1837c6c50add30.jpg"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/b18dd3f9-3a38-4e9a-86a0-8c24db552a09_3c24f9cd69534030.jpg"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"descar"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="string">"星河银"</span><span class="punctuation">,</span> <span class="string">"中国"</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"fullCount"</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"discount"</span><span class="punctuation">:</span> <span class="number">0.98</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"countStatus"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"fullPrice"</span><span class="punctuation">:</span> <span class="number">10000</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"reducePrice"</span><span class="punctuation">:</span> <span class="number">50</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"priceStatus"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"memberPrice"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"id"</span><span class="punctuation">:</span> <span class="number">2</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"铜牌会员"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"price"</span><span class="punctuation">:</span> <span class="number">5788</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"id"</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"银牌会员"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"price"</span><span class="punctuation">:</span> <span class="number">5699</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attr"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attrId"</span><span class="punctuation">:</span> <span class="number">7</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrName"</span><span class="punctuation">:</span> <span class="string">"手机颜色"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrValue"</span><span class="punctuation">:</span> <span class="string">"亮黑色"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attrId"</span><span class="punctuation">:</span> <span class="number">9</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrName"</span><span class="punctuation">:</span> <span class="string">"商品产地"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrValue"</span><span class="punctuation">:</span> <span class="string">"中国"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skuName"</span><span class="punctuation">:</span> <span class="string">"华为Mate30 Pro 亮黑色 中国"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"price"</span><span class="punctuation">:</span> <span class="string">"6299"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skuTitle"</span><span class="punctuation">:</span> <span class="string">"华为(HUAWEI) 华为Mate30 Pro全网通智能手机 (5G/4G)"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skuSubtitle"</span><span class="punctuation">:</span> <span class="string">"亮黑色的副标题"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"images"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/997dd5dd-be60-4547-871c-23b1273df596_1f15cdbcf9e1273c.jpg"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/7200dec5-af25-4264-87dc-19985c4cbe23_335b2c690e43a8f8.jpg"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"descar"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="string">"亮黑色"</span><span class="punctuation">,</span> <span class="string">"中国"</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"fullCount"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"discount"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"countStatus"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"fullPrice"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"reducePrice"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"priceStatus"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"memberPrice"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"id"</span><span class="punctuation">:</span> <span class="number">2</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"铜牌会员"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"price"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"id"</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"银牌会员"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"price"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attr"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attrId"</span><span class="punctuation">:</span> <span class="number">7</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrName"</span><span class="punctuation">:</span> <span class="string">"手机颜色"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrValue"</span><span class="punctuation">:</span> <span class="string">"翡冷翠"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attrId"</span><span class="punctuation">:</span> <span class="number">9</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrName"</span><span class="punctuation">:</span> <span class="string">"商品产地"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrValue"</span><span class="punctuation">:</span> <span class="string">"中国"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skuName"</span><span class="punctuation">:</span> <span class="string">"华为Mate30 Pro 翡冷翠 中国"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"price"</span><span class="punctuation">:</span> <span class="string">"6299"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skuTitle"</span><span class="punctuation">:</span> <span class="string">"华为(HUAWEI) 华为Mate30 Pro全网通智能手机 (5G/4G)"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skuSubtitle"</span><span class="punctuation">:</span> <span class="string">"翡冷翠的副标题"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"images"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/997dd5dd-be60-4547-871c-23b1273df596_1f15cdbcf9e1273c.jpg"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/d19426e9-c518-4fc8-85dd-7fae758a4000_23d9fbb256ea5d4a.jpg"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"descar"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="string">"翡冷翠"</span><span class="punctuation">,</span> <span class="string">"中国"</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"fullCount"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"discount"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"countStatus"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"fullPrice"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"reducePrice"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"priceStatus"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"memberPrice"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"id"</span><span class="punctuation">:</span> <span class="number">2</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"铜牌会员"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"price"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"id"</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"银牌会员"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"price"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attr"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attrId"</span><span class="punctuation">:</span> <span class="number">7</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrName"</span><span class="punctuation">:</span> <span class="string">"手机颜色"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrValue"</span><span class="punctuation">:</span> <span class="string">"罗兰紫"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attrId"</span><span class="punctuation">:</span> <span class="number">9</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrName"</span><span class="punctuation">:</span> <span class="string">"商品产地"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrValue"</span><span class="punctuation">:</span> <span class="string">"中国"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skuName"</span><span class="punctuation">:</span> <span class="string">"华为Mate30 Pro 罗兰紫 中国"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"price"</span><span class="punctuation">:</span> <span class="string">"5799"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skuTitle"</span><span class="punctuation">:</span> <span class="string">"华为(HUAWEI) 华为Mate30 Pro全网通智能手机 (5G/4G)"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skuSubtitle"</span><span class="punctuation">:</span> <span class="string">"罗兰紫的副标题"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"images"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/e5364a2e-9f46-433b-827b-33c1ff8c991c_919c850652e98031.jpg"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/997dd5dd-be60-4547-871c-23b1273df596_1f15cdbcf9e1273c.jpg"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"imgUrl"</span><span class="punctuation">:</span> <span class="string">""</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"defaultImg"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"descar"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="string">"罗兰紫"</span><span class="punctuation">,</span> <span class="string">"中国"</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"fullCount"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"discount"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"countStatus"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"fullPrice"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"reducePrice"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"priceStatus"</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"memberPrice"</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"id"</span><span class="punctuation">:</span> <span class="number">2</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"铜牌会员"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"price"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"id"</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"name"</span><span class="punctuation">:</span> <span class="string">"银牌会员"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"price"</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">]</span></span><br><span class="line"><span class="punctuation">}</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="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> {</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<String> 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">","</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<String> 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<BaseAttrs> baseAttrs = vo.getBaseAttrs();</span><br><span class="line"> List<ProductAttrValueEntity> collect = baseAttrs.stream().map(attr -> {</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"> }).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>) {</span><br><span class="line"> log.error(<span class="string">"远程保存spu的积分信息失败"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//保存当前spu对应的sku信息</span></span><br><span class="line"> List<Skus> skus = vo.getSkus();</span><br><span class="line"> <span class="keyword">if</span> (skus != <span class="literal">null</span> && skus.size() != <span class="number">0</span>) {</span><br><span class="line"> skus.forEach(item -> {</span><br><span class="line"> <span class="type">String</span> <span class="variable">defaultImg</span> <span class="operator">=</span> <span class="string">""</span>;</span><br><span class="line"> <span class="keyword">for</span> (Images img : item.getImages()) {</span><br><span class="line"> <span class="keyword">if</span> (img.getDefaultImg() == <span class="number">1</span>) {</span><br><span class="line"> defaultImg = img.getImgUrl();</span><br><span class="line"> }</span><br><span class="line"> }</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<SkuImagesEntity> imagesEntities = item.getImages().stream().map(img -> {</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"> }).filter(entity -> {</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"> }).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<Attr> attrs = item.getAttr();</span><br><span class="line"> List<SkuSaleAttrValueEntity> skuSaleAttrValueEntities = attrs.stream().map(attr -> {</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"> }).collect(Collectors.toList());</span><br><span class="line"> skuSaleAttrValueService.saveBatch(skuSaleAttrValueEntities);</span><br><span class="line"> <span class="comment">// sku的优惠信息、满减等信息gulimall_sms->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<MemberPrice> memberPrices = item.getMemberPrice().stream().map(memberPrice -> {</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"> }).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() > <span class="number">0</span> || skuReductionTo.getFullPrice().compareTo(<span class="keyword">new</span> <span class="title class_">BigDecimal</span>(<span class="string">"0"</span>)) == <span class="number">1</span>) {</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>) {</span><br><span class="line"> log.error(<span class="string">"远程调用sku的优惠信息、满减信息失败"</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> });</span><br><span class="line"> }</span><br><span class="line">}</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="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"> * page: 1,//当前页码</span></span><br><span class="line"><span class="comment"> * limit: 10,//每页记录数</span></span><br><span class="line"><span class="comment"> * sidx: 'id',//排序字段</span></span><br><span class="line"><span class="comment"> * order: 'asc/desc',//排序方式</span></span><br><span class="line"><span class="comment"> * key: '华为',//检索关键字</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"> * }</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<String, Object> params)</span> {</span><br><span class="line"> LambdaQueryWrapper<SkuInfoEntity> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><>();</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 >= ? AND price <= ?) 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">"key"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(key)) {</span><br><span class="line"> queryWrapper.and((wrapper) -> {</span><br><span class="line"> wrapper.eq(SkuInfoEntity::getSkuId, key).or().like(SkuInfoEntity::getSkuName, key);</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="type">String</span> <span class="variable">catelogId</span> <span class="operator">=</span> (String) params.get(<span class="string">"catelogId"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(catelogId) && !<span class="string">"0"</span>.equalsIgnoreCase(catelogId)) {</span><br><span class="line"> queryWrapper.eq(SkuInfoEntity::getCatalogId, catelogId);</span><br><span class="line"> }</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">"brandId"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(brandId) && !<span class="string">"0"</span>.equalsIgnoreCase(brandId)) {</span><br><span class="line"> queryWrapper.eq(SkuInfoEntity::getBrandId, brandId);</span><br><span class="line"> }</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">"min"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(min)) {</span><br><span class="line"> queryWrapper.ge(SkuInfoEntity::getPrice, min);</span><br><span class="line"> }</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">"max"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(max)) {</span><br><span class="line"> <span class="keyword">try</span> {</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">"0"</span>))==<span class="number">1</span>){<span class="comment">//说明大于0</span></span><br><span class="line"> queryWrapper.le(SkuInfoEntity::getPrice, max);</span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> log.error(<span class="string">"com/atguigu/gulimall/product/service/impl/SkuInfoServiceImpl"</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"> }</span><br><span class="line"> }</span><br><span class="line"> IPage<SkuInfoEntity> page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span><SkuInfoEntity>().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"> }</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="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<String, Object> params)</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">//分页查询的条件</span></span><br><span class="line"> LambdaQueryWrapper<WareInfoEntity> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</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">"key"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(key)) {</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"> }</span><br><span class="line"> IPage<WareInfoEntity> page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span><WareInfoEntity>().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"> }</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="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"> * page: 1,//当前页码</span></span><br><span class="line"><span class="comment"> * limit: 10,//每页记录数</span></span><br><span class="line"><span class="comment"> * sidx: 'id',//排序字段</span></span><br><span class="line"><span class="comment"> * order: 'asc/desc',//排序方式</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"> * }</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<String, Object> params)</span> {</span><br><span class="line"> LambdaQueryWrapper<WareSkuEntity> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><>();</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">"wareId"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(wareId)) {</span><br><span class="line"> queryWrapper.eq(WareSkuEntity::getWareId, wareId);</span><br><span class="line"> }</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">"skuId"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(skuId)) {</span><br><span class="line"> queryWrapper.eq(WareSkuEntity::getSkuId, skuId);</span><br><span class="line"> }</span><br><span class="line"> IPage<WareSkuEntity> page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span><WareSkuEntity>().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"> }</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="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<String, Object> params)</span> {</span><br><span class="line"> LambdaQueryWrapper<PurchaseDetailEntity> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</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">"status"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(status)) {</span><br><span class="line"> queryWrapper.eq(PurchaseDetailEntity::getStatus, status);</span><br><span class="line"> }</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">"wareId"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(wareId)) {</span><br><span class="line"> queryWrapper.eq(PurchaseDetailEntity::getWareId, wareId);</span><br><span class="line"> }</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">"key"</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(key)) {</span><br><span class="line"> queryWrapper.and((wrapper->{</span><br><span class="line"> wrapper.eq(PurchaseDetailEntity::getPurchaseId, key).or().like(PurchaseDetailEntity::getSkuId,key);</span><br><span class="line"> }));</span><br><span class="line"> }</span><br><span class="line"> IPage<PurchaseDetailEntity> page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span><PurchaseDetailEntity>().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"> }</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="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<String, Object> params)</span> {</span><br><span class="line"> IPage<PurchaseEntity> page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span><PurchaseEntity>().getPage(params),</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><PurchaseEntity>().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"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>合并采购需求</strong></p>
|
||
<figure class="highlight java"><table><tr><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> {</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>) {<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"> }</span><br><span class="line"> List<Long> 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<PurchaseDetailEntity> detailEntityList = items.stream().map(item -> {</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"> }).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"> }</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="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<Long> ids)</span> {</span><br><span class="line"> <span class="comment">//确认当前的采购单是新建或者分配状态</span></span><br><span class="line"> List<PurchaseEntity> purchaseEntities = ids.stream().map(id -> {</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"> }).filter(item -> {</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()) {</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"> }).map(item->{</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"> }).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->{</span><br><span class="line"> List<PurchaseDetailEntity> entities = detailService.listDetailByPurchaseId(item.getId());</span><br><span class="line"> List<PurchaseDetailEntity> detailEntityList = entities.stream().map(entity -> {</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"> }).collect(Collectors.toList());</span><br><span class="line"> detailService.updateBatchById(detailEntityList);</span><br><span class="line"> });</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>完成采购的功能</strong></p>
|
||
<figure class="highlight java"><table><tr><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> {</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<PurchaseItemDoneVo> items = doneVo.getItems();</span><br><span class="line"> List<PurchaseDetailEntity> purchaseItemDoneVos = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> <span class="keyword">for</span> (PurchaseItemDoneVo item : items) {</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()) {</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"> } <span class="keyword">else</span> {</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"> }</span><br><span class="line"> detailEntity.setId(item.getItemId());</span><br><span class="line"> purchaseItemDoneVos.add(detailEntity);</span><br><span class="line"> }</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"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>修改库存的功能</strong></p>
|
||
<figure class="highlight java"><table><tr><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> {</span><br><span class="line"> <span class="comment">//判断是添加的操作还是修改的操作</span></span><br><span class="line"> List<WareSkuEntity> wareSkuEntities = wareSkuDao.selectList(<span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><WareSkuEntity>().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>) {</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> {</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>){</span><br><span class="line"> Map<String,Object> skuInfo = (Map<String, Object>) r.get(<span class="string">"skuInfo"</span>);</span><br><span class="line"> wareSkuEntity.setSkuName((String) skuInfo.get(<span class="string">"skuName"</span>));</span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> log.warn(<span class="string">"远程获取商品的Sku信息失败!"</span>);</span><br><span class="line"> }</span><br><span class="line"> wareSkuDao.insert(wareSkuEntity);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> wareSkuDao.addStock(skuId, wareId, skuNum);</span><br><span class="line"> }</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>sql语句</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"> <span class="comment"><!--void addStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("skuNum") Integer skuNum);--></span></span><br><span class="line"><span class="tag"><<span class="name">insert</span> <span class="attr">id</span>=<span class="string">"addStock"</span>></span></span><br><span class="line"> update `wms_ware_sku`</span><br><span class="line"> set stock = stock + #{skuNum}</span><br><span class="line"> where sku_id = #{skuId}</span><br><span class="line"> and ware_id = #{wareId}</span><br><span class="line"><span class="tag"></<span class="name">insert</span>></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://qingling.icu/posts/22654.html">ElasticSearch | The Blog (qingling.icu)</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="code"><pre><span class="line">PUT product</span><br><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"mappings"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"properties"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"skuId"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"long"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"spuId"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"keyword"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skuTitle"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"text"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"analyzer"</span><span class="punctuation">:</span> <span class="string">"ik_smart"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skuPrice"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"keyword"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"skuImg"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"keyword"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"index"</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">"doc_values"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"saleCount"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"long"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"hasStock"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"boolean"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"hotScore"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"long"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"brandId"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"long"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"catalogId"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"long"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"brandName"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"keyword"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"index"</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">"doc_values"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"brandImg"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"keyword"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"index"</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">"doc_values"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"catalogName"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"keyword"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"index"</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">"doc_values"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrs"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"nested"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"properties"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"attrId"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"long"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrName"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"keyword"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"index"</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">"doc_values"</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"attrValue"</span><span class="punctuation">:</span> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span> <span class="string">"keyword"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>2.上架功能后端代码</strong></p>
|
||
<p>所需的实体类</p>
|
||
<figure class="highlight java"><table><tr><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> {</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<Attrs> 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> {</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"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>商品上架的后端关键代码</p>
|
||
<figure class="highlight java"><table><tr><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> {</span><br><span class="line"> <span class="comment">//查询当前spuId对应的所有sku信息</span></span><br><span class="line"> List<SkuInfoEntity> skus = skuInfoService.getSkusBySpuId(spuId);</span><br><span class="line"> List<Long> skuIds = skus.stream().map(SkuInfoEntity::getSkuId).collect(Collectors.toList());</span><br><span class="line"> <span class="comment">//规格属性信息的封装(可以被检索的规格属性信息)</span></span><br><span class="line"> List<ProductAttrValueEntity> baseAttrs = productAttrValueService.baseAttrListForSpu(spuId);</span><br><span class="line"> List<Long> attrIds = baseAttrs.stream().map(attr -> {</span><br><span class="line"> <span class="keyword">return</span> attr.getAttrId();</span><br><span class="line"> }).collect(Collectors.toList());</span><br><span class="line"> <span class="comment">//获取可以检索的属性id的集合</span></span><br><span class="line"> List<Long> searchAttrIds = attrService.selectSearchAttrs(attrIds);</span><br><span class="line"> <span class="comment">//将其转换成set集合</span></span><br><span class="line"> Set<Long> idSet = <span class="keyword">new</span> <span class="title class_">HashSet</span><>(searchAttrIds);</span><br><span class="line"> <span class="comment">//最终需要封装的attrs</span></span><br><span class="line"> List<SkuEsModel.Attrs> attrs = baseAttrs.stream().filter(item -> {</span><br><span class="line"> <span class="keyword">return</span> idSet.contains(item.getAttrId());</span><br><span class="line"> }).map(item -> {</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"> }).collect(Collectors.toList());</span><br><span class="line"> <span class="comment">//库存</span></span><br><span class="line"> Map<Long, Boolean> stockMap = <span class="literal">null</span>;</span><br><span class="line"> <span class="keyword">try</span> {</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<SkuHasStockVo> skuHasStockVos = r.getData(<span class="keyword">new</span> <span class="title class_">TypeReference</span><List<SkuHasStockVo>>(){});</span><br><span class="line"> stockMap = skuHasStockVos.stream().collect(Collectors.toMap(SkuHasStockVo::getSkuId, item -> item.getHasStock()));</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> log.error(<span class="string">"库存服务查询异常:原因{}"</span>,e);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//封装sku的信息</span></span><br><span class="line"> Map<Long, Boolean> finalStockMap = stockMap;</span><br><span class="line"> List<SkuEsModel> upProducts = skus.stream().map(sku -> {</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>){</span><br><span class="line"> skuEsModel.setHasStock(<span class="literal">true</span>);</span><br><span class="line"> }<span class="keyword">else</span> {</span><br><span class="line"> skuEsModel.setHasStock(finalStockMap.get(sku.getSkuId()));</span><br><span class="line"> }</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"> }).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>){</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"> }<span class="keyword">else</span> {</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"> }</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><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<Long> <span class="title function_">selectSearchAttrs</span><span class="params">(List<Long> attrIds)</span> {</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"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">select</span> <span class="attr">id</span>=<span class="string">"selectSearchAttrs"</span> <span class="attr">resultType</span>=<span class="string">"java.lang.Long"</span>></span></span><br><span class="line"> select `attr_id`from `pms_attr` where `attr_id` in</span><br><span class="line"> <span class="tag"><<span class="name">foreach</span> <span class="attr">collection</span>=<span class="string">"attrIds"</span> <span class="attr">item</span>=<span class="string">"attr"</span> <span class="attr">separator</span>=<span class="string">","</span> <span class="attr">open</span>=<span class="string">"("</span> <span class="attr">close</span>=<span class="string">")"</span>></span></span><br><span class="line"> #{attr}</span><br><span class="line"> <span class="tag"></<span class="name">foreach</span>></span></span><br><span class="line"> and `search_type`=1</span><br><span class="line"><span class="tag"></<span class="name">select</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><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<SkuHasStockVo> <span class="title function_">getSkusHasStock</span><span class="params">(List<Long> skuIds)</span> {</span><br><span class="line"> List<SkuHasStockVo> skuHasStockVos = skuIds.stream().map(skuId -> {</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>){</span><br><span class="line"> skuHasStockVo.setHasStock(count > <span class="number">0</span>);</span><br><span class="line"> }<span class="keyword">else</span> {</span><br><span class="line"> skuHasStockVo.setHasStock(<span class="literal">false</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> skuHasStockVo;</span><br><span class="line"> }).collect(Collectors.toList());</span><br><span class="line"> <span class="keyword">return</span> skuHasStockVos;</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><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<SkuEsModel> skuEsModels)</span> <span class="keyword">throws</span> IOException {</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) {</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"> }</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<String> ids = Arrays.stream(bulk.getItems()).map(item -> {</span><br><span class="line"> <span class="keyword">return</span> item.getId();</span><br><span class="line"> }).collect(Collectors.toList());</span><br><span class="line"> log.info(<span class="string">"上架商品的id:{}"</span>,ids);</span><br><span class="line"> <span class="keyword">return</span> !hasFailure;</span><br><span class="line"> }</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="code"><pre><span class="line"><span class="comment"><!-- thymeleaf--></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-thymeleaf<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></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="code"><pre><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">xmlns:th</span>=<span class="string">"http://www.thymeleaf.org"</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>修改页面的时候需要频繁的重启项目,使用热更新来解决该问题</p>
|
||
<p>导入devtools的依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!--devtools--></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-devtools<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">optional</span>></span>true<span class="tag"></<span class="name">optional</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></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="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({"/","index.html"})</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">indexPage</span><span class="params">(Model model)</span>{</span><br><span class="line"> <span class="comment">//查询所有的一级分类</span></span><br><span class="line"> List<CategoryEntity> categorys = categoryService.getLevelOneCategorys();</span><br><span class="line"> model.addAttribute(<span class="string">"categorys"</span>,categorys);</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"index"</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>用于用户端首页面三级分类封装的数据</p>
|
||
<figure class="highlight java"><table><tr><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://qingling.icu</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> {</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<Category3Vo> 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> {</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"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>前端相关的修改</p>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"> <span class="tag"><<span class="name">li</span> <span class="attr">th:each</span>=<span class="string">" category:${categorys}"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">a</span> <span class="attr">href</span>=<span class="string">"#"</span> <span class="attr">class</span>=<span class="string">"header_main_left_a"</span> <span class="attr">ctg-data</span>=<span class="string">"3"</span> <span class="attr">th:attr</span>=<span class="string">"ctg-data=${category.catId}"</span>></span><span class="tag"><<span class="name">b</span> <span class="attr">th:text</span>=<span class="string">"${category.name}"</span>></span><span class="tag"></<span class="name">b</span>></span><span class="tag"></<span class="name">a</span>></span></span><br><span class="line"><span class="tag"></<span class="name">li</span>></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="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("/index/catalog.json")</span></span><br><span class="line"> <span class="keyword">public</span> Map<String, List<Catelog2Vo>> <span class="title function_">getCatalogJson</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> categoryService.getCatalogJson();</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>service层代码</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> Map<String, List<Catelog2Vo>> <span class="title function_">getCatalogJson</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//查出所有的一级分类</span></span><br><span class="line"> List<CategoryEntity> levelOneCategorys = getLevelOneCategorys();</span><br><span class="line"> <span class="comment">//封装数据</span></span><br><span class="line"> Map<String, List<Catelog2Vo>> catelog2VoMap = levelOneCategorys.stream().collect(Collectors.toMap(k -> k.getCatId().toString(), v -> {</span><br><span class="line"> <span class="comment">//查询以及分类下的二级分类</span></span><br><span class="line"> List<CategoryEntity> categoryEntities = categoryDao.selectList(<span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><CategoryEntity>().eq(CategoryEntity::getParentCid, v.getCatId()));</span><br><span class="line"> List<Catelog2Vo> catelog2Vos = <span class="literal">null</span>;</span><br><span class="line"> <span class="keyword">if</span> (categoryEntities != <span class="literal">null</span>) {</span><br><span class="line"> catelog2Vos = categoryEntities.stream().map(item -> {</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<CategoryEntity> levelThreeCatelog = categoryDao.selectList(<span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><CategoryEntity>().eq(CategoryEntity::getParentCid, item.getCatId()));</span><br><span class="line"> <span class="keyword">if</span>(levelThreeCatelog != <span class="literal">null</span>){</span><br><span class="line"> <span class="comment">//封装成指定的数据</span></span><br><span class="line"> List<Catelog2Vo.Category3Vo> category3VoList = levelThreeCatelog.stream().map(threeCatelog -> {</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"> }).collect(Collectors.toList());</span><br><span class="line"> catelog2Vo.setCatalog3List(category3VoList);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> catelog2Vo;</span><br><span class="line"> }).collect(Collectors.toList());</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> catelog2Vos;</span><br><span class="line"> }));</span><br><span class="line"> <span class="keyword">return</span> catelog2VoMap;</span><br><span class="line"> }</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="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="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="code"><pre><span class="line">server {</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 / {</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"> }</span><br><span class="line"> error_page 500 502 503 504 /50x.html;</span><br><span class="line"> location = /50x.html {</span><br><span class="line"> root /usr/share/nginx/html;</span><br><span class="line"> }</span><br><span class="line">}</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="code"><pre><span class="line">#配置上游服务器</span><br><span class="line"> #gulimall是上游服务器的组名</span><br><span class="line"> upstream gulimall{</span><br><span class="line"> #网关的地址</span><br><span class="line"> server 192.168.0.112:88;</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>修改gulimall.conf中的配置</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">server {</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 / {</span><br><span class="line"> proxy_pass http://gulimall;</span><br><span class="line"> }</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 {</span><br><span class="line"> root /usr/share/nginx/html;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>在网关的配置文件中加上一下的配置</p>
|
||
<figure class="highlight yaml"><table><tr><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="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://qingling.icu/posts/1416.html">压力测试与性能监控 | The Blog (qingling.icu)</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="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://qingling.icu/posts/13813.html">SpringBoot整合Redis | The Blog (qingling.icu)</a></strong></p>
|
||
<p>2.1 引入依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-data-redis<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.2 添加配置</p>
|
||
<figure class="highlight yaml"><table><tr><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="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>{</span><br><span class="line"> ValueOperations<String, String> ops = stringRedisTemplate.opsForValue();</span><br><span class="line"> ops.set(<span class="string">"hello"</span>,<span class="string">"word_"</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">"hello"</span>);</span><br><span class="line"> System.out.println(hello);</span><br><span class="line">}</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="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-data-redis<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">exclusions</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">exclusion</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>io.lettuce<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>lettuce-core<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">exclusion</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">exclusions</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>redis.clients<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>jedis<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></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 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="code"><pre><span class="line"><span class="comment"><!--redisson--></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.redisson<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>redisson<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>3.12.0<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>2.配置redisson</strong></p>
|
||
<figure class="highlight java"><table><tr><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://qingling.icu</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> {</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 = "shutdown")</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 {</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">"redis://192.168.195.100:6379"</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"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>3.测试使用</strong></p>
|
||
<figure class="highlight java"><table><tr><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>{</span><br><span class="line"> System.out.println(redissonClient);</span><br><span class="line">}</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="code"><pre><span class="line"><span class="meta">@ResponseBody</span></span><br><span class="line"><span class="meta">@GetMapping("/hello")</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">hello</span><span class="params">()</span> {</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">"yyyy-MM-dd HH:mm:ss"</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">"my-lock"</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">"现在时间:"</span> + sdf.format(date));</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">//执行业务</span></span><br><span class="line"> System.out.println(<span class="string">"加锁成功,执行业务,线程Id:"</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"> } <span class="keyword">catch</span> (InterruptedException e) {</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"> } <span class="keyword">finally</span> {</span><br><span class="line"> <span class="comment">//解锁</span></span><br><span class="line"> System.out.println(<span class="string">"释放锁,线程Id:"</span>+Thread.currentThread().getId());</span><br><span class="line"> lock.unlock();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"hello"</span>;</span><br><span class="line">}</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="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("/write")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">writeValue</span><span class="params">()</span>{</span><br><span class="line"> <span class="type">RReadWriteLock</span> <span class="variable">lock</span> <span class="operator">=</span> redissonClient.getReadWriteLock(<span class="string">"rw-lock"</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">s</span> <span class="operator">=</span> <span class="string">""</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> {</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">"writeValue"</span>,s);</span><br><span class="line"> } <span class="keyword">catch</span> (InterruptedException e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }<span class="keyword">finally</span> {</span><br><span class="line"> rLock.unlock();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> s;</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">@GetMapping("/read")</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>{</span><br><span class="line"> <span class="type">RReadWriteLock</span> <span class="variable">lock</span> <span class="operator">=</span> redissonClient.getReadWriteLock(<span class="string">"rw-lock"</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">s</span> <span class="operator">=</span> <span class="string">""</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> {</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">"writeValue"</span>);</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }<span class="keyword">finally</span> {</span><br><span class="line"> rLock.unlock();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> s;</span><br><span class="line"> }</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 接口来统一不同的缓存技术;并支持使用 JCache(JSR-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://qingling.icu/posts/13813.html">SpringBoot整合Redis | The Blog (qingling.icu)</a></strong></p>
|
||
<p><strong>3.项目中整合SpringCache简化开发</strong></p>
|
||
<p><strong>3.1.引入依赖</strong></p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!--我们使redis作为缓存的使用场景,在前面我们还要引入redis的依赖--></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-cache<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>3.2.编写配置文件</strong></p>
|
||
<figure class="highlight properties"><table><tr><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="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="code"><pre><span class="line"><span class="comment">//每一个需要缓存的数据需要我们指定放到那个名字的缓存[缓存的分区(按照业务类型分)]</span></span><br><span class="line"><span class="meta">@Cacheable({"category"})</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<CategoryEntity> <span class="title function_">getLevelOneCategorys</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> categoryDao.selectList(<span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><CategoryEntity>().eq(CategoryEntity::getParentCid, <span class="number">0</span>));</span><br><span class="line">}</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="code"><pre><span class="line"><span class="meta">@Cacheable(value = {"category"},key = "'levelOneCategorys'")</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="code"><pre><span class="line"><span class="meta">@Cacheable(value = {"category"},key = "#root.method.name")</span> <span class="comment">//使用方法名作为key值</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>设置缓存数据的存活时间</p>
|
||
<figure class="highlight properties"><table><tr><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="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://qingling.icu</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> {</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> {</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>) {</span><br><span class="line"> config = config.entryTtl(redisProperties.getTimeToLive());</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (redisProperties.getKeyPrefix() != <span class="literal">null</span>) {</span><br><span class="line"> config = config.prefixCacheNameWith(redisProperties.getKeyPrefix());</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (!redisProperties.isCacheNullValues()) {</span><br><span class="line"> config = config.disableCachingNullValues();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (!redisProperties.isUseKeyPrefix()) {</span><br><span class="line"> config = config.disableKeyPrefix();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> config;</span><br><span class="line"> }</span><br><span class="line">}</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="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="code"><pre><span class="line">server {</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 / {</span><br><span class="line"> proxy_set_header Host $host;</span><br><span class="line"> proxy_pass http://gulimall;</span><br><span class="line"> }</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 {</span><br><span class="line"> root /usr/share/nginx/html;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>网关中配置断言</p>
|
||
<figure class="highlight yaml"><table><tr><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="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://qingling.icu</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> {</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<Long> 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<String> 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">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>检索的结果</p>
|
||
<figure class="highlight java"><table><tr><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://qingling.icu</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> {</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<SkuEsModel> 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<Integer> 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<BrandVo> 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<AttrVo> 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<CatalogVo> catalogs;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> List<NavVo> 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> {</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"> }</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> {</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"> }</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> {</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<String> attrValue;</span><br><span class="line"> }</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> {</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"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>未完待续(学习到177)……</strong></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>项目实战</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>力扣(LeetCode)算法刷题</title>
|
||
<url>/posts/13579.html</url>
|
||
<content><![CDATA[<p><strong>刷题网站:</strong> <a href="https://leetcode.cn/problemset/all/">力扣</a> <strong>视频:</strong> <a href="https://www.acwing.com/activity/">AcWing</a></p>
|
||
<h2 id="一-数组"><a href="#一-数组" class="headerlink" title="一.数组"></a>一.数组</h2><h3 id="A-简单"><a href="#A-简单" class="headerlink" title="A.简单"></a>A.简单</h3><h4 id="1-两数之和"><a href="#1-两数之和" class="headerlink" title="1.两数之和"></a>1.两数之和</h4><p>给定一个整数数组 <code>nums</code> 和一个整数目标值 <code>target</code>,请你在该数组中找出 <strong>和为目标值</strong> <em><code>target</code></em> 的那 <strong>两个</strong> 整数,并返回它们的数组下标。你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。你可以按任意顺序返回答案。</p>
|
||
<p><strong>示例 1:</strong></p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">输入:nums = [2,7,11,15], target = 9</span><br><span class="line">输出:[0,1]</span><br><span class="line">解释:因为 nums[0] + nums[1] == 9 ,返回 [0, 1] 。</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">输入:nums = [3,2,4], target = 6</span><br><span class="line">输出:[1,2]</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>示例 3:</strong></p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">输入:nums = [3,3], target = 6</span><br><span class="line">输出:[0,1]</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
<ul>
|
||
<li><code>2 <= nums.length <= 104</code></li>
|
||
<li><code>-109 <= nums[i] <= 109</code></li>
|
||
<li><code>-109 <= target <= 109</code></li>
|
||
<li><strong>只会存在一个有效答案</strong></li>
|
||
</ul>
|
||
<p><strong>代码实现</strong></p>
|
||
<p>自己的代码 暴力枚举</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">class</span> <span class="title class_">Solution</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="type">int</span>[] twoSum(<span class="type">int</span>[] nums, <span class="type">int</span> target) {</span><br><span class="line"> <span class="type">int</span>[] result = <span class="keyword">new</span> <span class="title class_">int</span>[<span class="number">2</span>];</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < nums.length; i++) {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">j</span> <span class="operator">=</span> <span class="number">0</span>; j < nums.length; j++) {</span><br><span class="line"> <span class="keyword">if</span> (nums[i] + nums[j] == target && i != j) {</span><br><span class="line"> result[<span class="number">0</span>] = i;</span><br><span class="line"> result[<span class="number">1</span>] = j;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> result;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="2-删除有序数组中的重复项"><a href="#2-删除有序数组中的重复项" class="headerlink" title="2.删除有序数组中的重复项"></a>2.删除有序数组中的重复项</h4><p>给你一个 <strong>升序排列</strong> 的数组 <code>nums</code> ,请你**<a href="http://baike.baidu.com/item/%E5%8E%9F%E5%9C%B0%E7%AE%97%E6%B3%95"> 原地</a>** 删除重复出现的元素,使每个元素 <strong>只出现一次</strong> ,返回删除后数组的新长度。元素的 <strong>相对顺序</strong> 应该保持 <strong>一致</strong> 。然后返回 <code>nums</code> 中唯一元素的个数。</p>
|
||
<p>考虑 <code>nums</code> 的唯一元素的数量为 <code>k</code> ,你需要做以下事情确保你的题解可以被通过:</p>
|
||
<ul>
|
||
<li>更改数组 <code>nums</code> ,使 <code>nums</code> 的前 <code>k</code> 个元素包含唯一元素,并按照它们最初在 <code>nums</code> 中出现的顺序排列。<code>nums</code> 的其余元素与 <code>nums</code> 的大小不重要。</li>
|
||
<li>返回 <code>k</code> 。</li>
|
||
</ul>
|
||
<p><strong>判题标准:</strong></p>
|
||
<p>系统会用下面的代码来测试你的题解:</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">int[] nums = [...]; // 输入数组</span><br><span class="line">int[] expectedNums = [...]; // 长度正确的期望答案</span><br><span class="line"></span><br><span class="line">int k = removeDuplicates(nums); // 调用</span><br><span class="line"></span><br><span class="line">assert k == expectedNums.length;</span><br><span class="line">for (int i = 0; i < k; i++) {</span><br><span class="line"> assert nums[i] == expectedNums[i];</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>如果所有断言都通过,那么您的题解将被 <strong>通过</strong>。</p>
|
||
<p><strong>示例 1:</strong></p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">输入:nums = [1,1,2]</span><br><span class="line">输出:2, nums = [1,2,_]</span><br><span class="line">解释:函数应该返回新的长度 2 ,并且原数组 nums 的前两个元素被修改为 1, 2 。不需要考虑数组中超出新长度后面的元素。</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">输入:nums = [0,0,1,1,1,2,2,3,3,4]</span><br><span class="line">输出:5, nums = [0,1,2,3,4]</span><br><span class="line">解释:函数应该返回新的长度 5 , 并且原数组 nums 的前五个元素被修改为 0, 1, 2, 3, 4 。不需要考虑数组中超出新长度后面的元素。</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
<ul>
|
||
<li><code>1 <= nums.length <= 3 * 104</code></li>
|
||
<li><code>-104 <= nums[i] <= 104</code></li>
|
||
<li><code>nums</code> 已按 <strong>升序</strong> 排列</li>
|
||
</ul>
|
||
<p><strong>代码实现</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.leetcode.array;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Arrays;</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/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="keyword">public</span> <span class="keyword">class</span> <span class="title class_">RemoveDuplicates</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">RemoveDuplicates</span> <span class="variable">removeDuplicates</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">RemoveDuplicates</span>();</span><br><span class="line"> <span class="type">int</span>[] arr = {<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>,<span class="number">1</span>,<span class="number">1</span>,<span class="number">2</span>,<span class="number">2</span>,<span class="number">3</span>,<span class="number">3</span>,<span class="number">4</span>};</span><br><span class="line"> System.out.println(removeDuplicates.removeDuplicates(arr));</span><br><span class="line"></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">public</span> <span class="type">int</span> <span class="title function_">removeDuplicates</span><span class="params">(<span class="type">int</span>[] nums)</span> {</span><br><span class="line"> <span class="type">int</span> <span class="variable">n</span> <span class="operator">=</span> nums.length;<span class="comment">//获取数组长度</span></span><br><span class="line"> <span class="keyword">if</span> (n == <span class="number">0</span>) { <span class="comment">//数组的长度是零就直接的退出</span></span><br><span class="line"> <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="type">int</span> <span class="variable">fast</span> <span class="operator">=</span> <span class="number">1</span>, slow = <span class="number">1</span>; <span class="comment">//定义两个快慢指针</span></span><br><span class="line"> <span class="keyword">while</span> (fast < n) {</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">if</span> (nums[fast] != nums[fast - <span class="number">1</span>]) {</span><br><span class="line"> nums[slow] = nums[fast];</span><br><span class="line"> ++slow;</span><br><span class="line"> }</span><br><span class="line"> ++fast;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> slow;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-移除元素"><a href="#3-移除元素" class="headerlink" title="3.移除元素"></a>3.移除元素</h4><p>给你一个数组 <code>nums</code> 和一个值 <code>val</code>,你需要 <strong><a href="https://baike.baidu.com/item/%E5%8E%9F%E5%9C%B0%E7%AE%97%E6%B3%95">原地</a></strong> 移除所有数值等于 <code>val</code> 的元素,并返回移除后数组的新长度。</p>
|
||
<p>不要使用额外的数组空间,你必须仅使用 <code>O(1)</code> 额外空间并 <strong><a href="https://baike.baidu.com/item/%E5%8E%9F%E5%9C%B0%E7%AE%97%E6%B3%95">原地 </a>修改输入数组</strong>。</p>
|
||
<p>元素的顺序可以改变。你不需要考虑数组中超出新长度后面的元素。</p>
|
||
<p><strong>说明:</strong></p>
|
||
<p>为什么返回数值是整数,但输出的答案是数组呢?</p>
|
||
<p>请注意,输入数组是以<strong>「引用」</strong>方式传递的,这意味着在函数里修改输入数组对于调用者是可见的。</p>
|
||
<p>你可以想象内部操作如下:</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">// nums 是以“引用”方式传递的。也就是说,不对实参作任何拷贝</span><br><span class="line">int len = removeElement(nums, val);</span><br><span class="line"></span><br><span class="line">// 在函数里修改输入数组对于调用者是可见的。</span><br><span class="line">// 根据你的函数返回的长度, 它会打印出数组中 该长度范围内 的所有元素。</span><br><span class="line">for (int i = 0; i < len; i++) {</span><br><span class="line"> print(nums[i]);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">输入:nums = [3,2,2,3], val = 3</span><br><span class="line">输出:2, nums = [2,2]</span><br><span class="line">解释:函数应该返回新的长度 2, 并且 nums 中的前两个元素均为 2。你不需要考虑数组中超出新长度后面的元素。例如,函数返回的新长度为 2 ,而 nums = [2,2,3,3] 或 nums = [2,2,0,0],也会被视作正确答案。</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">输入:nums = [0,1,2,2,3,0,4,2], val = 2</span><br><span class="line">输出:5, nums = [0,1,4,0,3]</span><br><span class="line">解释:函数应该返回新的长度 5, 并且 nums 中的前五个元素为 0, 1, 3, 0, 4。注意这五个元素可为任意顺序。你不需要考虑数组中超出新长度后面的元素。</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
<ul>
|
||
<li><code>0 <= nums.length <= 100</code></li>
|
||
<li><code>0 <= nums[i] <= 50</code></li>
|
||
<li><code>0 <= val <= 100</code></li>
|
||
</ul>
|
||
<p><strong>代码实现</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>数据结构与算法</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>Linux设置静态IP</title>
|
||
<url>/posts/21883.html</url>
|
||
<content><![CDATA[<h2 id="1-查看IP的状态"><a href="#1-查看IP的状态" class="headerlink" title="1.查看IP的状态"></a>1.查看IP的状态</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看是否为静态ip</span></span><br><span class="line">ip addr</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>如图所示的是动态IP,我们要配置静态IP</p>
|
||
<p><img src="/pictures/image-20230511230406172.png" alt="image-20230511230406172"></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>1.修改配置文件中的配置</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">进入配置文件的命令</span></span><br><span class="line">vim /etc/sysconfig/network-scripts/ifcfg-ens33</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230511233324998.png" alt="image-20230511233324998"></p>
|
||
<p>2.重启网络</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">重启网络的配置</span></span><br><span class="line">systemctl restart network</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看设置的IP情况</span></span><br><span class="line">ifconfig</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230511233838595.png" alt="image-20230511233838595"></p>
|
||
<p>在主机上使用ping命令ping 刚才的设置的静态IP也可以ping通</p>
|
||
<p><img src="/pictures/image-20230511234154523.png" alt="image-20230511234154523"></p>
|
||
<p>虚拟机ping外部也可以ping通</p>
|
||
<p><img src="/pictures/image-20230511235621228.png" alt="image-20230511235621228"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>Linux</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>VMWare虚拟机安装Linux教程</title>
|
||
<url>/posts/47407.html</url>
|
||
<content><![CDATA[<h2 id="1-下载CentOs镜像文件"><a href="#1-下载CentOs镜像文件" class="headerlink" title="1.下载CentOs镜像文件"></a>1.下载CentOs镜像文件</h2><p>这里下载的是7版本的 如果有其他的需要 自行安装其他的版本</p>
|
||
<p>下载完成之后 记录好安装的位置</p>
|
||
<p>阿里镜像下载地址:<a href="https://mirrors.aliyun.com/centos/7/isos/x86_64/?spm=a2c6h.25603864.0.0.4eab4511uQRsgc">https://mirrors.aliyun.com/centos/7/isos/x86_64/?spm=a2c6h.25603864.0.0.4eab4511uQRsgc</a></p>
|
||
<p><img src="/pictures/image-20230510224239950.png" alt="image-20230510224239950"></p>
|
||
<h2 id="2-下载VMWare-虚拟机"><a href="#2-下载VMWare-虚拟机" class="headerlink" title="2.下载VMWare 虚拟机"></a>2.下载VMWare 虚拟机</h2><p>这里下载的是17版本的VMWare ,可以免费试用30天,需要许可证的可自行百度搜索</p>
|
||
<p>官网下载地址: <a href="https://download3.vmware.com/software/WKST-1701-WIN/VMware-workstation-full-17.0.1-21139696.exe">https://download3.vmware.com/software/WKST-1701-WIN/VMware-workstation-full-17.0.1-21139696.exe</a></p>
|
||
<p>安装步骤:</p>
|
||
<p><img src="/pictures/image-20230510222210848.png" alt="image-20230510222210848"></p>
|
||
<h2 id="3-配置虚拟机-以CentOs为例"><a href="#3-配置虚拟机-以CentOs为例" class="headerlink" title="3.配置虚拟机 (以CentOs为例)"></a>3.配置虚拟机 (以CentOs为例)</h2><p>CentOs的不同版本在VmWare上面的配置略有不同</p>
|
||
<h4 id="CentOs-7-6版本的配置教程"><a href="#CentOs-7-6版本的配置教程" class="headerlink" title="CentOs 7.6版本的配置教程"></a>CentOs 7.6版本的配置教程</h4>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/韩顺平教育安装CentOS7.6.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<h4 id="CentOs-8-1版本的配置教程"><a href="#CentOs-8-1版本的配置教程" class="headerlink" title="CentOs 8.1版本的配置教程"></a>CentOs 8.1版本的配置教程</h4>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/韩顺平教育安装CentOS8.1.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h2 id="连接Linux-的远程工具"><a href="#连接Linux-的远程工具" class="headerlink" title="连接Linux 的远程工具"></a>连接Linux 的远程工具</h2><p><strong>其实本地安装Linux大可不必安装远程控制工具 直接进入Linux里面控制即可</strong></p>
|
||
<p><img src="/pictures/image-20230510225825430.png" alt="image-20230510225825430"></p>
|
||
<h3 id="XShell6的安装和配置"><a href="#XShell6的安装和配置" class="headerlink" title="XShell6的安装和配置"></a>XShell6的安装和配置</h3><h4 id="1-安装"><a href="#1-安装" class="headerlink" title="1.安装"></a>1.安装</h4><p>下载地址: <a href="https://wwvc.lanzouy.com/ipF2w0v6np8j">https://wwvc.lanzouy.com/ipF2w0v6np8j</a></p>
|
||
<p>下载解压之后双击.exe文件 点击下一步安装 直到安装完成</p>
|
||
<h4 id="2-配置"><a href="#2-配置" class="headerlink" title="2.配置"></a>2.配置</h4><p>1.获取Linux的ip地址信息 并记录ip的信息 </p>
|
||
<figure class="highlight shell"><table><tr><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">注意这里没有写错 就是ifconfig 不是ipconfig,ipconfig是windows系统的查看ip的命令</span></span><br><span class="line">ifconfig</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230510230114550.png" alt="image-20230510230114550"></p>
|
||
<p>2.打开xShell工具</p>
|
||
<p>2.1创建会话</p>
|
||
<p><img src="/pictures/image-20230510230758405.png" alt="image-20230510230758405"></p>
|
||
<p>2.2 选择会话并连接</p>
|
||
<p><img src="/pictures/image-20230510230937843.png" alt="image-20230510230937843"></p>
|
||
<p><img src="/pictures/image-20230510231329208.png" alt="image-20230510231329208"></p>
|
||
<p><img src="/pictures/image-20230510231432103.png" alt="image-20230510231432103"></p>
|
||
<p>2.3 用户名和密码正确之后就连接成功</p>
|
||
<p>连接成功如下图</p>
|
||
<p><img src="/pictures/image-20230510231607314.png" alt="image-20230510231607314"></p>
|
||
<p><strong>完整的配置过程</strong></p>
|
||
<p><img src="/pictures/image-20230510232029231.png" alt="image-20230510232029231"></p>
|
||
<h3 id="FinalShell的下载地址"><a href="#FinalShell的下载地址" class="headerlink" title="FinalShell的下载地址"></a>FinalShell的下载地址</h3><p>下载地址: <a href="http://www.hostbuf.com/downloads/finalshell_install.exe">http://www.hostbuf.com/downloads/finalshell_install.exe</a></p>
|
||
<p>Tips:</p>
|
||
<p> 这里我们没有设置Linux的静态IP,电脑每次网络变化之后,IP地址会发生变化,这时我们需要获取最新的IP地址,重新执行以上的连接步骤。如果想要IP地址固定,我们可以设置静态IP,设置静态的IP的方法如下:</p>
|
||
<p><strong><a href="https://qingling.icu/posts/21883.html">Linux设置静态IP | The Blog (qingling.icu)</a></strong></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>VMWare</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>Maven配置文件settings.xml</title>
|
||
<url>/posts/26768.html</url>
|
||
<content><![CDATA[<p><strong>用途</strong>:更换IDEA中Maven配置文件实现不下载配置maven的阿里云镜像 </p>
|
||
<h2 id="设置本地仓库磁盘存储位置"><a href="#设置本地仓库磁盘存储位置" class="headerlink" title="设置本地仓库磁盘存储位置"></a>设置本地仓库磁盘存储位置</h2><p>1.在C盘的根目录下创建如下的文件夹C:\maven\maven-repository</p>
|
||
<p>2.任选下面的两个配置文件中的一个放在C:\maven目录下 配置文件的名字为 <strong>settings.xml</strong></p>
|
||
<p>3.在IDEA中配置本地仓库的位置和配置文件的位置</p>
|
||
<h2 id="配置文件"><a href="#配置文件" class="headerlink" title="配置文件"></a>配置文件</h2><h3 id="apache-maven-3-6-3"><a href="#apache-maven-3-6-3" class="headerlink" title="apache-maven-3.6.3"></a>apache-maven-3.6.3</h3><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="meta"><?xml version=<span class="string">"1.0"</span> encoding=<span class="string">"UTF-8"</span>?></span></span><br><span class="line"></span><br><span class="line"><span class="comment"><!--</span></span><br><span class="line"><span class="comment">Licensed to the Apache Software Foundation (ASF) under one</span></span><br><span class="line"><span class="comment">or more contributor license agreements. See the NOTICE file</span></span><br><span class="line"><span class="comment">distributed with this work for additional information</span></span><br><span class="line"><span class="comment">regarding copyright ownership. The ASF licenses this file</span></span><br><span class="line"><span class="comment">to you under the Apache License, Version 2.0 (the</span></span><br><span class="line"><span class="comment">"License"); you may not use this file except in compliance</span></span><br><span class="line"><span class="comment">with the License. You may obtain a copy of the License at</span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment">Unless required by applicable law or agreed to in writing,</span></span><br><span class="line"><span class="comment">software distributed under the License is distributed on an</span></span><br><span class="line"><span class="comment">"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY</span></span><br><span class="line"><span class="comment">KIND, either express or implied. See the License for the</span></span><br><span class="line"><span class="comment">specific language governing permissions and limitations</span></span><br><span class="line"><span class="comment">under the License.</span></span><br><span class="line"><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="comment"> | This is the configuration file for Maven. It can be specified at two levels:</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | 1. User Level. This settings.xml file provides configuration for a single user,</span></span><br><span class="line"><span class="comment"> | and is normally provided in ${user.home}/.m2/settings.xml.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | <span class="doctag">NOTE:</span> This location can be overridden with the CLI option:</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | -s /path/to/user/settings.xml</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | 2. Global Level. This settings.xml file provides configuration for all Maven</span></span><br><span class="line"><span class="comment"> | users on a machine (assuming they're all using the same Maven</span></span><br><span class="line"><span class="comment"> | installation). It's normally provided in</span></span><br><span class="line"><span class="comment"> | ${maven.conf}/settings.xml.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | <span class="doctag">NOTE:</span> This location can be overridden with the CLI option:</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | -gs /path/to/global/settings.xml</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | The sections in this sample file are intended to give you a running start at</span></span><br><span class="line"><span class="comment"> | getting the most out of your Maven installation. Where appropriate, the default</span></span><br><span class="line"><span class="comment"> | values (values used when the setting is not specified) are provided.</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="tag"><<span class="name">settings</span> <span class="attr">xmlns</span>=<span class="string">"http://maven.apache.org/SETTINGS/1.0.0"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">xmlns:xsi</span>=<span class="string">"http://www.w3.org/2001/XMLSchema-instance"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">xsi:schemaLocation</span>=<span class="string">"http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"</span>></span></span><br><span class="line"> <span class="comment"><!-- localRepository</span></span><br><span class="line"><span class="comment"> | The path to the local repository maven will use to store artifacts.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | Default: ${user.home}/.m2/repository</span></span><br><span class="line"><span class="comment"> <localRepository>/path/to/local/repo</localRepository></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"><span class="tag"><<span class="name">localRepository</span>></span>C:\maven\maven-repository<span class="tag"></<span class="name">localRepository</span>></span></span><br><span class="line"> <span class="comment"><!-- interactiveMode</span></span><br><span class="line"><span class="comment"> | This will determine whether maven prompts you when it needs input. If set to false,</span></span><br><span class="line"><span class="comment"> | maven will use a sensible default value, perhaps based on some other setting, for</span></span><br><span class="line"><span class="comment"> | the parameter in question.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | Default: true</span></span><br><span class="line"><span class="comment"> <interactiveMode>true</interactiveMode></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- offline</span></span><br><span class="line"><span class="comment"> | Determines whether maven should attempt to connect to the network when executing a build.</span></span><br><span class="line"><span class="comment"> | This will have an effect on artifact downloads, artifact deployment, and others.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | Default: false</span></span><br><span class="line"><span class="comment"> <offline>false</offline></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- pluginGroups</span></span><br><span class="line"><span class="comment"> | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.</span></span><br><span class="line"><span class="comment"> | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers</span></span><br><span class="line"><span class="comment"> | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.</span></span><br><span class="line"><span class="comment"> |--></span></span><br><span class="line"> <span class="tag"><<span class="name">pluginGroups</span>></span></span><br><span class="line"> <span class="comment"><!-- pluginGroup</span></span><br><span class="line"><span class="comment"> | Specifies a further group identifier to use for plugin lookup.</span></span><br><span class="line"><span class="comment"> <pluginGroup>com.your.plugins</pluginGroup></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"> <span class="tag"></<span class="name">pluginGroups</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- proxies</span></span><br><span class="line"><span class="comment"> | This is a list of proxies which can be used on this machine to connect to the network.</span></span><br><span class="line"><span class="comment"> | Unless otherwise specified (by system property or command-line switch), the first proxy</span></span><br><span class="line"><span class="comment"> | specification in this list marked as active will be used.</span></span><br><span class="line"><span class="comment"> |--></span></span><br><span class="line"> <span class="tag"><<span class="name">proxies</span>></span></span><br><span class="line"> <span class="comment"><!-- proxy</span></span><br><span class="line"><span class="comment"> | Specification for one proxy, to be used in connecting to the network.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> <proxy></span></span><br><span class="line"><span class="comment"> <id>optional</id></span></span><br><span class="line"><span class="comment"> <active>true</active></span></span><br><span class="line"><span class="comment"> <protocol>http</protocol></span></span><br><span class="line"><span class="comment"> <username>proxyuser</username></span></span><br><span class="line"><span class="comment"> <password>proxypass</password></span></span><br><span class="line"><span class="comment"> <host>proxy.host.net</host></span></span><br><span class="line"><span class="comment"> <port>80</port></span></span><br><span class="line"><span class="comment"> <nonProxyHosts>local.net|some.host.com</nonProxyHosts></span></span><br><span class="line"><span class="comment"> </proxy></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"> <span class="tag"></<span class="name">proxies</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- servers</span></span><br><span class="line"><span class="comment"> | This is a list of authentication profiles, keyed by the server-id used within the system.</span></span><br><span class="line"><span class="comment"> | Authentication profiles can be used whenever maven must make a connection to a remote server.</span></span><br><span class="line"><span class="comment"> |--></span></span><br><span class="line"> <span class="tag"><<span class="name">servers</span>></span></span><br><span class="line"> <span class="comment"><!-- server</span></span><br><span class="line"><span class="comment"> | Specifies the authentication information to use when connecting to a particular server, identified by</span></span><br><span class="line"><span class="comment"> | a unique name within the system (referred to by the 'id' attribute below).</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | <span class="doctag">NOTE:</span> You should either specify username/password OR privateKey/passphrase, since these pairings are</span></span><br><span class="line"><span class="comment"> | used together.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> <server></span></span><br><span class="line"><span class="comment"> <id>deploymentRepo</id></span></span><br><span class="line"><span class="comment"> <username>repouser</username></span></span><br><span class="line"><span class="comment"> <password>repopwd</password></span></span><br><span class="line"><span class="comment"> </server></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- Another sample, using keys to authenticate.</span></span><br><span class="line"><span class="comment"> <server></span></span><br><span class="line"><span class="comment"> <id>siteServer</id></span></span><br><span class="line"><span class="comment"> <privateKey>/path/to/private/key</privateKey></span></span><br><span class="line"><span class="comment"> <passphrase>optional; leave empty if not used.</passphrase></span></span><br><span class="line"><span class="comment"> </server></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"> <span class="tag"></<span class="name">servers</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- mirrors</span></span><br><span class="line"><span class="comment"> | This is a list of mirrors to be used in downloading artifacts from remote repositories.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | It works like this: a POM may declare a repository to use in resolving certain artifacts.</span></span><br><span class="line"><span class="comment"> | However, this repository may have problems with heavy traffic at times, so people have mirrored</span></span><br><span class="line"><span class="comment"> | it to several places.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | That repository definition will have a unique id, so we can create a mirror reference for that</span></span><br><span class="line"><span class="comment"> | repository, to be used as an alternate download site. The mirror site will be the preferred</span></span><br><span class="line"><span class="comment"> | server for that repository.</span></span><br><span class="line"><span class="comment"> |--></span></span><br><span class="line"> <span class="tag"><<span class="name">mirrors</span>></span></span><br><span class="line"> <span class="comment"><!-- mirror</span></span><br><span class="line"><span class="comment"> | Specifies a repository mirror site to use instead of a given repository. The repository that</span></span><br><span class="line"><span class="comment"> | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used</span></span><br><span class="line"><span class="comment"> | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> <mirror></span></span><br><span class="line"><span class="comment"> <id>mirrorId</id></span></span><br><span class="line"><span class="comment"> <mirrorOf>repositoryId</mirrorOf></span></span><br><span class="line"><span class="comment"> <name>Human Readable Name for this Mirror.</name></span></span><br><span class="line"><span class="comment"> <url>http://my.repository.com/repo/path</url></span></span><br><span class="line"><span class="comment"> </mirror></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="tag"><<span class="name">mirror</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">id</span>></span>alimaven<span class="tag"></<span class="name">id</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">mirrorOf</span>></span>central<span class="tag"></<span class="name">mirrorOf</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">name</span>></span>aliyun maven<span class="tag"></<span class="name">name</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">url</span>></span>http://maven.aliyun.com/nexus/content/repositories/central/<span class="tag"></<span class="name">url</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">mirror</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">mirrors</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- profiles</span></span><br><span class="line"><span class="comment"> | This is a list of profiles which can be activated in a variety of ways, and which can modify</span></span><br><span class="line"><span class="comment"> | the build process. Profiles provided in the settings.xml are intended to provide local machine-</span></span><br><span class="line"><span class="comment"> | specific paths and repository locations which allow the build to work in the local environment.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | For example, if you have an integration testing plugin - like cactus - that needs to know where</span></span><br><span class="line"><span class="comment"> | your Tomcat instance is installed, you can provide a variable here such that the variable is</span></span><br><span class="line"><span class="comment"> | dereferenced during the build process to configure the cactus plugin.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles</span></span><br><span class="line"><span class="comment"> | section of this document (settings.xml) - will be discussed later. Another way essentially</span></span><br><span class="line"><span class="comment"> | relies on the detection of a system property, either matching a particular value for the property,</span></span><br><span class="line"><span class="comment"> | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a</span></span><br><span class="line"><span class="comment"> | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.</span></span><br><span class="line"><span class="comment"> | Finally, the list of active profiles can be specified directly from the command line.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | <span class="doctag">NOTE:</span> For profiles defined in the settings.xml, you are restricted to specifying only artifact</span></span><br><span class="line"><span class="comment"> | repositories, plugin repositories, and free-form properties to be used as configuration</span></span><br><span class="line"><span class="comment"> | variables for plugins in the POM.</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="tag"><<span class="name">profiles</span>></span></span><br><span class="line"> <span class="comment"><!-- profile</span></span><br><span class="line"><span class="comment"> | Specifies a set of introductions to the build process, to be activated using one or more of the</span></span><br><span class="line"><span class="comment"> | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/></span></span><br><span class="line"><span class="comment"> | or the command line, profiles have to have an ID that is unique.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | An encouraged best practice for profile identification is to use a consistent naming convention</span></span><br><span class="line"><span class="comment"> | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.</span></span><br><span class="line"><span class="comment"> | This will make it more intuitive to understand what the set of introduced profiles is attempting</span></span><br><span class="line"><span class="comment"> | to accomplish, particularly when you only have a list of profile id's for debug.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.</span></span><br><span class="line"><span class="comment"> <profile></span></span><br><span class="line"><span class="comment"> <id>jdk-1.4</id></span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment"> <activation></span></span><br><span class="line"><span class="comment"> <jdk>1.4</jdk></span></span><br><span class="line"><span class="comment"> </activation></span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment"> <repositories></span></span><br><span class="line"><span class="comment"> <repository></span></span><br><span class="line"><span class="comment"> <id>jdk14</id></span></span><br><span class="line"><span class="comment"> <name>Repository for JDK 1.4 builds</name></span></span><br><span class="line"><span class="comment"> <url>http://www.myhost.com/maven/jdk14</url></span></span><br><span class="line"><span class="comment"> <layout>default</layout></span></span><br><span class="line"><span class="comment"> <snapshotPolicy>always</snapshotPolicy></span></span><br><span class="line"><span class="comment"> </repository></span></span><br><span class="line"><span class="comment"> </repositories></span></span><br><span class="line"><span class="comment"> </profile></span></span><br><span class="line"><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="comment"> | Here is another profile, activated by the system property 'target-env' with a value of 'dev',</span></span><br><span class="line"><span class="comment"> | which provides a specific path to the Tomcat instance. To use this, your plugin configuration</span></span><br><span class="line"><span class="comment"> | might hypothetically look like:</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"> | <plugin></span></span><br><span class="line"><span class="comment"> | <groupId>org.myco.myplugins</groupId></span></span><br><span class="line"><span class="comment"> | <artifactId>myplugin</artifactId></span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | <configuration></span></span><br><span class="line"><span class="comment"> | <tomcatLocation>${tomcatPath}</tomcatLocation></span></span><br><span class="line"><span class="comment"> | </configuration></span></span><br><span class="line"><span class="comment"> | </plugin></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">NOTE:</span> If you just wanted to inject this configuration whenever someone set 'target-env' to</span></span><br><span class="line"><span class="comment"> | anything, you could just leave off the <value/> inside the activation-property.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> <profile></span></span><br><span class="line"><span class="comment"> <id>env-dev</id></span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment"> <activation></span></span><br><span class="line"><span class="comment"> <property></span></span><br><span class="line"><span class="comment"> <name>target-env</name></span></span><br><span class="line"><span class="comment"> <value>dev</value></span></span><br><span class="line"><span class="comment"> </property></span></span><br><span class="line"><span class="comment"> </activation></span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment"> <properties></span></span><br><span class="line"><span class="comment"> <tomcatPath>/path/to/tomcat/instance</tomcatPath></span></span><br><span class="line"><span class="comment"> </properties></span></span><br><span class="line"><span class="comment"> </profile></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"> <span class="tag"></<span class="name">profiles</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- activeProfiles</span></span><br><span class="line"><span class="comment"> | List of profiles that are active for all builds.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> <activeProfiles></span></span><br><span class="line"><span class="comment"> <activeProfile>alwaysActiveProfile</activeProfile></span></span><br><span class="line"><span class="comment"> <activeProfile>anotherAlwaysActiveProfile</activeProfile></span></span><br><span class="line"><span class="comment"> </activeProfiles></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"><span class="tag"></<span class="name">settings</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="apache-maven-3-8-6"><a href="#apache-maven-3-8-6" class="headerlink" title="apache-maven-3.8.6"></a>apache-maven-3.8.6</h3><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="meta"><?xml version=<span class="string">"1.0"</span> encoding=<span class="string">"UTF-8"</span>?></span></span><br><span class="line"></span><br><span class="line"><span class="comment"><!--</span></span><br><span class="line"><span class="comment">Licensed to the Apache Software Foundation (ASF) under one</span></span><br><span class="line"><span class="comment">or more contributor license agreements. See the NOTICE file</span></span><br><span class="line"><span class="comment">distributed with this work for additional information</span></span><br><span class="line"><span class="comment">regarding copyright ownership. The ASF licenses this file</span></span><br><span class="line"><span class="comment">to you under the Apache License, Version 2.0 (the</span></span><br><span class="line"><span class="comment">"License"); you may not use this file except in compliance</span></span><br><span class="line"><span class="comment">with the License. You may obtain a copy of the License at</span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment">Unless required by applicable law or agreed to in writing,</span></span><br><span class="line"><span class="comment">software distributed under the License is distributed on an</span></span><br><span class="line"><span class="comment">"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY</span></span><br><span class="line"><span class="comment">KIND, either express or implied. See the License for the</span></span><br><span class="line"><span class="comment">specific language governing permissions and limitations</span></span><br><span class="line"><span class="comment">under the License.</span></span><br><span class="line"><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="comment"> | This is the configuration file for Maven. It can be specified at two levels:</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | 1. User Level. This settings.xml file provides configuration for a single user,</span></span><br><span class="line"><span class="comment"> | and is normally provided in ${user.home}/.m2/settings.xml.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | <span class="doctag">NOTE:</span> This location can be overridden with the CLI option:</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | -s /path/to/user/settings.xml</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | 2. Global Level. This settings.xml file provides configuration for all Maven</span></span><br><span class="line"><span class="comment"> | users on a machine (assuming they're all using the same Maven</span></span><br><span class="line"><span class="comment"> | installation). It's normally provided in</span></span><br><span class="line"><span class="comment"> | ${maven.conf}/settings.xml.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | <span class="doctag">NOTE:</span> This location can be overridden with the CLI option:</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | -gs /path/to/global/settings.xml</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | The sections in this sample file are intended to give you a running start at</span></span><br><span class="line"><span class="comment"> | getting the most out of your Maven installation. Where appropriate, the default</span></span><br><span class="line"><span class="comment"> | values (values used when the setting is not specified) are provided.</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="tag"><<span class="name">settings</span> <span class="attr">xmlns</span>=<span class="string">"http://maven.apache.org/SETTINGS/1.2.0"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">xmlns:xsi</span>=<span class="string">"http://www.w3.org/2001/XMLSchema-instance"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">xsi:schemaLocation</span>=<span class="string">"http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd"</span>></span></span><br><span class="line"> <span class="comment"><!-- localRepository</span></span><br><span class="line"><span class="comment"> | The path to the local repository maven will use to store artifacts.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | Default: ${user.home}/.m2/repository</span></span><br><span class="line"><span class="comment"> <localRepository>/path/to/local/repo</localRepository></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"> <span class="tag"><<span class="name">localRepository</span>></span>C:\maven\maven-repository<span class="tag"></<span class="name">localRepository</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- interactiveMode</span></span><br><span class="line"><span class="comment"> | This will determine whether maven prompts you when it needs input. If set to false,</span></span><br><span class="line"><span class="comment"> | maven will use a sensible default value, perhaps based on some other setting, for</span></span><br><span class="line"><span class="comment"> | the parameter in question.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | Default: true</span></span><br><span class="line"><span class="comment"> <interactiveMode>true</interactiveMode></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- offline</span></span><br><span class="line"><span class="comment"> | Determines whether maven should attempt to connect to the network when executing a build.</span></span><br><span class="line"><span class="comment"> | This will have an effect on artifact downloads, artifact deployment, and others.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | Default: false</span></span><br><span class="line"><span class="comment"> <offline>false</offline></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- pluginGroups</span></span><br><span class="line"><span class="comment"> | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.</span></span><br><span class="line"><span class="comment"> | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers</span></span><br><span class="line"><span class="comment"> | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.</span></span><br><span class="line"><span class="comment"> |--></span></span><br><span class="line"> <span class="tag"><<span class="name">pluginGroups</span>></span></span><br><span class="line"> <span class="comment"><!-- pluginGroup</span></span><br><span class="line"><span class="comment"> | Specifies a further group identifier to use for plugin lookup.</span></span><br><span class="line"><span class="comment"> <pluginGroup>com.your.plugins</pluginGroup></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"> <span class="tag"></<span class="name">pluginGroups</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- proxies</span></span><br><span class="line"><span class="comment"> | This is a list of proxies which can be used on this machine to connect to the network.</span></span><br><span class="line"><span class="comment"> | Unless otherwise specified (by system property or command-line switch), the first proxy</span></span><br><span class="line"><span class="comment"> | specification in this list marked as active will be used.</span></span><br><span class="line"><span class="comment"> |--></span></span><br><span class="line"> <span class="tag"><<span class="name">proxies</span>></span></span><br><span class="line"> <span class="comment"><!-- proxy</span></span><br><span class="line"><span class="comment"> | Specification for one proxy, to be used in connecting to the network.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> <proxy></span></span><br><span class="line"><span class="comment"> <id>optional</id></span></span><br><span class="line"><span class="comment"> <active>true</active></span></span><br><span class="line"><span class="comment"> <protocol>http</protocol></span></span><br><span class="line"><span class="comment"> <username>proxyuser</username></span></span><br><span class="line"><span class="comment"> <password>proxypass</password></span></span><br><span class="line"><span class="comment"> <host>proxy.host.net</host></span></span><br><span class="line"><span class="comment"> <port>80</port></span></span><br><span class="line"><span class="comment"> <nonProxyHosts>local.net|some.host.com</nonProxyHosts></span></span><br><span class="line"><span class="comment"> </proxy></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"> <span class="tag"></<span class="name">proxies</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- servers</span></span><br><span class="line"><span class="comment"> | This is a list of authentication profiles, keyed by the server-id used within the system.</span></span><br><span class="line"><span class="comment"> | Authentication profiles can be used whenever maven must make a connection to a remote server.</span></span><br><span class="line"><span class="comment"> |--></span></span><br><span class="line"> <span class="tag"><<span class="name">servers</span>></span></span><br><span class="line"> <span class="comment"><!-- server</span></span><br><span class="line"><span class="comment"> | Specifies the authentication information to use when connecting to a particular server, identified by</span></span><br><span class="line"><span class="comment"> | a unique name within the system (referred to by the 'id' attribute below).</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | <span class="doctag">NOTE:</span> You should either specify username/password OR privateKey/passphrase, since these pairings are</span></span><br><span class="line"><span class="comment"> | used together.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> <server></span></span><br><span class="line"><span class="comment"> <id>deploymentRepo</id></span></span><br><span class="line"><span class="comment"> <username>repouser</username></span></span><br><span class="line"><span class="comment"> <password>repopwd</password></span></span><br><span class="line"><span class="comment"> </server></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- Another sample, using keys to authenticate.</span></span><br><span class="line"><span class="comment"> <server></span></span><br><span class="line"><span class="comment"> <id>siteServer</id></span></span><br><span class="line"><span class="comment"> <privateKey>/path/to/private/key</privateKey></span></span><br><span class="line"><span class="comment"> <passphrase>optional; leave empty if not used.</passphrase></span></span><br><span class="line"><span class="comment"> </server></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"> <span class="tag"></<span class="name">servers</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- mirrors</span></span><br><span class="line"><span class="comment"> | This is a list of mirrors to be used in downloading artifacts from remote repositories.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | It works like this: a POM may declare a repository to use in resolving certain artifacts.</span></span><br><span class="line"><span class="comment"> | However, this repository may have problems with heavy traffic at times, so people have mirrored</span></span><br><span class="line"><span class="comment"> | it to several places.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | That repository definition will have a unique id, so we can create a mirror reference for that</span></span><br><span class="line"><span class="comment"> | repository, to be used as an alternate download site. The mirror site will be the preferred</span></span><br><span class="line"><span class="comment"> | server for that repository.</span></span><br><span class="line"><span class="comment"> |--></span></span><br><span class="line"> <span class="tag"><<span class="name">mirrors</span>></span></span><br><span class="line"> <span class="comment"><!-- mirror</span></span><br><span class="line"><span class="comment"> | Specifies a repository mirror site to use instead of a given repository. The repository that</span></span><br><span class="line"><span class="comment"> | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used</span></span><br><span class="line"><span class="comment"> | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> <mirror></span></span><br><span class="line"><span class="comment"> <id>mirrorId</id></span></span><br><span class="line"><span class="comment"> <mirrorOf>repositoryId</mirrorOf></span></span><br><span class="line"><span class="comment"> <name>Human Readable Name for this Mirror.</name></span></span><br><span class="line"><span class="comment"> <url>http://my.repository.com/repo/path</url></span></span><br><span class="line"><span class="comment"> </mirror></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"> <span class="comment"><!--<mirror></span></span><br><span class="line"><span class="comment"> <id>maven-default-http-blocker</id></span></span><br><span class="line"><span class="comment"> <mirrorOf>external:http:*</mirrorOf></span></span><br><span class="line"><span class="comment"> <name>Pseudo repository to mirror external repositories initially using HTTP.</name></span></span><br><span class="line"><span class="comment"> <url>http://0.0.0.0/</url></span></span><br><span class="line"><span class="comment"> <blocked>true</blocked></span></span><br><span class="line"><span class="comment"> </mirror>--></span></span><br><span class="line"> <span class="tag"><<span class="name">mirror</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">id</span>></span>nexus-aliyun<span class="tag"></<span class="name">id</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">mirrorOf</span>></span>central<span class="tag"></<span class="name">mirrorOf</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">name</span>></span>Nexus aliyun<span class="tag"></<span class="name">name</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">url</span>></span>http://maven.aliyun.com/nexus/content/groups/public<span class="tag"></<span class="name">url</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">mirror</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">mirrors</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- profiles</span></span><br><span class="line"><span class="comment"> | This is a list of profiles which can be activated in a variety of ways, and which can modify</span></span><br><span class="line"><span class="comment"> | the build process. Profiles provided in the settings.xml are intended to provide local machine-</span></span><br><span class="line"><span class="comment"> | specific paths and repository locations which allow the build to work in the local environment.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | For example, if you have an integration testing plugin - like cactus - that needs to know where</span></span><br><span class="line"><span class="comment"> | your Tomcat instance is installed, you can provide a variable here such that the variable is</span></span><br><span class="line"><span class="comment"> | dereferenced during the build process to configure the cactus plugin.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles</span></span><br><span class="line"><span class="comment"> | section of this document (settings.xml) - will be discussed later. Another way essentially</span></span><br><span class="line"><span class="comment"> | relies on the detection of a system property, either matching a particular value for the property,</span></span><br><span class="line"><span class="comment"> | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a</span></span><br><span class="line"><span class="comment"> | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.</span></span><br><span class="line"><span class="comment"> | Finally, the list of active profiles can be specified directly from the command line.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | <span class="doctag">NOTE:</span> For profiles defined in the settings.xml, you are restricted to specifying only artifact</span></span><br><span class="line"><span class="comment"> | repositories, plugin repositories, and free-form properties to be used as configuration</span></span><br><span class="line"><span class="comment"> | variables for plugins in the POM.</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="tag"><<span class="name">profiles</span>></span></span><br><span class="line"> <span class="comment"><!-- profile</span></span><br><span class="line"><span class="comment"> | Specifies a set of introductions to the build process, to be activated using one or more of the</span></span><br><span class="line"><span class="comment"> | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/></span></span><br><span class="line"><span class="comment"> | or the command line, profiles have to have an ID that is unique.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | An encouraged best practice for profile identification is to use a consistent naming convention</span></span><br><span class="line"><span class="comment"> | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.</span></span><br><span class="line"><span class="comment"> | This will make it more intuitive to understand what the set of introduced profiles is attempting</span></span><br><span class="line"><span class="comment"> | to accomplish, particularly when you only have a list of profile id's for debug.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.</span></span><br><span class="line"><span class="comment"> <profile></span></span><br><span class="line"><span class="comment"> <id>jdk-1.4</id></span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment"> <activation></span></span><br><span class="line"><span class="comment"> <jdk>1.4</jdk></span></span><br><span class="line"><span class="comment"> </activation></span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment"> <repositories></span></span><br><span class="line"><span class="comment"> <repository></span></span><br><span class="line"><span class="comment"> <id>jdk14</id></span></span><br><span class="line"><span class="comment"> <name>Repository for JDK 1.4 builds</name></span></span><br><span class="line"><span class="comment"> <url>http://www.myhost.com/maven/jdk14</url></span></span><br><span class="line"><span class="comment"> <layout>default</layout></span></span><br><span class="line"><span class="comment"> <snapshotPolicy>always</snapshotPolicy></span></span><br><span class="line"><span class="comment"> </repository></span></span><br><span class="line"><span class="comment"> </repositories></span></span><br><span class="line"><span class="comment"> </profile></span></span><br><span class="line"><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="comment"> | Here is another profile, activated by the system property 'target-env' with a value of 'dev',</span></span><br><span class="line"><span class="comment"> | which provides a specific path to the Tomcat instance. To use this, your plugin configuration</span></span><br><span class="line"><span class="comment"> | might hypothetically look like:</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"> | <plugin></span></span><br><span class="line"><span class="comment"> | <groupId>org.myco.myplugins</groupId></span></span><br><span class="line"><span class="comment"> | <artifactId>myplugin</artifactId></span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> | <configuration></span></span><br><span class="line"><span class="comment"> | <tomcatLocation>${tomcatPath}</tomcatLocation></span></span><br><span class="line"><span class="comment"> | </configuration></span></span><br><span class="line"><span class="comment"> | </plugin></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">NOTE:</span> If you just wanted to inject this configuration whenever someone set 'target-env' to</span></span><br><span class="line"><span class="comment"> | anything, you could just leave off the <value/> inside the activation-property.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> <profile></span></span><br><span class="line"><span class="comment"> <id>env-dev</id></span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment"> <activation></span></span><br><span class="line"><span class="comment"> <property></span></span><br><span class="line"><span class="comment"> <name>target-env</name></span></span><br><span class="line"><span class="comment"> <value>dev</value></span></span><br><span class="line"><span class="comment"> </property></span></span><br><span class="line"><span class="comment"> </activation></span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment"> <properties></span></span><br><span class="line"><span class="comment"> <tomcatPath>/path/to/tomcat/instance</tomcatPath></span></span><br><span class="line"><span class="comment"> </properties></span></span><br><span class="line"><span class="comment"> </profile></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"> <span class="tag"><<span class="name">profile</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">id</span>></span>jdk-1.8<span class="tag"></<span class="name">id</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">activation</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">activeByDefault</span>></span>true<span class="tag"></<span class="name">activeByDefault</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">jdk</span>></span>1.8<span class="tag"></<span class="name">jdk</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">activation</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">properties</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">maven.compiler.source</span>></span>1.8<span class="tag"></<span class="name">maven.compiler.source</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">maven.compiler.target</span>></span>1.8<span class="tag"></<span class="name">maven.compiler.target</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">maven.compiler.compilerVersion</span>></span>1.8<span class="tag"></<span class="name">maven.compiler.compilerVersion</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">properties</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">profile</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">profiles</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- activeProfiles</span></span><br><span class="line"><span class="comment"> | List of profiles that are active for all builds.</span></span><br><span class="line"><span class="comment"> |</span></span><br><span class="line"><span class="comment"> <activeProfiles></span></span><br><span class="line"><span class="comment"> <activeProfile>alwaysActiveProfile</activeProfile></span></span><br><span class="line"><span class="comment"> <activeProfile>anotherAlwaysActiveProfile</activeProfile></span></span><br><span class="line"><span class="comment"> </activeProfiles></span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"><span class="tag"></<span class="name">settings</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="Linux中使用-去掉了注释"><a href="#Linux中使用-去掉了注释" class="headerlink" title="Linux中使用,去掉了注释"></a>Linux中使用,去掉了注释</h3><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="meta"><?xml version=<span class="string">"1.0"</span> encoding=<span class="string">"UTF-8"</span>?></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">settings</span> <span class="attr">xmlns</span>=<span class="string">"http://maven.apache.org/SETTINGS/1.0.0"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">xmlns:xsi</span>=<span class="string">"http://www.w3.org/2001/XMLSchema-instance"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">xsi:schemaLocation</span>=<span class="string">"http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"</span>></span></span><br><span class="line"> </span><br><span class="line"><span class="tag"><<span class="name">localRepository</span>></span>/root/.m2/repository<span class="tag"></<span class="name">localRepository</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">pluginGroups</span>></span></span><br><span class="line"> </span><br><span class="line"> <span class="tag"></<span class="name">pluginGroups</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">proxies</span>></span></span><br><span class="line"> </span><br><span class="line"> <span class="tag"></<span class="name">proxies</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">servers</span>></span></span><br><span class="line"> </span><br><span class="line"> <span class="tag"></<span class="name">servers</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">mirrors</span>></span></span><br><span class="line"> </span><br><span class="line"> <span class="tag"><<span class="name">mirror</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">id</span>></span>alimaven<span class="tag"></<span class="name">id</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">mirrorOf</span>></span>central<span class="tag"></<span class="name">mirrorOf</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">name</span>></span>aliyun maven<span class="tag"></<span class="name">name</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">url</span>></span>http://maven.aliyun.com/nexus/content/repositories/central/<span class="tag"></<span class="name">url</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">mirror</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">mirrors</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">profiles</span>></span></span><br><span class="line"> </span><br><span class="line"> <span class="tag"></<span class="name">profiles</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">settings</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>Java</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>Java爬虫</title>
|
||
<url>/posts/60685.html</url>
|
||
<content><![CDATA[<p>视频教程1: 狂神说Java Jsoup爬虫入门实战 <a href="https://www.bilibili.com/video/BV1La4y1x7Wm?vd_source=aee5e475191b69e6c781059ab6662584">https://www.bilibili.com/video/BV1La4y1x7Wm?vd_source=aee5e475191b69e6c781059ab6662584</a></p>
|
||
<p>视频教程2:<a href="https://www.bilibili.com/video/BV1RU4y147eZ?vd_source=aee5e475191b69e6c781059ab6662584">https://www.bilibili.com/video/BV1RU4y147eZ?vd_source=aee5e475191b69e6c781059ab6662584</a></p>
|
||
<p>具体的看视频 急速入门</p>
|
||
<h2 id="入门实战教程"><a href="#入门实战教程" class="headerlink" title="入门实战教程"></a>入门实战教程</h2><h3 id="1-引入依赖"><a href="#1-引入依赖" class="headerlink" title="1.引入依赖"></a>1.引入依赖</h3><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!-- 爬取视频或者音频需要使用别的依赖 --></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.jsoup<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>jsoup<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>1.14.3<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-编写测试代码"><a href="#2-编写测试代码" class="headerlink" title="2.编写测试代码"></a>2.编写测试代码</h3><p>下面我们以爬取京东上的商品的图片和价格为例</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.jason;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.jsoup.Jsoup;</span><br><span class="line"><span class="keyword">import</span> org.jsoup.nodes.Document;</span><br><span class="line"><span class="keyword">import</span> org.jsoup.nodes.Element;</span><br><span class="line"><span class="keyword">import</span> org.jsoup.select.Elements;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.net.URL;</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/9</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">class</span> <span class="title class_">HtmlParseUtil</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> HtmlParseUtil.parseJd(<span class="string">"联想电脑"</span>);</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 class="doctag">@param</span> keywords 商品的品牌或者关键字 例如 联想电脑、华为手机、java书籍</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">parseJd</span><span class="params">(String keywords)</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="comment">//获取请求</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">url</span> <span class="operator">=</span> <span class="string">"https://search.jd.com/Search?keyword="</span> + keywords;<span class="comment">//页面上的地址信息</span></span><br><span class="line"> <span class="comment">//解析网页</span></span><br><span class="line"> <span class="comment">//第一个参数是url地址</span></span><br><span class="line"> <span class="comment">//第二个参数是响应时间,超过30秒就报错</span></span><br><span class="line"> <span class="comment">//返回的document就是浏览器的Document对象</span></span><br><span class="line"> <span class="type">Document</span> <span class="variable">document</span> <span class="operator">=</span> Jsoup.parse(<span class="keyword">new</span> <span class="title class_">URL</span>(url), <span class="number">30000</span>);</span><br><span class="line"> <span class="comment">//所有在js中可以使用的方法,这里都可以使用</span></span><br><span class="line"> <span class="type">Element</span> <span class="variable">element</span> <span class="operator">=</span> document.getElementById(<span class="string">"J_goodsList"</span>);<span class="comment">//通过id获取元素</span></span><br><span class="line"> <span class="comment">//获取所有的li元素</span></span><br><span class="line"> <span class="type">Elements</span> <span class="variable">elements</span> <span class="operator">=</span> element.getElementsByTag(<span class="string">"li"</span>);</span><br><span class="line"> <span class="comment">//遍历li元素的集合 获取每一个li元素</span></span><br><span class="line"> <span class="keyword">for</span> (Element el : elements) {</span><br><span class="line"> <span class="comment">//这种图片特别多的图片 会有一个懒加载</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">attr</span> <span class="operator">=</span> el.getElementsByTag(<span class="string">"img"</span>).eq(<span class="number">0</span>).attr(<span class="string">"data-lazy-img"</span>);<span class="comment">//通过标签获取元素</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">title</span> <span class="operator">=</span> el.getElementsByClass(<span class="string">"p-name"</span>).eq(<span class="number">0</span>).text();<span class="comment">//通过class获取元素</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">price</span> <span class="operator">=</span> el.getElementsByClass(<span class="string">"p-price"</span>).eq(<span class="number">0</span>).text();</span><br><span class="line"> System.out.println(<span class="string">"图片地址:https:"</span> + attr);</span><br><span class="line"> System.out.println(<span class="string">"商品名称:"</span> + title);</span><br><span class="line"> System.out.println(<span class="string">"商品价格:"</span> + price);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-运行测试"><a href="#3-运行测试" class="headerlink" title="3.运行测试"></a>3.运行测试</h3><p><img src="/pictures/image-20230509161845558.png" alt="image-20230509161845558"></p>
|
||
<p><img src="/pictures/image-20230509161907139.png" alt="image-20230509161907139"></p>
|
||
<h2 id="示例"><a href="#示例" class="headerlink" title="示例"></a>示例</h2><h3 id="爬取房天下上面的房价信息"><a href="#爬取房天下上面的房价信息" class="headerlink" title="爬取房天下上面的房价信息"></a>爬取房天下上面的房价信息</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.jason;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.jsoup.Jsoup;</span><br><span class="line"><span class="keyword">import</span> org.jsoup.nodes.Document;</span><br><span class="line"><span class="keyword">import</span> org.jsoup.nodes.Element;</span><br><span class="line"><span class="keyword">import</span> org.jsoup.select.Elements;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.net.URL;</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/9</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">class</span> <span class="title class_">ParseHouse</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="comment">//爬起房天下上面的房源数据</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">91</span>;</span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>){<span class="comment">//换页读取 页面有分页条的情况</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">url</span> <span class="operator">=</span> <span class="string">"https://newhouse.fang.com/house/s/b"</span>+i;</span><br><span class="line"> System.out.println(<span class="string">"正在爬取第"</span>+i+<span class="string">"页的数据....."</span>);</span><br><span class="line"> ParseHouse.selectHouses(url);</span><br><span class="line"> i++;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">selectHouses</span><span class="params">(String url)</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="type">Document</span> <span class="variable">document</span> <span class="operator">=</span> Jsoup.parse(<span class="keyword">new</span> <span class="title class_">URL</span>(url), <span class="number">30000</span>);</span><br><span class="line"> <span class="type">Element</span> <span class="variable">element</span> <span class="operator">=</span> document.getElementById(<span class="string">"newhouse_loupan_list"</span>);</span><br><span class="line"> <span class="type">Elements</span> <span class="variable">elements</span> <span class="operator">=</span> element.getElementsByTag(<span class="string">"li"</span>);</span><br><span class="line"> <span class="keyword">for</span> (Element el : elements) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">images</span> <span class="operator">=</span> el.getElementsByTag(<span class="string">"img"</span>).eq(<span class="number">1</span>).attr(<span class="string">"src"</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">alt</span> <span class="operator">=</span> el.getElementsByTag(<span class="string">"img"</span>).eq(<span class="number">1</span>).attr(<span class="string">"alt"</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">price</span> <span class="operator">=</span> el.getElementsByClass(<span class="string">"nhouse_price"</span>).text();</span><br><span class="line"> System.out.println(<span class="string">"图片:https:"</span>+images);</span><br><span class="line"> System.out.println(<span class="string">"名称:"</span>+alt);</span><br><span class="line"> System.out.println(<span class="string">"房价:"</span>+price);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230509180334969.png" alt="image-20230509180334969"></p>
|
||
<p><img src="/pictures/image-20230509180435467.png" alt="image-20230509180435467"></p>
|
||
<h3 id="爬取豆瓣电影排行榜的信息"><a href="#爬取豆瓣电影排行榜的信息" class="headerlink" title="爬取豆瓣电影排行榜的信息"></a>爬取豆瓣电影排行榜的信息</h3><p><img src="/pictures/image-20230509180547905.png" alt="image-20230509180547905"></p>
|
||
<h3 id="爬取全国各地房价的信息到excel表格中"><a href="#爬取全国各地房价的信息到excel表格中" class="headerlink" title="爬取全国各地房价的信息到excel表格中"></a>爬取全国各地房价的信息到excel表格中</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.jason;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.alibaba.excel.EasyExcel;</span><br><span class="line"><span class="keyword">import</span> com.jason.entity.HorseInfo;</span><br><span class="line"><span class="keyword">import</span> org.jsoup.Jsoup;</span><br><span class="line"><span class="keyword">import</span> org.jsoup.nodes.Document;</span><br><span class="line"><span class="keyword">import</span> org.jsoup.nodes.Element;</span><br><span class="line"><span class="keyword">import</span> org.jsoup.select.Elements;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.File;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.net.URL;</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> 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/9</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 爬取全国各地房价的信息到excel表格中</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">HousePriseList</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="comment">//爬取全国房价排行榜</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">fileName</span> <span class="operator">=</span> <span class="string">"C:\\AlYun\\work\\housePriceList.xlsx"</span>;</span><br><span class="line"> <span class="comment">//通过下面的中间表,我们可以实现向excel中追加数据 不是每次删除之前的数据再写入 或者追加的时候有多个表头信息</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">temp</span> <span class="operator">=</span> <span class="string">"C:\\AlYun\\work\\temp.xlsx"</span>; <span class="comment">//中间表 会自动被删除</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">1</span>;</span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">String</span> <span class="variable">url</span> <span class="operator">=</span> <span class="string">"https://fangjia.gotohui.com/top/"</span> + i + <span class="string">".html"</span>;</span><br><span class="line"> List<HorseInfo> horseInfos = HousePriseList.selectHorse(url);</span><br><span class="line"> <span class="type">File</span> <span class="variable">file</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">File</span>(fileName);</span><br><span class="line"> <span class="type">File</span> <span class="variable">tempFile</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">File</span>(temp);</span><br><span class="line"> <span class="keyword">if</span> (file.exists()) { <span class="comment">//判断excel表中是否写入过数据 写入过数据就追加数据</span></span><br><span class="line"> <span class="comment">// 第二次按照原有格式,不需要表头,追加写入</span></span><br><span class="line"> EasyExcel.write(file, HorseInfo.class).needHead(<span class="literal">false</span>).</span><br><span class="line"> withTemplate(file).file(tempFile).sheet().doWrite(horseInfos);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">// 第一次写入需要表头</span></span><br><span class="line"> EasyExcel.write(file, HorseInfo.class).sheet().doWrite(horseInfos);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (tempFile.exists()) {</span><br><span class="line"> file.delete();</span><br><span class="line"> tempFile.renameTo(file);</span><br><span class="line"> }</span><br><span class="line"> i++;</span><br><span class="line"> Thread.sleep(<span class="number">2000</span>);</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> List<HorseInfo> <span class="title function_">selectHorse</span><span class="params">(String url)</span> <span class="keyword">throws</span> IOException {</span><br><span class="line"> <span class="type">Document</span> <span class="variable">document</span> <span class="operator">=</span> Jsoup.parse(<span class="keyword">new</span> <span class="title class_">URL</span>(url), <span class="number">30000</span>);</span><br><span class="line"> <span class="type">Elements</span> <span class="variable">elements</span> <span class="operator">=</span> document.getElementsByClass(<span class="string">"ntable table-striped table-hover"</span>);</span><br><span class="line"> ArrayList<HorseInfo> horseInfos = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> <span class="keyword">for</span> (Element element : elements) {</span><br><span class="line"> <span class="type">Elements</span> <span class="variable">tr</span> <span class="operator">=</span> element.getElementsByTag(<span class="string">"tr"</span>);</span><br><span class="line"> <span class="keyword">for</span> (Element el : tr) {</span><br><span class="line"> <span class="type">Elements</span> <span class="variable">td</span> <span class="operator">=</span> el.getElementsByTag(<span class="string">"td"</span>);</span><br><span class="line"> System.out.println(<span class="string">"-----------------------------------------"</span>);</span><br><span class="line"> System.out.println(<span class="string">"编号:"</span> + td.eq(<span class="number">0</span>).text());</span><br><span class="line"> System.out.println(<span class="string">"城市:"</span> + td.eq(<span class="number">1</span>).text());</span><br><span class="line"> System.out.println(<span class="string">"单价(元/㎡):"</span> + td.eq(<span class="number">2</span>).text());</span><br><span class="line"> System.out.println(<span class="string">"同比(去年):"</span> + td.eq(<span class="number">3</span>).text());</span><br><span class="line"> System.out.println(<span class="string">"环比(上月):"</span> + td.eq(<span class="number">4</span>).text());</span><br><span class="line"> System.out.println(<span class="string">"收入比:"</span> + td.eq(<span class="number">5</span>).text());</span><br><span class="line"> <span class="keyword">if</span> (!td.eq(<span class="number">0</span>).text().equals(<span class="string">""</span>)) {</span><br><span class="line"> horseInfos.add(<span class="keyword">new</span> <span class="title class_">HorseInfo</span>(</span><br><span class="line"> td.eq(<span class="number">0</span>).text(),</span><br><span class="line"> td.eq(<span class="number">1</span>).text(),</span><br><span class="line"> td.eq(<span class="number">2</span>).text(),</span><br><span class="line"> td.eq(<span class="number">3</span>).text(),</span><br><span class="line"> td.eq(<span class="number">4</span>).text(),</span><br><span class="line"> td.eq(<span class="number">5</span>).text()</span><br><span class="line"> ));</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> horseInfos;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230509233922789.png" alt="image-20230509233922789"></p>
|
||
<p><img src="/pictures/image-20230509234019249.png" alt="image-20230509234019249"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>爬虫</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>简历模板</title>
|
||
<url>/posts/29250.html</url>
|
||
<content><![CDATA[<p>黑马程序员新版Java面试专题视频教程,java八股文面试全套真题+深度详解(含大厂高频面试真题) <a href="https://www.bilibili.com/video/BV1yT411H7YK/?share_source=copy_web&vd_source=aee5e475191b69e6c781059ab6662584">https://www.bilibili.com/video/BV1yT411H7YK/?share_source=copy_web&vd_source=aee5e475191b69e6c781059ab6662584</a></p>
|
||
<h2 id="Java批注简历标准"><a href="#Java批注简历标准" class="headerlink" title="Java批注简历标准"></a>Java批注简历标准</h2><p><img src="/pictures/image-20230508235133469.png" alt="image-20230508235133469"></p>
|
||
<h2 id="面试参考话术"><a href="#面试参考话术" class="headerlink" title="面试参考话术"></a>面试参考话术</h2>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/【必看】面试参考话术.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<h2 id="模板"><a href="#模板" class="headerlink" title="模板"></a>模板</h2><p>全部的模板地址: <a href="https://github.com/JasonsGong/resume">JasonsGong/resume: 简历模板 (github.com)</a></p>
|
||
<h3 id="模板一-本科一年经验"><a href="#模板一-本科一年经验" class="headerlink" title="模板一 本科一年经验"></a>模板一 本科一年经验</h3>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/【参考】1年_本科.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<h3 id="模板二-Java开发-AAA-N年"><a href="#模板二-Java开发-AAA-N年" class="headerlink" title="模板二 Java开发_AAA_N年"></a>模板二 Java开发_AAA_N年</h3>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/Java开发_AAA_N年.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<h3 id="模板三-灰蓝色色时尚简历模板"><a href="#模板三-灰蓝色色时尚简历模板" class="headerlink" title="模板三 灰蓝色色时尚简历模板"></a>模板三 灰蓝色色时尚简历模板</h3>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/灰蓝色色时尚简历模板.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<h3 id="模板四-灰色大气简约简历模板"><a href="#模板四-灰色大气简约简历模板" class="headerlink" title="模板四 灰色大气简约简历模板"></a>模板四 灰色大气简约简历模板</h3>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/灰色大气简约简历模板.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<h3 id="模板五-简约大气橙色简历模板"><a href="#模板五-简约大气橙色简历模板" class="headerlink" title="模板五 简约大气橙色简历模板"></a>模板五 简约大气橙色简历模板</h3>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/简约大气橙色简历模板.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<h3 id="模板六-经典风格简历模板"><a href="#模板六-经典风格简历模板" class="headerlink" title="模板六 经典风格简历模板"></a>模板六 经典风格简历模板</h3>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/经典风格简历模板.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<h3 id="模板七-时尚线条简历模板"><a href="#模板七-时尚线条简历模板" class="headerlink" title="模板七 时尚线条简历模板"></a>模板七 时尚线条简历模板</h3>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/时尚线条简历模板.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<h3 id="模板八-科技版简历模板"><a href="#模板八-科技版简历模板" class="headerlink" title="模板八 科技版简历模板"></a>模板八 科技版简历模板</h3>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/科技版简历模板.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<h3 id="模板九-JAVA开发-李传播-5年"><a href="#模板九-JAVA开发-李传播-5年" class="headerlink" title="模板九 JAVA开发_李传播_5年"></a>模板九 JAVA开发_李传播_5年</h3>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/JAVA开发_李传播_5年.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>面试</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>简历</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>面试专题</title>
|
||
<url>/posts/46317.html</url>
|
||
<content><![CDATA[<p><strong>参考资料:</strong></p>
|
||
<p>java八股文面试全套真题+深度详解(含大厂高频面试真题) <a href="https://www.bilibili.com/video/BV1yT411H7YK/?share_source=copy_web&vd_source=aee5e475191b69e6c781059ab6662584">https://www.bilibili.com/video/BV1yT411H7YK/?share_source=copy_web&vd_source=aee5e475191b69e6c781059ab6662584</a></p>
|
||
<h2 id="1-Redis篇"><a href="#1-Redis篇" class="headerlink" title="1.Redis篇"></a>1.Redis篇</h2><blockquote>
|
||
<p><strong>面试官</strong>:什么是缓存穿透 ? 怎么解决 ?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯~~,我想一下</p>
|
||
<p>缓存穿透是指查询一个一定<strong>不存在</strong>的数据,如果从存储层查不到数据则不写入缓存,这将导致这个不存在的数据每次请求都要到 DB 去查询,可能导致 DB 挂掉。这种情况大概率是遭到了攻击。</p>
|
||
<p>解决方案的话,我们通常都会用布隆过滤器来解决它</p>
|
||
<p><strong>面试官</strong>:好的,你能介绍一下布隆过滤器吗?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,是这样~</p>
|
||
<p>布隆过滤器主要是用于检索一个元素是否在一个集合中。我们当时使用的是redisson实现的布隆过滤器。</p>
|
||
<p>它的底层主要是先去初始化一个比较大数组,里面存放的二进制0或1。在一开始都是0,当一个key来了之后经过3次hash计算,模于数组长度找到数据的下标然后把数组中原来的0改为1,这样的话,三个数组的位置就能标明一个key的存在。查找的过程也是一样的。</p>
|
||
<p>当然是有缺点的,布隆过滤器有可能会产生一定的误判,我们一般可以设置这个误判率,大概不会超过5%,其实这个误判是必然存在的,要不就得增加数组的长度,其实已经算是很划分了,5%以内的误判率一般的项目也能接受,不至于高并发下压倒数据库。</p>
|
||
<p><strong>面试官</strong>:什么是缓存击穿 ? 怎么解决 ?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯!!</p>
|
||
<p>缓存击穿的意思是对于设置了过期时间的key,缓存在某个时间点过期的时候,恰好这时间点对这个Key有大量的并发请求过来,这些请求发现缓存过期一般都会从后端 DB 加载数据并回设到缓存,这个时候大并发的请求可能会瞬间把 DB 压垮。</p>
|
||
<p>解决方案有两种方式:</p>
|
||
<p>第一可以使用互斥锁:当缓存失效时,不立即去load db,先使用如 Redis 的 setnx 去设置一个互斥锁,当操作成功返回时再进行 load db的操作并回设缓存,否则重试get缓存的方法</p>
|
||
<p>第二种方案可以设置当前key逻辑过期,大概是思路如下:</p>
|
||
<p>①:在设置key的时候,设置一个过期时间字段一块存入缓存中,不给当前key设置过期时间</p>
|
||
<p>②:当查询的时候,从redis取出数据后判断时间是否过期</p>
|
||
<p>③:如果过期则开通另外一个线程进行数据同步,当前线程正常返回数据,这个数据不是最新</p>
|
||
<p>当然两种方案各有利弊:===============</p>
|
||
<p>如果选择数据的强一致性,建议使用分布式锁的方案,性能上可能没那么高,锁需要等,也有可能产生死锁的问题</p>
|
||
<p>如果选择key的逻辑删除,则优先考虑的高可用性,性能比较高,但是数据同步这块做不到强一致。</p>
|
||
<p><strong>面试官</strong>:什么是缓存雪崩 ? 怎么解决 ?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯!!</p>
|
||
<p>缓存雪崩意思是设置缓存时采用了相同的过期时间,导致缓存在某一时刻同时失效,请求全部转发到DB,DB 瞬时压力过重雪崩。与缓存击穿的区别:雪崩是很多key,击穿是某一个key缓存。</p>
|
||
<p>解决方案主要是可以将缓存失效时间分散开,比如可以在原有的失效时间基础上增加一个随机值,比如1-5分钟随机,这样每一个缓存的过期时间的重复率就会降低,就很难引发集体失效的事件。</p>
|
||
<p><strong>面试官</strong>:redis做为缓存,mysql的数据如何与redis进行同步呢?(双写一致性)</p>
|
||
<p><strong>候选人</strong>:嗯!就说我最近做的这个项目,里面有xxxx(<strong>根据自己的简历上写</strong>)的功能,需要让数据库与redis高度保持一致,因为要求时效性比较高,我们当时采用的读写锁保证的强一致性。</p>
|
||
<p>我们采用的是redisson实现的读写锁,在读的时候添加共享锁,可以保证读读不互斥,读写互斥。当我们更新数据的时候,添加排他锁,它是读写,读读都互斥,这样就能保证在写数据的同时是不会让其他线程读数据的,避免了脏数据。这里面需要注意的是读方法和写方法上需要使用同一把锁才行。</p>
|
||
<p><strong>面试官</strong>:那这个排他锁是如何保证读写、读读互斥的呢?</p>
|
||
<p><strong>候选人</strong>:其实排他锁底层使用也是setnx,保证了同时只能有一个线程操作锁住的方法</p>
|
||
<p><strong>面试官</strong>:你听说过延时双删吗?为什么不用它呢?</p>
|
||
<p><strong>候选人</strong>:延迟双删,如果是写操作,我们先把缓存中的数据删除,然后更新数据库,最后再延时删除缓存中的数据,其中这个延时多久不太好确定,在延时的过程中可能会出现脏数据,并不能保证强一致性,所以没有采用它。</p>
|
||
<p><strong>面试官</strong>:redis做为缓存,mysql的数据如何与redis进行同步呢?(双写一致性)</p>
|
||
<p><strong>候选人</strong>:嗯!就说我最近做的这个项目,里面有xxxx(<strong>根据自己的简历上写</strong>)的功能,数据同步可以有一定的延时(符合大部分业务)</p>
|
||
<p>我们当时采用的阿里的canal组件实现数据同步:不需要更改业务代码,部署一个canal服务。canal服务把自己伪装成mysql的一个从节点,当mysql数据更新以后,canal会读取binlog数据,然后在通过canal的客户端获取到数据,更新缓存即可。</p>
|
||
<p><strong>面试官</strong>:redis做为缓存,数据的持久化是怎么做的?</p>
|
||
<p><strong>候选人</strong>:在Redis中提供了两种数据持久化的方式:1、RDB 2、AOF</p>
|
||
<p><strong>面试官</strong>:这两种持久化方式有什么区别呢?</p>
|
||
<p><strong>候选人</strong>:RDB是一个快照文件,它是把redis内存存储的数据写到磁盘上,当redis实例宕机恢复数据的时候,方便从RDB的快照文件中恢复数据。</p>
|
||
<p>AOF的含义是追加文件,当redis操作写命令的时候,都会存储这个文件中,当redis实例宕机恢复数据的时候,会从这个文件中再次执行一遍命令来恢复数据</p>
|
||
<p><strong>面试官</strong>:这两种方式,哪种恢复的比较快呢?</p>
|
||
<p><strong>候选人</strong>:RDB因为是二进制文件,在保存的时候体积也是比较小的,它恢复的比较快,但是它有可能会丢数据,我们通常在项目中也会使用AOF来恢复数据,虽然AOF恢复的速度慢一些,但是它丢数据的风险要小很多,在AOF文件中可以设置刷盘策略,我们当时设置的就是每秒批量写入一次命令</p>
|
||
<p><strong>面试官</strong>:Redis的数据过期策略有哪些 ?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯~,在redis中提供了两种数据过期删除策略</p>
|
||
<p>第一种是惰性删除,在设置该key过期时间后,我们不去管它,当需要该key时,我们在检查其是否过期,如果过期,我们就删掉它,反之返回该key。</p>
|
||
<p>第二种是 定期删除,就是说每隔一段时间,我们就对一些key进行检查,删除里面过期的key</p>
|
||
<p>定期清理的两种模式:</p>
|
||
<ul>
|
||
<li>SLOW模式是定时任务,执行频率默认为10hz,每次不超过25ms,以通过修改配置文件redis.conf 的 <strong>hz</strong> 选项来调整这个次数</li>
|
||
<li>FAST模式执行频率不固定,每次事件循环会尝试执行,但两次间隔不低于2ms,每次耗时不超过1ms</li>
|
||
</ul>
|
||
<p>Redis的过期删除策略:<strong>惰性删除 + 定期删除</strong>两种策略进行配合使用。</p>
|
||
<p><strong>面试官</strong>:Redis的数据淘汰策略有哪些 ?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,这个在redis中提供了很多种,默认是noeviction,不删除任何数据,内部不足直接报错</p>
|
||
<p>是可以在redis的配置文件中进行设置的,里面有两个非常重要的概念,一个是LRU,另外一个是LFU</p>
|
||
<p>LRU的意思就是最少最近使用,用当前时间减去最后一次访问时间,这个值越大则淘汰优先级越高。</p>
|
||
<p>LFU的意思是最少频率使用。会统计每个key的访问频率,值越小淘汰优先级越高</p>
|
||
<p>我们在项目设置的allkeys-lru,挑选最近最少使用的数据淘汰,把一些经常访问的key留在redis中</p>
|
||
<p><strong>面试官</strong>:数据库有1000万数据 ,Redis只能缓存20w数据, 如何保证Redis中的数据都是热点数据 ?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,我想一下~~</p>
|
||
<p>可以使用 allkeys-lru (挑选最近最少使用的数据淘汰)淘汰策略,那留下来的都是经常访问的热点数据</p>
|
||
<p><strong>面试官</strong>:Redis的内存用完了会发生什么?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯~,这个要看redis的数据淘汰策略是什么,如果是默认的配置,redis内存用完以后则直接报错。我们当时设置的 allkeys-lru 策略。把最近最常访问的数据留在缓存中。</p>
|
||
<p><strong>面试官</strong>:Redis分布式锁如何实现 ?</p>
|
||
<p><strong>候选人</strong>:嗯,在redis中提供了一个命令setnx(SET if not exists)</p>
|
||
<p>由于redis的单线程的,用了命令之后,只能有一个客户端对某一个key设置值,在没有过期或删除key的时候是其他客户端是不能设置这个key的</p>
|
||
<p><strong>面试官</strong>:好的,那你如何控制Redis实现分布式锁有效时长呢?</p>
|
||
<p><strong>候选人</strong>:嗯,的确,redis的setnx指令不好控制这个问题,我们当时采用的redis的一个框架redisson实现的。</p>
|
||
<p>在redisson中需要手动加锁,并且可以控制锁的失效时间和等待时间,当锁住的一个业务还没有执行完成的时候,在redisson中引入了一个看门狗机制,就是说每隔一段时间就检查当前业务是否还持有锁,如果持有就增加加锁的持有时间,当业务执行完成之后需要使用释放锁就可以了</p>
|
||
<p>还有一个好处就是,在高并发下,一个业务有可能会执行很快,先客户1持有锁的时候,客户2来了以后并不会马上拒绝,它会自旋不断尝试获取锁,如果客户1释放之后,客户2就可以马上持有锁,性能也得到了提升。</p>
|
||
<p><strong>面试官</strong>:好的,redisson实现的分布式锁是可重入的吗?</p>
|
||
<p><strong>候选人</strong>:嗯,是可以重入的。这样做是为了避免死锁的产生。这个重入其实在内部就是判断是否是当前线程持有的锁,如果是当前线程持有的锁就会计数,如果释放锁就会在计算上减一。在存储数据的时候采用的hash结构,大key可以按照自己的业务进行定制,其中小key是当前线程的唯一标识,value是当前线程重入的次数</p>
|
||
<p><strong>面试官</strong>:redisson实现的分布式锁能解决主从一致性的问题吗</p>
|
||
<p><strong>候选人</strong>:这个是不能的,比如,当线程1加锁成功后,master节点数据会异步复制到slave节点,此时当前持有Redis锁的master节点宕机,slave节点被提升为新的master节点,假如现在来了一个线程2,再次加锁,会在新的master节点上加锁成功,这个时候就会出现两个节点同时持有一把锁的问题。</p>
|
||
<p>我们可以利用redisson提供的红锁来解决这个问题,它的主要作用是,不能只在一个redis实例上创建锁,应该是在多个redis实例上创建锁,并且要求在大多数redis节点上都成功创建锁,红锁中要求是redis的节点数量要过半。这样就能避免线程1加锁成功后master节点宕机导致线程2成功加锁到新的master节点上的问题了。</p>
|
||
<p>但是,如果使用了红锁,因为需要同时在多个节点上都添加锁,性能就变的很低了,并且运维维护成本也非常高,所以,我们一般在项目中也不会直接使用红锁,并且官方也暂时废弃了这个红锁</p>
|
||
<p><strong>面试官</strong>:好的,如果业务非要保证数据的强一致性,这个该怎么解决呢?</p>
|
||
<p><strong>候选人:</strong>嗯~,redis本身就是支持高可用的,做到强一致性,就非常影响性能,所以,如果有强一致性要求高的业务,建议使用zookeeper实现的分布式锁,它是可以保证强一致性的。</p>
|
||
<p><strong>面试官</strong>:Redis集群有哪些方案, 知道嘛 ?</p>
|
||
<p><strong>候选人</strong>:嗯~~,在Redis中提供的集群方案总共有三种:主从复制、哨兵模式、Redis分片集群</p>
|
||
<p><strong>面试官</strong>:那你来介绍一下主从同步</p>
|
||
<p><strong>候选人</strong>:嗯,是这样的,单节点Redis的并发能力是有上限的,要进一步提高Redis的并发能力,可以搭建主从集群,实现读写分离。一般都是一主多从,主节点负责写数据,从节点负责读数据,主节点写入数据之后,需要把数据同步到从节点中</p>
|
||
<p><strong>面试官</strong>:能说一下,主从同步数据的流程</p>
|
||
<p><strong>候选人</strong>:嗯~~,好!主从同步分为了两个阶段,一个是全量同步,一个是增量同步</p>
|
||
<p>全量同步是指从节点第一次与主节点建立连接的时候使用全量同步,流程是这样的:</p>
|
||
<p>第一:从节点请求主节点同步数据,其中从节点会携带自己的replication id和offset偏移量。</p>
|
||
<p>第二:主节点判断是否是第一次请求,主要判断的依据就是,主节点与从节点是否是同一个replication id,如果不是,就说明是第一次同步,那主节点就会把自己的replication id和offset发送给从节点,让从节点与主节点的信息保持一致。</p>
|
||
<p>第三:在同时主节点会执行bgsave,生成rdb文件后,发送给从节点去执行,从节点先把自己的数据清空,然后执行主节点发送过来的rdb文件,这样就保持了一致</p>
|
||
<p>当然,如果在rdb生成执行期间,依然有请求到了主节点,而主节点会以命令的方式记录到缓冲区,缓冲区是一个日志文件,最后把这个日志文件发送给从节点,这样就能保证主节点与从节点完全一致了,后期再同步数据的时候,都是依赖于这个日志文件,这个就是全量同步</p>
|
||
<p>增量同步指的是,当从节点服务重启之后,数据就不一致了,所以这个时候,从节点会请求主节点同步数据,主节点还是判断不是第一次请求,不是第一次就获取从节点的offset值,然后主节点从命令日志中获取offset值之后的数据,发送给从节点进行数据同步</p>
|
||
<p><strong>面试官</strong>:怎么保证Redis的高并发高可用</p>
|
||
<p><strong>候选人</strong>:首先可以搭建主从集群,再加上使用redis中的哨兵模式,哨兵模式可以实现主从集群的自动故障恢复,里面就包含了对主从服务的监控、自动故障恢复、通知;如果master故障,Sentinel会将一个slave提升为master。当故障实例恢复后也以新的master为主;同时Sentinel也充当Redis客户端的服务发现来源,当集群发生故障转移时,会将最新信息推送给Redis的客户端,所以一般项目都会采用哨兵的模式来保证redis的高并发高可用</p>
|
||
<p><strong>面试官</strong>:你们使用redis是单点还是集群,哪种集群</p>
|
||
<p><strong>候选人</strong>:嗯!,我们当时使用的是主从(1主1从)加哨兵。一般单节点不超过10G内存,如果Redis内存不足则可以给不同服务分配独立的Redis主从节点。尽量不做分片集群。因为集群维护起来比较麻烦,并且集群之间的心跳检测和数据通信会消耗大量的网络带宽,也没有办法使用lua脚本和事务</p>
|
||
<p><strong>面试官</strong>:redis集群脑裂,该怎么解决呢?</p>
|
||
<p><strong>候选人</strong>:嗯! 这个在项目很少见,不过脑裂的问题是这样的,我们现在用的是redis的哨兵模式集群的</p>
|
||
<p>有的时候由于网络等原因可能会出现脑裂的情况,就是说,由于redis master节点和redis salve节点和sentinel处于不同的网络分区,使得sentinel没有能够心跳感知到master,所以通过选举的方式提升了一个salve为master,这样就存在了两个master,就像大脑分裂了一样,这样会导致客户端还在old master那里写入数据,新节点无法同步数据,当网络恢复后,sentinel会将old master降为salve,这时再从新master同步数据,这会导致old master中的大量数据丢失。</p>
|
||
<p>关于解决的话,我记得在redis的配置中可以设置:第一可以设置最少的salve节点个数,比如设置至少要有一个从节点才能同步数据,第二个可以设置主从数据复制和同步的延迟时间,达不到要求就拒绝请求,就可以避免大量的数据丢失</p>
|
||
<p><strong>面试官</strong>:redis的分片集群有什么作用</p>
|
||
<p><strong>候选人</strong>:分片集群主要解决的是,海量数据存储的问题,集群中有多个master,每个master保存不同数据,并且还可以给每个master设置多个slave节点,就可以继续增大集群的高并发能力。同时每个master之间通过ping监测彼此健康状态,就类似于哨兵模式了。当客户端请求可以访问集群任意节点,最终都会被转发到正确节点</p>
|
||
<p><strong>面试官</strong>:Redis分片集群中数据是怎么存储和读取的?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯~,在redis集群中是这样的</p>
|
||
<p>Redis 集群引入了哈希槽的概念,有 16384 个哈希槽,集群中每个主节点绑定了一定范围的哈希槽范围, key通过 CRC16 校验后对 16384 取模来决定放置哪个槽,通过槽找到对应的节点进行存储。</p>
|
||
<p>取值的逻辑是一样的</p>
|
||
<p><strong>面试官</strong>:Redis是单线程的,但是为什么还那么快?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,这个有几个原因吧~~~</p>
|
||
<p>1、完全基于内存的,C语言编写</p>
|
||
<p>2、采用单线程,避免不必要的上下文切换可竞争条件</p>
|
||
<p>3、使用多路I/O复用模型,非阻塞IO</p>
|
||
<p>例如:bgsave 和 bgrewriteaof 都是在<strong>后台</strong>执行操作,不影响主线程的正常使用,不会产生阻塞</p>
|
||
<p><strong>面试官</strong>:能解释一下I/O多路复用模型?</p>
|
||
<p><strong>候选人</strong>:嗯~~,I/O多路复用是指利用单个线程来同时监听多个Socket ,并在某个Socket可读、可写时得到通知,从而避免无效的等待,充分利用CPU资源。目前的I/O多路复用都是采用的epoll模式实现,它会在通知用户进程Socket就绪的同时,把已就绪的Socket写入用户空间,不需要挨个遍历Socket来判断是否就绪,提升了性能。</p>
|
||
<p>其中Redis的网络模型就是使用I/O多路复用结合事件的处理器来应对多个Socket请求,比如,提供了连接应答处理器、命令回复处理器,命令请求处理器;</p>
|
||
<p>在Redis6.0之后,为了提升更好的性能,在命令回复处理器使用了多线程来处理回复事件,在命令请求处理器中,将命令的转换使用了多线程,增加命令转换速度,在命令执行的时候,依然是单线程</p>
|
||
</blockquote>
|
||
<h2 id="2-数据库篇"><a href="#2-数据库篇" class="headerlink" title="2.数据库篇"></a>2.数据库篇</h2><blockquote>
|
||
<p><strong>面试官:</strong>MySQL中,如何定位慢查询?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>嗯~,我们当时做压测的时候有的接口非常的慢,接口的响应时间超过了2秒以上,因为我们当时的系统部署了运维的监控系统Skywalking ,在展示的报表中可以看到是哪一个接口比较慢,并且可以分析这个接口哪部分比较慢,这里可以看到SQL的具体的执行时间,所以可以定位是哪个sql出了问题</p>
|
||
<p>如果,项目中没有这种运维的监控系统,其实在MySQL中也提供了慢日志查询的功能,可以在MySQL的系统配置文件中开启这个慢日志的功能,并且也可以设置SQL执行超过多少时间来记录到一个日志文件中,我记得上一个项目配置的是2秒,只要SQL执行的时间超过了2秒就会记录到日志文件中,我们就可以在日志文件找到执行比较慢的SQL了。</p>
|
||
<p><strong>面试官:</strong>那这个SQL语句执行很慢, 如何分析呢?</p>
|
||
<p><strong>候选人:</strong>如果一条sql执行很慢的话,我们通常会使用mysql自动的执行计划explain来去查看这条sql的执行情况,比如在这里面可以通过key和key_len检查是否命中了索引,如果本身已经添加了索引,也可以判断索引是否有失效的情况,第二个,可以通过type字段查看sql是否有进一步的优化空间,是否存在全索引扫描或全盘扫描,第三个可以通过extra建议来判断,是否出现了回表的情况,如果出现了,可以尝试添加索引或修改返回字段来修复</p>
|
||
<p><strong>面试官:</strong>了解过索引吗?(什么是索引)</p>
|
||
<p><strong>候选人:</strong>嗯,索引在项目中还是比较常见的,它是帮助MySQL高效获取数据的数据结构,主要是用来提高数据检索的效率,降低数据库的IO成本,同时通过索引列对数据进行排序,降低数据排序的成本,也能降低了CPU的消耗</p>
|
||
<p><strong>面试官:</strong>索引的底层数据结构了解过嘛 ? </p>
|
||
<p><strong>候选人:</strong>MySQL的默认的存储引擎InnoDB采用的B+树的数据结构来存储索引,选择B+树的主要的原因是:第一阶数更多,路径更短,第二个磁盘读写代价B+树更低,非叶子节点只存储指针,叶子阶段存储数据,第三是B+树便于扫库和区间查询,叶子节点是一个双向链表</p>
|
||
<p><strong>面试官:</strong>B树和B+树的区别是什么呢?</p>
|
||
<p><strong>候选人</strong>:第一:在B树中,非叶子节点和叶子节点都会存放数据,而B+树的所有的数据都会出现在叶子节点,在查询的时候,B+树查找效率更加稳定</p>
|
||
<p>第二:在进行范围查询的时候,B+树效率更高,因为B+树都在叶子节点存储,并且叶子节点是一个双向链表</p>
|
||
<p><strong>面试官:</strong>什么是聚簇索引什么是非聚簇索引 ?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>好的~,聚簇索引主要是指数据与索引放到一块,B+树的叶子节点保存了整行数据,有且只有一个,一般情况下主键在作为聚簇索引的</p>
|
||
<p>非聚簇索引值的是数据与索引分开存储,B+树的叶子节点保存对应的主键,可以有多个,一般我们自己定义的索引都是非聚簇索引</p>
|
||
<p><strong>面试官:</strong>知道什么是回表查询嘛 ?</p>
|
||
<p><strong>候选人:</strong>嗯,其实跟刚才介绍的聚簇索引和非聚簇索引是有关系的,回表的意思就是通过二级索引找到对应的主键值,然后再通过主键值找到聚集索引中所对应的整行数据,这个过程就是回表</p>
|
||
<p>【<strong>备注</strong>:如果面试官直接问回表,则需要先介绍聚簇索引和非聚簇索引】</p>
|
||
<p><strong>面试官:</strong>知道什么叫覆盖索引嘛 ? </p>
|
||
<p><strong>候选人:</strong>嗯~,清楚的</p>
|
||
<p>覆盖索引是指select查询语句使用了索引,在返回的列,必须在索引中全部能够找到,如果我们使用id查询,它会直接走聚集索引查询,一次索引扫描,直接返回数据,性能高。</p>
|
||
<p>如果按照二级索引查询数据的时候,返回的列中没有创建索引,有可能会触发回表查询,尽量避免使用select *,尽量在返回的列中都包含添加索引的字段</p>
|
||
<p><strong>面试官:</strong>MYSQL超大分页怎么处理 ?</p>
|
||
<p><strong>候选人:</strong>嗯,超大分页一般都是在数据量比较大时,我们使用了limit分页查询,并且需要对数据进行排序,这个时候效率就很低,我们可以采用覆盖索引和子查询来解决</p>
|
||
<p>先分页查询数据的id字段,确定了id之后,再用子查询来过滤,只查询这个id列表中的数据就可以了</p>
|
||
<p>因为查询id的时候,走的覆盖索引,所以效率可以提升很多</p>
|
||
<p><strong>面试官:</strong>索引创建原则有哪些?</p>
|
||
<p><strong>候选人:</strong>嗯,这个情况有很多,不过都有一个大前提,就是表中的数据要超过10万以上,我们才会创建索引,并且添加索引的字段是查询比较频繁的字段,一般也是像作为查询条件,排序字段或分组的字段这些。</p>
|
||
<p>还有就是,我们通常创建索引的时候都是使用复合索引来创建,一条sql的返回值,尽量使用覆盖索引,如果字段的区分度不高的话,我们也会把它放在组合索引后面的字段。</p>
|
||
<p>如果某一个字段的内容较长,我们会考虑使用前缀索引来使用,当然并不是所有的字段都要添加索引,这个索引的数量也要控制,因为添加索引也会导致新增改的速度变慢。</p>
|
||
<p><strong>面试官:</strong>什么情况下索引会失效 ?</p>
|
||
<p><strong>候选人:</strong>嗯,这个情况比较多,我说一些自己的经验,以前遇到过的</p>
|
||
<p>比如,索引在使用的时候没有遵循最左匹配法则,第二个是,模糊查询,如果%号在前面也会导致索引失效。如果在添加索引的字段上进行了运算操作或者类型转换也都会导致索引失效。</p>
|
||
<p>我们之前还遇到过一个就是,如果使用了复合索引,中间使用了范围查询,右边的条件索引也会失效</p>
|
||
<p>查询的时候发生了类型转换,在查询的时候做了运算的操作和模糊查询也会导致索引失效</p>
|
||
<p>所以,通常情况下,想要判断出这条sql是否有索引失效的情况,可以使用explain执行计划来分析</p>
|
||
<p><strong>面试官:</strong>sql的优化的经验</p>
|
||
<p><strong>候选人:</strong>嗯,这个在项目还是挺常见的,当然如果直说sql优化的话,我们会从这几方面考虑,比如</p>
|
||
<p>建表的时候、使用索引、sql语句的编写、主从复制,读写分离,还有一个是如果量比较大的话,可以考虑分库分表</p>
|
||
<p>直接经验:</p>
|
||
<p>①SELECT语句务必指明字段名称(避免直接使用select * )</p>
|
||
<p>②SQL语句要避免造成索引失效的写法</p>
|
||
<p>③尽量用union all代替union union会多一次过滤,效率低</p>
|
||
<p>④避免在where子句中对字段进行表达式操作</p>
|
||
<p>⑤Join优化 能用innerjoin 就不用left join right join,如必须使用 一定要以小表为驱动,内连接会对两个表进行优化,优先把小表放到外边,把大表放到里边。left join 或 right join,不会重新调整顺序</p>
|
||
<p><strong>面试官:</strong>创建表的时候,你们是如何优化的呢?</p>
|
||
<p><strong>候选人:</strong>这个我们主要参考的阿里出的那个开发手册《嵩山版》,就比如,在定义字段的时候需要结合字段的内容来选择合适的类型,如果是数值的话,像tinyint、int 、bigint这些类型,要根据实际情况选择。如果是字符串类型,也是结合存储的内容来选择char和varchar或者text类型</p>
|
||
<p><strong>面试官:</strong>那在使用索引的时候,是如何优化呢?</p>
|
||
<p><strong>候选人:</strong>【参考索引创建原则 进行描述】</p>
|
||
<p>1). 针对于数据量较大,且查询比较频繁的表建立索引。</p>
|
||
<p>2). 针对于常作为查询条件(where)、排序(order by)、分组(group by)操作的字段建立索引。</p>
|
||
<p>3). 尽量选择区分度高的列作为索引,尽量建立唯一索引,区分度越高,使用索引的效率越高。</p>
|
||
<p>4). 如果是字符串类型的字段,字段的长度较长,可以针对于字段的特点,建立前缀索引。</p>
|
||
<p>5). 尽量使用联合索引,减少单列索引,查询时,联合索引很多时候可以覆盖索引,节省存储空间,避免回表,提高查询效率。</p>
|
||
<p>6). 要控制索引的数量,索引并不是多多益善,索引越多,维护索引结构的代价也就越大,会影响增删改的效率。</p>
|
||
<p>7). 如果索引列不能存储NULL值,请在创建表时使用NOT NULL约束它。当优化器知道每列是否包含NULL值时,它可以更好地确定哪个索引最有效地用于查询。</p>
|
||
<p><strong>面试官:</strong>你平时对sql语句做了哪些优化呢?</p>
|
||
<p><strong>候选人:</strong>嗯,这个也有很多,比如SELECT语句务必指明字段名称,不要直接使用select * ,还有就是要注意SQL语句避免造成索引失效的写法;如果是聚合查询,尽量用union all代替union ,union会多一次过滤,效率比较低;如果是表关联的话,尽量使用innerjoin ,不要使用用left join right join,如必须使用 一定要以小表为驱动</p>
|
||
<p><strong>面试官:</strong>事务的特性是什么?可以详细说一下吗?</p>
|
||
<p><strong>候选人:</strong>嗯,这个比较清楚,ACID,分别指的是:原子性、一致性、隔离性、持久性;我举个例子:</p>
|
||
<p>A向B转账500,转账成功,A扣除500元,B增加500元,原子操作体现在要么都成功,要么都失败</p>
|
||
<p>在转账的过程中,数据要一致,A扣除了500,B必须增加500</p>
|
||
<p>在转账的过程中,隔离性体现在A像B转账,不能受其他事务干扰</p>
|
||
<p>在转账的过程中,持久性体现在事务提交后,要把数据持久化(可以说是落盘操作)</p>
|
||
<p>ACID介绍:</p>
|
||
<p>原子性(<strong>A</strong>tomicity):事务是不可分割的最小操作单元,要么全部成功,要么全部失败。</p>
|
||
<p>一致性(<strong>C</strong>onsistency):事务完成时,必须使所有的数据都保持一致状态。</p>
|
||
<p>隔离性(<strong>I</strong>solation):数据库系统提供的隔离机制,保证事务在不受外部并发操作影响的独立环境下运行。</p>
|
||
<p>持久性(<strong>D</strong>urability):事务一旦提交或回滚,它对数据库中的数据的改变就是永久的。</p>
|
||
<p><strong>面试官</strong>:并发事务带来哪些问题?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>我们在项目开发中,多个事务并发进行是经常发生的,并发也是必然的,有可能导致一些问题</p>
|
||
<p>第一是脏读, 当一个事务正在访问数据并且对数据进行了修改,而这种修改还没有提交到数据库中,这时另外一个事务也访问了这个数据,因为这个数据是还没有提交的数据,那么另外一个事务读到的这个数据是“脏数据”,依据“脏数据”所做的操作可能是不正确的。</p>
|
||
<p>第二是不可重复读:比如在一个事务内多次读同一数据。在这个事务还没有结束时,另一个事务也访问该数据。那么,在第一个事务中的两次读数据之间,由于第二个事务的修改导致第一个事务两次读取的数据可能不太一样。这就发生了在一个事务内两次读到的数据是不一样的情况,因此称为不可重复读。</p>
|
||
<p>第三是幻读(Phantom read):幻读与不可重复读类似。它发生在一个事务(T1)读取了几行数据,接着另一个并发事务(T2)插入了一些数据时。在随后的查询中,第一个事务(T1)就会发现多了一些原本不存在的记录,就好像发生了幻觉一样,所以称为幻读。</p>
|
||
<p><img src="/pictures/image-20230511172226172.png" alt="image-20230511172226172"></p>
|
||
<p><strong>面试官</strong>:怎么解决这些问题呢?MySQL的默认隔离级别是?</p>
|
||
<p><strong>候选人</strong>:解决方案是对事务进行隔离</p>
|
||
<p>MySQL支持四种隔离级别,分别有:</p>
|
||
<p>第一个是,未提交读(read uncommitted)它解决不了刚才提出的所有问题,一般项目中也不用这个。第二个是读已提交(read committed)它能解决脏读的问题的,但是解决不了不可重复读和幻读。第三个是可重复读(repeatable read)它能解决脏读和不可重复读,但是解决不了幻读,这个也是mysql默认的隔离级别。第四个是串行化(serializable)它可以解决刚才提出来的所有问题,但是由于让是事务串行执行的,性能比较低。所以,我们一般使用的都是mysql默认的隔离级别:可重复读</p>
|
||
<p><img src="/pictures/image-20230511172259204.png" alt="image-20230511172259204"></p>
|
||
<p><strong>面试官</strong>:undo log和redo log的区别</p>
|
||
<p><strong>候选人</strong>:好的,其中redo log日志记录的是数据页的物理变化,服务宕机可用来同步数据,而undo log 不同,它主要记录的是逻辑日志,当事务回滚时,通过逆操作恢复原来的数据,比如我们删除一条数据的时候,就会在undo log日志文件中新增一条delete语句,如果发生回滚就执行逆操作;</p>
|
||
<p>redo log保证了事务的持久性,undo log保证了事务的原子性和一致性</p>
|
||
<p><strong>面试官</strong>:事务中的隔离性是如何保证的呢?(你解释一下MVCC)</p>
|
||
<p><strong>候选人</strong>:事务的隔离性是由锁和mvcc实现的。</p>
|
||
<p>其中mvcc的意思是多版本并发控制。指维护一个数据的多个版本,使得读写操作没有冲突,它的底层实现主要是分为了三个部分,第一个是隐藏字段,第二个是undo log日志,第三个是readView读视图</p>
|
||
<p>隐藏字段是指:在mysql中给每个表都设置了隐藏字段,有一个是trx_id(事务id),记录每一次操作的事务id,是自增的;另一个字段是roll_pointer(回滚指针),指向上一个版本的事务版本记录地址</p>
|
||
<p>undo log主要的作用是记录回滚日志,存储老版本数据,在内部会形成一个版本链,在多个事务并行操作某一行记录,记录不同事务修改数据的版本,通过roll_pointer指针形成一个链表</p>
|
||
<p>readView解决的是一个事务查询选择版本的问题,在内部定义了一些匹配规则和当前的一些事务id判断该访问那个版本的数据,不同的隔离级别快照读是不一样的,最终的访问的结果不一样。如果是rc隔离级别,每一次执行快照读时生成ReadView,如果是rr隔离级别仅在事务中第一次执行快照读时生成ReadView,后续复用</p>
|
||
<p><strong>面试官</strong>:MySQL主从同步原理 </p>
|
||
<p><strong>候选人</strong>:MySQL主从复制的核心就是二进制日志(DDL(数据定义语言)语句和 DML(数据操纵语言)语句),它的步骤是这样的:</p>
|
||
<p>第一:主库在事务提交时,会把数据变更记录在二进制日志文件 Binlog 中。</p>
|
||
<p>第二:从库读取主库的二进制日志文件 Binlog ,写入到从库的中继日志 Relay Log 。</p>
|
||
<p>第三:从库重做中继日志中的事件,将改变反映它自己的数据</p>
|
||
<p><strong>面试官</strong>:你们项目用过MySQL的分库分表吗?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,因为我们都是微服务开发,每个微服务对应了一个数据库,是根据业务进行拆分的,这个其实就是垂直拆分。</p>
|
||
<p><strong>面试官</strong>:那你之前使用过水平分库吗?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,这个是使用过的,我们当时的业务是(xxx),一开始,我们也是单库,后来这个业务逐渐发展,业务量上来的很迅速,其中(xx)表已经存放了超过1000万的数据,我们做了很多优化也不好使,性能依然很慢,所以当时就使用了水平分库。</p>
|
||
<p>我们一开始先做了3台服务器对应了3个数据库,由于库多了,需要分片,我们当时采用的mycat来作为数据库的中间件。数据都是按照id(自增)取模的方式来存取的。</p>
|
||
<p>当然一开始的时候,那些旧数据,我们做了一些清洗的工作,我们也是按照id取模规则分别存储到了各个数据库中,好处就是可以让各个数据库分摊存储和读取的压力,解决了我们当时性能的问题</p>
|
||
</blockquote>
|
||
<h2 id="3-框架篇"><a href="#3-框架篇" class="headerlink" title="3.框架篇"></a>3.框架篇</h2><blockquote>
|
||
<p><strong>面试官</strong>:Spring框架中的单例bean是线程安全的吗?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯!</p>
|
||
<p>不是线程安全的,是这样的</p>
|
||
<p>当多用户同时请求一个服务时,容器会给每一个请求分配一个线程,这是多个线程会并发执行该请求对应的业务逻辑(成员方法),如果该处理逻辑中有对该单列状态的修改(体现为该单例的成员属性),则必须考虑线程同步问题。</p>
|
||
<p>Spring框架并没有对单例bean进行任何多线程的封装处理。关于单例bean的线程安全和并发问题需要开发者自行去搞定。</p>
|
||
<p>比如:我们通常在项目中使用的Spring bean都是不可可变的状态(比如Service类和DAO类),所以在某种程度上说Spring的单例bean是线程安全的。</p>
|
||
<p>如果你的bean有多种状态的话(比如 View Model对象),就需要自行保证线程安全。最浅显的解决办法就是将多态bean的作用由“<strong>singleton</strong>”变更为“<strong>prototype</strong>”。</p>
|
||
<p><strong>面试官</strong>:什么是AOP</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>aop是面向切面编程,在spring中用于将那些与业务无关,但却对多个对象产生影响的公共行为和逻辑,抽取公共模块复用,降低耦合,一般比如可以做为公共日志保存,事务处理等</p>
|
||
<p><strong>面试官</strong>:你们项目中有没有使用到AOP</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>我们当时在后台管理系统中,就是使用aop来记录了系统的操作日志</p>
|
||
<p>主要思路是这样的,使用aop中的环绕通知+切点表达式,这个表达式就是要找到要记录日志的方法,然后通过环绕通知的参数获取请求方法的参数,比如类信息、方法信息、注解、请求方式等,获取到这些参数以后,保存到数据库</p>
|
||
<p><strong>面试官</strong>:Spring中的事务是如何实现的</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>spring实现的事务本质就是aop完成,对方法前后进行拦截,在执行方法之前开启事务,在执行完目标方法之后根据执行情况提交或者回滚事务。</p>
|
||
<p><strong>面试官</strong>:Spring中事务失效的场景有哪些</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯!这个在项目中之前遇到过,我想想啊</p>
|
||
<p>第一个,如果方法上异常捕获处理,自己处理了异常,没有抛出,就会导致事务失效,所以一般处理了异常以后,别忘了跑出去就行了</p>
|
||
<p>第二个,如果方法抛出检查异常,如果报错也会导致事务失效,最后在spring事务的注解上,就是@Transactional上配置rollbackFor属性为Exception,这样别管是什么异常,都会回滚事务</p>
|
||
<p>第三,我之前还遇到过一个,如果方法上不是public修饰的,也会导致事务失效</p>
|
||
<p>嗯,就能想起来那么多</p>
|
||
<p><strong>面试官</strong>:Spring的bean的生命周期</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯!,这个步骤还是挺多的,我之前看过一些源码,它大概流程是这样的</p>
|
||
<p>首先会通过一个非常重要的类,叫做BeanDefinition获取bean的定义信息,这里面就封装了bean的所有信息,比如,类的全路径,是否是延迟加载,是否是单例等等这些信息</p>
|
||
<p>在创建bean的时候,第一步是调用构造函数实例化bean</p>
|
||
<p>第二步是bean的依赖注入,比如一些set方法注入,像平时开发用的@Autowire都是这一步完成</p>
|
||
<p>第三步是处理Aware接口,如果某一个bean实现了Aware接口就会重写方法执行</p>
|
||
<p>第四步是bean的后置处理器BeanPostProcessor,这个是前置处理器</p>
|
||
<p>第五步是初始化方法,比如实现了接口InitializingBean或者自定义了方法init-method标签或@PostContruct</p>
|
||
<p>第六步是执行了bean的后置处理器BeanPostProcessor,主要是对bean进行增强,有可能在这里产生代理对象</p>
|
||
<p>最后一步是销毁bean</p>
|
||
<p><strong>面试官</strong>:Spring中的循环引用</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,好的,我来解释一下</p>
|
||
<p>循环依赖:循环依赖其实就是循环引用,也就是两个或两个以上的bean互相持有对方,最终形成闭环。比如A依赖于B,B依赖于A</p>
|
||
<p>循环依赖在spring中是允许存在,spring框架依据三级缓存已经解决了大部分的循环依赖</p>
|
||
<p>①一级缓存:单例池,缓存已经经历了完整的生命周期,已经初始化完成的bean对象</p>
|
||
<p>②二级缓存:缓存早期的bean对象(生命周期还没走完)</p>
|
||
<p>③三级缓存:缓存的是ObjectFactory,表示对象工厂,用来创建某个对象的</p>
|
||
<p><strong>面试官</strong>:那具体解决流程清楚吗?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>第一,先实例A对象,同时会创建ObjectFactory对象存入三级缓存singletonFactories</p>
|
||
<p>第二,A在初始化的时候需要B对象,这个走B的创建的逻辑</p>
|
||
<p>第三,B实例化完成,也会创建ObjectFactory对象存入三级缓存singletonFactories</p>
|
||
<p>第四,B需要注入A,通过三级缓存中获取ObjectFactory来生成一个A的对象同时存入二级缓存,这个是有两种情况,一个是可能是A的普通对象,另外一个是A的代理对象,都可以让ObjectFactory来生产对应的对象,这也是三级缓存的关键</p>
|
||
<p>第五,B通过从通过二级缓存earlySingletonObjects 获得到A的对象后可以正常注入,B创建成功,存入一级缓存singletonObjects</p>
|
||
<p>第六,回到A对象初始化,因为B对象已经创建完成,则可以直接注入B,A创建成功存入一次缓存singletonObjects</p>
|
||
<p>第七,二级缓存中的临时对象A清除</p>
|
||
<p><strong>面试官</strong>:构造方法出现了循环依赖怎么解决?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>由于bean的生命周期中构造函数是第一个执行的,spring框架并不能解决构造函数的的依赖注入,可以使用@Lazy懒加载,什么时候需要对象再进行bean对象的创建</p>
|
||
<p><strong>面试官</strong>:SpringMVC的执行流程知道嘛</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,这个知道的,它分了好多步骤</p>
|
||
<p>1、用户发送出请求到前端控制器DispatcherServlet,这是一个调度中心</p>
|
||
<p>2、DispatcherServlet收到请求调用HandlerMapping(处理器映射器)。</p>
|
||
<p>3、HandlerMapping找到具体的处理器(可查找xml配置或注解配置),生成处理器对象及处理器拦截器(如果有),再一起返回给DispatcherServlet。</p>
|
||
<p>4、DispatcherServlet调用HandlerAdapter(处理器适配器)。</p>
|
||
<p>5、HandlerAdapter经过适配调用具体的处理器(Handler/Controller)。</p>
|
||
<p>6、Controller执行完成返回ModelAndView对象。</p>
|
||
<p>7、HandlerAdapter将Controller执行结果ModelAndView返回给DispatcherServlet。</p>
|
||
<p>8、DispatcherServlet将ModelAndView传给ViewReslover(视图解析器)。</p>
|
||
<p>9、ViewReslover解析后返回具体View(视图)。</p>
|
||
<p>10、DispatcherServlet根据View进行渲染视图(即将模型数据填充至视图中)。</p>
|
||
<p>11、DispatcherServlet响应用户。</p>
|
||
<p>当然现在的开发,基本都是前后端分离的开发的,并没有视图这些,一般都是handler中使用Response直接结果返回</p>
|
||
<p><strong>面试官</strong>:Springboot自动配置原理</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,好的,它是这样的。</p>
|
||
<p>在Spring Boot项目中的引导类上有一个注解@SpringBootApplication,这个注解是对三个注解进行了封装,分别是:</p>
|
||
<ul>
|
||
<li>@SpringBootConfiguration</li>
|
||
<li>@EnableAutoConfiguration</li>
|
||
<li>@ComponentScan</li>
|
||
</ul>
|
||
<p>其中<code>@EnableAutoConfiguration</code>是实现自动化配置的核心注解。</p>
|
||
<p>该注解通过<code>@Import</code>注解导入对应的配置选择器。关键的是内部就是读取了该项目和该项目引用的Jar包的的classpath路径下<strong>META-INF/spring.factories</strong>文件中的所配置的类的全类名。</p>
|
||
<p>在这些配置类中所定义的Bean会根据条件注解所<strong>指定的条件来决定</strong>是否需要将其导入到Spring容器中。</p>
|
||
<p>一般条件判断会有像<code>@ConditionalOnClass</code>这样的注解,判断是否有对应的class文件,如果有则加载该类,把这个配置类的所有的Bean放入spring容器中使用。</p>
|
||
<p><strong>面试官</strong>:Spring 的常见注解有哪些?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,这个就很多了</p>
|
||
<p>第一类是:声明bean,有@Component、@Service、@Repository、@Controller</p>
|
||
<p>第二类是:依赖注入相关的,有@Autowired、@Qualifier、@Resourse</p>
|
||
<p>第三类是:设置作用域 @Scope</p>
|
||
<p>第四类是:spring配置相关的,比如@Configuration,@ComponentScan 和 @Bean</p>
|
||
<p>第五类是:跟aop相关做增强的注解 @Aspect,@Before,@After,@Around,@Pointcut</p>
|
||
<p><strong>面试官</strong>:SpringMVC常见的注解有哪些?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,这个也很多的</p>
|
||
<p>有@RequestMapping:用于映射请求路径;</p>
|
||
<p>@RequestBody:注解实现接收http请求的json数据,将json转换为java对象;</p>
|
||
<p>@RequestParam:指定请求参数的名称;</p>
|
||
<p>@PathViriable:从请求路径下中获取请求参数(/user/{id}),传递给方法的形式参数;@ResponseBody:注解实现将controller方法返回对象转化为json对象响应给客户端。@RequestHeader:获取指定的请求头数据,还有像@PostMapping、@GetMapping这些。</p>
|
||
<p><strong>面试官</strong>:Springboot常见注解有哪些?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯~~</p>
|
||
<p>Spring Boot的核心注解是@SpringBootApplication , 他由几个注解组成 :</p>
|
||
<ul>
|
||
<li>@SpringBootConfiguration: 组合了- @Configuration注解,实现配置文件的功能;</li>
|
||
<li>@EnableAutoConfiguration:打开自动配置的功能,也可以关闭某个自动配置的选项</li>
|
||
<li>@ComponentScan:Spring组件扫描</li>
|
||
</ul>
|
||
<p><strong>面试官</strong>:MyBatis执行流程</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>好,这个知道的,不过步骤也很多</p>
|
||
<p>①读取MyBatis配置文件:mybatis-config.xml加载运行环境和映射文件</p>
|
||
<p>②构造会话工厂SqlSessionFactory,一个项目只需要一个,单例的,一般由spring进行管理</p>
|
||
<p>③会话工厂创建SqlSession对象,这里面就含了执行SQL语句的所有方法</p>
|
||
<p>④操作数据库的接口,Executor执行器,同时负责查询缓存的维护</p>
|
||
<p>⑤Executor接口的执行方法中有一个MappedStatement类型的参数,封装了映射信息</p>
|
||
<p>⑥输入参数映射</p>
|
||
<p>⑦输出结果映射</p>
|
||
<p><strong>面试官</strong>:Mybatis是否支持延迟加载?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>是支持的~</p>
|
||
<p>延迟加载的意思是:就是在需要用到数据时才进行加载,不需要用到数据时就不加载数据。</p>
|
||
<p>Mybatis支持一对一关联对象和一对多关联集合对象的延迟加载</p>
|
||
<p>在Mybatis配置文件中,可以配置是否启用延迟加载lazyLoadingEnabled=true|false,默认是关闭的</p>
|
||
<p><strong>面试官</strong>:延迟加载的底层原理知道吗?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,我想想啊</p>
|
||
<p>延迟加载在底层主要使用的CGLIB动态代理完成的</p>
|
||
<p>第一是,使用CGLIB创建目标对象的代理对象,这里的目标对象就是开启了延迟加载的mapper</p>
|
||
<p>第二个是当调用目标方法时,进入拦截器invoke方法,发现目标方法是null值,再执行sql查询</p>
|
||
<p>第三个是获取数据以后,调用set方法设置属性值,再继续查询目标方法,就有值了</p>
|
||
<p><strong>面试官</strong>:Mybatis的一级、二级缓存用过吗?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯~~,用过的~</p>
|
||
<p>mybatis的一级缓存: 基于 PerpetualCache 的 HashMap 本地缓存,其存储作用域为 Session,当Session进行flush或close之后,该Session中的所有Cache就将清空,默认打开一级缓存</p>
|
||
<p>关于二级缓存需要单独开启</p>
|
||
<p>二级缓存是基于namespace和mapper的作用域起作用的,不是依赖于SQL session,默认也是采用 PerpetualCache,HashMap 存储。</p>
|
||
<p>如果想要开启二级缓存需要在全局配置文件和映射文件中开启配置才行。</p>
|
||
<p><strong>面试官</strong>:Mybatis的二级缓存什么时候会清理缓存中的数据</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯!!</p>
|
||
<p>当某一个作用域(一级缓存 Session/二级缓存Namespaces)的进行了新增、修改、删除操作后,默认该作用域下所有 select 中的缓存将被 clear。</p>
|
||
</blockquote>
|
||
<h2 id="4-微服务篇"><a href="#4-微服务篇" class="headerlink" title="4.微服务篇"></a>4.微服务篇</h2><blockquote>
|
||
<p><strong>面试官:</strong>Spring Cloud 5大组件有哪些?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>早期我们一般认为的Spring Cloud五大组件是</p>
|
||
<ul>
|
||
<li>Eureka : 注册中心</li>
|
||
<li>Ribbon : 负载均衡</li>
|
||
<li>Feign : 远程调用</li>
|
||
<li>Hystrix : 服务熔断</li>
|
||
<li>Zuul/Gateway : 网关</li>
|
||
</ul>
|
||
<p>随着SpringCloudAlibba在国内兴起 , 我们项目中使用了一些阿里巴巴的组件</p>
|
||
<ul>
|
||
<li>注册中心/配置中心 Nacos</li>
|
||
<li>负载均衡 Ribbon</li>
|
||
<li>服务调用 Feign</li>
|
||
<li>服务保护 sentinel</li>
|
||
<li>服务网关 Gateway</li>
|
||
</ul>
|
||
<p><strong>面试官:</strong>服务注册和发现是什么意思?Spring Cloud 如何实现服务注册发现?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>我理解的是主要三块大功能,分别是服务注册 、服务发现、服务状态监控</p>
|
||
<p>我们当时项目采用的eureka作为注册中心,这个也是spring cloud体系中的一个核心组件</p>
|
||
<p><strong>服务注册</strong>:服务提供者需要把自己的信息注册到eureka,由eureka来保存这些信息,比如服务名称、ip、端口等等</p>
|
||
<p><strong>服务发现</strong>:消费者向eureka拉取服务列表信息,如果服务提供者有集群,则消费者会利用负载均衡算法,选择一个发起调用</p>
|
||
<p><strong>服务监控</strong>:服务提供者会每隔30秒向eureka发送心跳,报告健康状态,如果eureka服务90秒没接收到心跳,从eureka中剔除</p>
|
||
<p><strong>面试官:</strong>我看你之前也用过nacos、你能说下nacos与eureka的区别?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>我们当时xx项目就是采用的nacos作为注册中心,选择nacos还要一个重要原因就是它支持配置中心,不过nacos作为注册中心,也比eureka要方便好用一些,主要相同不同点在于几点:</p>
|
||
<ul>
|
||
<li>共同点</li>
|
||
</ul>
|
||
<p>Nacos与eureka都支持服务注册和服务拉取,都支持服务提供者心跳方式做健康检测</p>
|
||
<ul>
|
||
<li>Nacos与Eureka的区别</li>
|
||
</ul>
|
||
<p>①Nacos支持服务端主动检测提供者状态:临时实例采用心跳模式,非临时实例采用主动检测模式</p>
|
||
<p>②临时实例心跳不正常会被剔除,非临时实例则不会被剔除</p>
|
||
<p>③Nacos支持服务列表变更的消息推送模式,服务列表更新更及时</p>
|
||
<p>④Nacos集群默认采用AP方式,当集群中存在非临时实例时,采用CP模式;Eureka采用AP方式</p>
|
||
<p><strong>面试官:</strong>你们项目负载均衡如何实现的 ?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>是这样~~</p>
|
||
<p>在服务调用过程中的负载均衡一般使用SpringCloud的Ribbon 组件实现 , Feign的底层已经自动集成了Ribbon , 使用起来非常简单</p>
|
||
<p>当发起远程调用时,ribbon先从注册中心拉取服务地址列表,然后按照一定的路由策略选择一个发起远程调用,一般的调用策略是轮询</p>
|
||
<p><strong>面试官:</strong>Ribbon负载均衡策略有哪些 ?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>我想想啊,有很多种,我记得几个:</p>
|
||
<ul>
|
||
<li>RoundRobinRule:简单轮询服务列表来选择服务器</li>
|
||
<li>WeightedResponseTimeRule:按照权重来选择服务器,响应时间越长,权重越小</li>
|
||
<li>RandomRule:随机选择一个可用的服务器</li>
|
||
<li>ZoneAvoidanceRule:区域敏感策略,以区域可用的服务器为基础进行服务器的选择。使用Zone对服务器进行分类,这个Zone可以理解为一个机房、一个机架等。而后再对Zone内的多个服务做轮询(默认)</li>
|
||
</ul>
|
||
<p><strong>面试官:</strong>如果想自定义负载均衡策略如何实现 ?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>提供了两种方式:</p>
|
||
<p>1,创建类实现IRule接口,可以指定负载均衡策略,这个是全局的,对所有的远程调用都起作用</p>
|
||
<p>2,在客户端的配置文件中,可以配置某一个服务调用的负载均衡策略,只是对配置的这个服务生效远程调用</p>
|
||
<p><strong>面试官:</strong>什么是服务雪崩,怎么解决这个问题?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>服务雪崩是指一个服务失败,导致整条链路的服务都失败的情形,一般我们在项目解决的话就是两种方案,第一个是服务降级,第二个是服务熔断,如果流量太大的话,可以考虑限流</p>
|
||
<p>服务降级:服务自我保护的一种方式,或者保护下游服务的一种方式,用于确保服务不会受请求突增影响变得不可用,确保服务不会崩溃,一般在实际开发中与feign接口整合,编写降级逻辑</p>
|
||
<p>服务熔断:默认关闭,需要手动打开,如果检测到 10 秒内请求的失败率超过 50%,就触发熔断机制。之后每隔 5 秒重新尝试请求微服务,如果微服务不能响应,继续走熔断机制。如果微服务可达,则关闭熔断机制,恢复正常请求</p>
|
||
<p><strong>面试官:</strong>你们的微服务是怎么监控的?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>我们项目中采用的skywalking进行监控的</p>
|
||
<p>1,skywalking主要可以监控接口、服务、物理实例的一些状态。特别是在压测的时候可以看到众多服务中哪些服务和接口比较慢,我们可以针对性的分析和优化。</p>
|
||
<p>2,我们还在skywalking设置了告警规则,特别是在项目上线以后,如果报错,我们分别设置了可以给相关负责人发短信和发邮件,第一时间知道项目的bug情况,第一时间修复</p>
|
||
<p><strong>面试官:</strong>你们项目中有没有做过限流 ? 怎么做的 ?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>我当时做的xx项目,采用就是微服务的架构,因为xx因为,应该会有突发流量,最大QPS可以达到2000,但是服务支撑不住,我们项目都通过压测最多可以支撑1200QPS。因为我们平时的QPS也就不到100,为了解决这些突发流量,所以采用了限流。</p>
|
||
<p>【版本1】</p>
|
||
<p>我们当时采用的nginx限流操作,nginx使用的漏桶算法来实现过滤,让请求以固定的速率处理请求,可以应对突发流量,我们控制的速率是按照ip进行限流,限制的流量是每秒20</p>
|
||
<p>【版本2】</p>
|
||
<p>我们当时采用的是spring cloud gateway中支持局部过滤器RequestRateLimiter来做限流,使用的是令牌桶算法,可以根据ip或路径进行限流,可以设置每秒填充平均速率,和令牌桶总容量</p>
|
||
<p><strong>面试官:</strong>限流常见的算法有哪些呢?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>比较常见的限流算法有漏桶算法和令牌桶算法</p>
|
||
<p>漏桶算法是把请求存入到桶中,以固定速率从桶中流出,可以让我们的服务做到绝对的平均,起到很好的限流效果</p>
|
||
<p>令牌桶算法在桶中存储的是令牌,按照一定的速率生成令牌,每个请求都要先申请令牌,申请到令牌以后才能正常请求,也可以起到很好的限流作用</p>
|
||
<p>它们的区别是,漏桶和令牌桶都可以处理突发流量,其中漏桶可以做到绝对的平滑,令牌桶有可能会产生突发大量请求的情况,一般nginx限流采用的漏桶,spring cloud gateway中可以支持令牌桶算法</p>
|
||
<p><strong>面试官</strong>:什么是CAP理论?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>CAP主要是在分布式项目下的一个理论。包含了三项,一致性、可用性、分区容错性</p>
|
||
<ul>
|
||
<li>一致性(Consistency)是指更新操作成功并返回客户端完成后,所有节点在同一时间的数据完全一致(强一致性),不能存在中间状态。</li>
|
||
<li>可用性(Availability) 是指系统提供的服务必须一直处于可用的状态,对于用户的每一个操作请求总是能够在有限的时间内返回结果。</li>
|
||
<li>分区容错性(Partition tolerance) 是指分布式系统在遇到任何网络分区故障时,仍然需要能够保证对外提供满足一致性和可用性的服务,除非是整个网络环境都发生了故障。</li>
|
||
</ul>
|
||
<p><strong>面试官</strong>:为什么分布式系统中无法同时保证一致性和可用性?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,是这样的~~</p>
|
||
<p>首先一个前提,对于分布式系统而言,分区容错性是一个最基本的要求,因此基本上我们在设计分布式系统的时候只能从一致性(C)和可用性(A)之间进行取舍。</p>
|
||
<p>如果保证了一致性(C):对于节点N1和N2,当往N1里写数据时,N2上的操作必须被暂停,只有当N1同步数据到N2时才能对N2进行读写请求,在N2被暂停操作期间客户端提交的请求会收到失败或超时。显然,这与可用性是相悖的。</p>
|
||
<p>如果保证了可用性(A):那就不能暂停N2的读写操作,但同时N1在写数据的话,这就违背了一致性的要求。</p>
|
||
<p><strong>面试官</strong>:什么是BASE理论?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,这个也是CAP分布式系统设计理论</p>
|
||
<p>BASE是CAP理论中AP方案的延伸,核心思想是即使无法做到强一致性(StrongConsistency,CAP的一致性就是强一致性),但应用可以采用适合的方式达到最终一致性(Eventual Consitency)。它的思想包含三方面:</p>
|
||
<p>1、Basically Available(基本可用):基本可用是指分布式系统在出现不可预知的故障的时候,允许损失部分可用性,但不等于系统不可用。</p>
|
||
<p>2、Soft state(软状态):即是指允许系统中的数据存在中间状态,并认为该中间状态的存在不会影响系统的整体可用性,即允许系统在不同节点的数据副本之间进行数据同步的过程存在延时。</p>
|
||
<p>3、Eventually consistent(最终一致性):强调系统中所有的数据副本,在经过一段时间的同步后,最终能够达到一个一致的状态。其本质是需要系统保证最终数据能够达到一致,而不需要实时保证系统数据的强一致性。</p>
|
||
<p><strong>面试官:</strong>你们采用哪种分布式事务解决方案?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>我们当时是xx项目,主要使用到的seata的at模式解决的分布式事务</p>
|
||
<p>seata的AT模型分为两个阶段:</p>
|
||
<p>1、阶段一RM的工作:① 注册分支事务 ② 记录undo-log(数据快照)③ 执行业务sql并提交 ④报告事务状态</p>
|
||
<p>2、阶段二提交时RM的工作:删除undo-log即可</p>
|
||
<p>3、阶段二回滚时RM的工作:根据undo-log恢复数据到更新前</p>
|
||
<p>at模式牺牲了一致性,保证了可用性,不过,它保证的是最终一致性</p>
|
||
<p><strong>面试官:</strong>分布式服务的接口幂等性如何设计?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>嗯,我们当时有一个xx项目的下单操作,采用的token+redis实现的,流程是这样的</p>
|
||
<p>第一次请求,也就是用户打开了商品详情页面,我们会发起一个请求,在后台生成一个唯一token存入redis,key就是用户的id,value就是这个token,同时把这个token返回前端</p>
|
||
<p>第二次请求,当用户点击了下单操作会后,会携带之前的token,后台先到redis进行验证,如果存在token,可以执行业务,同时删除token;如果不存在,则直接返回,不处理业务,就保证了同一个token只处理一次业务,就保证了幂等性</p>
|
||
<p><strong>面试官:</strong>xxl-job路由策略有哪些?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>xxl-job提供了很多的路由策略,我们平时用的较多就是:轮询、故障转移、分片广播…</p>
|
||
<p><strong>面试官:</strong>xxl-job任务执行失败怎么解决?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>有这么几个操作</p>
|
||
<p>第一:路由策略选择故障转移,优先使用健康的实例来执行任务</p>
|
||
<p>第二,如果还有失败的,我们在创建任务时,可以设置重试次数</p>
|
||
<p>第三,如果还有失败的,就可以查看日志或者配置邮件告警来通知相关负责人解决</p>
|
||
<p><strong>面试官:</strong>如果有大数据量的任务同时都需要执行,怎么解决?</p>
|
||
<p><strong>候选人:</strong></p>
|
||
<p>我们会让部署多个实例,共同去执行这些批量的任务,其中任务的路由策略是分片广播</p>
|
||
<p>在任务执行的代码中可以获取分片总数和当前分片,按照取模的方式分摊到各个实例执行就可以了</p>
|
||
</blockquote>
|
||
<h2 id="5-消息中间件篇"><a href="#5-消息中间件篇" class="headerlink" title="5.消息中间件篇"></a>5.消息中间件篇</h2><blockquote>
|
||
<p><strong>面试官</strong>:RabbitMQ-如何保证消息不丢失</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯!我们当时MYSQL和Redis的数据双写一致性就是采用RabbitMQ实现同步的,这里面就要求了消息的高可用性,我们要保证消息的不丢失。主要从三个层面考虑</p>
|
||
<p>第一个是开启生产者确认机制,确保生产者的消息能到达队列,如果报错可以先记录到日志中,再去修复数据</p>
|
||
<p>第二个是开启持久化功能,确保消息未消费前在队列中不会丢失,其中的交换机、队列、和消息都要做持久化</p>
|
||
<p>第三个是开启消费者确认机制为auto,由spring确认消息处理成功后完成ack,当然也需要设置一定的重试次数,我们当时设置了3次,如果重试3次还没有收到消息,就将失败后的消息投递到异常交换机,交由人工处理</p>
|
||
<p><strong>面试官</strong>:RabbitMQ消息的重复消费问题如何解决的</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,这个我们还真遇到过,是这样的,我们当时消费者是设置了自动确认机制,当服务还没来得及给MQ确认的时候,服务宕机了,导致服务重启之后,又消费了一次消息。这样就重复消费了</p>
|
||
<p>因为我们当时处理的支付(订单|业务唯一标识),它有一个业务的唯一标识,我们再处理消息时,先到数据库查询一下,这个数据是否存在,如果不存在,说明没有处理过,这个时候就可以正常处理这个消息了。如果已经存在这个数据了,就说明消息重复消费了,我们就不需要再消费了</p>
|
||
<p><strong>面试官</strong>:那你还知道其他的解决方案吗?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,我想想~</p>
|
||
<p>其实这个就是典型的幂等的问题,比如,redis分布式锁、数据库的锁都是可以的</p>
|
||
<p><strong>面试官</strong>:RabbitMQ中死信交换机 ? (RabbitMQ延迟队列有了解过嘛)</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯!了解过!</p>
|
||
<p>我们当时的xx项目有一个xx业务,需要用到延迟队列,其中就是使用RabbitMQ来实现的。</p>
|
||
<p>延迟队列就是用到了死信交换机和TTL(消息存活时间)实现的。</p>
|
||
<p>如果消息超时未消费就会变成死信,在RabbitMQ中如果消息成为死信,队列可以绑定一个死信交换机,在死信交换机上可以绑定其他队列,在我们发消息的时候可以按照需求指定TTL的时间,这样就实现了延迟队列的功能了。</p>
|
||
<p>我记得RabbitMQ还有一种方式可以实现延迟队列,在RabbitMQ中安装一个死信插件,这样更方便一些,我们只需要在声明交互机的时候,指定这个就是死信交换机,然后在发送消息的时候直接指定超时时间就行了,相对于死信交换机+TTL要省略了一些步骤</p>
|
||
<p><strong>面试官</strong>:如果有100万消息堆积在MQ , 如何解决 ?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>我在实际的开发中,没遇到过这种情况,不过,如果发生了堆积的问题,解决方案也所有很多的</p>
|
||
<p>第一:提高消费者的消费能力 ,可以使用多线程消费任务</p>
|
||
<p>第二:增加更多消费者,提高消费速度</p>
|
||
<p> 使用工作队列模式, 设置多个消费者消费消费同一个队列中的消息</p>
|
||
<p>第三:扩大队列容积,提高堆积上限</p>
|
||
<p>可以使用RabbitMQ惰性队列,惰性队列的好处主要是</p>
|
||
<p>①接收到消息后直接存入磁盘而非内存</p>
|
||
<p>②消费者要消费消息时才会从磁盘中读取并加载到内存</p>
|
||
<p>③支持数百万条的消息存储</p>
|
||
<p><strong>面试官</strong>:RabbitMQ的高可用机制有了解过嘛</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,熟悉的~</p>
|
||
<p>我们当时项目在生产环境下,使用的集群,当时搭建是镜像模式集群,使用了3台机器。</p>
|
||
<p>镜像队列结构是一主多从,所有操作都是主节点完成,然后同步给镜像节点,如果主节点宕机后,镜像节点会替代成新的主节点,不过在主从同步完成前,主节点就已经宕机,可能出现数据丢失</p>
|
||
<p><strong>面试官</strong>:那出现丢数据怎么解决呢?</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>我们可以采用仲裁队列,与镜像队列一样,都是主从模式,支持主从数据同步,主从同步基于Raft协议,强一致。</p>
|
||
<p>并且使用起来也非常简单,不需要额外的配置,在声明队列的时候只要指定这个是仲裁队列即可</p>
|
||
<p><strong>面试官</strong>:Kafka是如何保证消息不丢失</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,这个保证机制很多,在发送消息到消费者接收消息,在每个阶段都有可能会丢失消息,所以我们解决的话也是从多个方面考虑</p>
|
||
<p>第一个是生产者发送消息的时候,可以使用异步回调发送,如果消息发送失败,我们可以通过回调获取失败后的消息信息,可以考虑重试或记录日志,后边再做补偿都是可以的。同时在生产者这边还可以设置消息重试,有的时候是由于网络抖动的原因导致发送不成功,就可以使用重试机制来解决</p>
|
||
<p>第二个在broker中消息有可能会丢失,我们可以通过kafka的复制机制来确保消息不丢失,在生产者发送消息的时候,可以设置一个acks,就是确认机制。我们可以设置参数为all,这样的话,当生产者发送消息到了分区之后,不仅仅只在leader分区保存确认,在follwer分区也会保存确认,只有当所有的副本都保存确认以后才算是成功发送了消息,所以,这样设置就很大程度了保证了消息不会在broker丢失</p>
|
||
<p>第三个有可能是在消费者端丢失消息,kafka消费消息都是按照offset进行标记消费的,消费者默认是自动按期提交已经消费的偏移量,默认是每隔5s提交一次,如果出现重平衡的情况,可能会重复消费或丢失数据。我们一般都会禁用掉自动提价偏移量,改为手动提交,当消费成功以后再报告给broker消费的位置,这样就可以避免消息丢失和重复消费了</p>
|
||
<p><strong>面试官</strong>:Kafka中消息的重复消费问题如何解决的</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>kafka消费消息都是按照offset进行标记消费的,消费者默认是自动按期提交已经消费的偏移量,默认是每隔5s提交一次,如果出现重平衡的情况,可能会重复消费或丢失数据。我们一般都会禁用掉自动提价偏移量,改为手动提交,当消费成功以后再报告给broker消费的位置,这样就可以避免消息丢失和重复消费了</p>
|
||
<p>为了消息的幂等,我们也可以设置唯一主键来进行区分,或者是加锁,数据库的锁,或者是redis分布式锁,都能解决幂等的问题</p>
|
||
<p><strong>面试官</strong>:Kafka是如何保证消费的顺序性</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>kafka默认存储和消费消息,是不能保证顺序性的,因为一个topic数据可能存储在不同的分区中,每个分区都有一个按照顺序的存储的偏移量,如果消费者关联了多个分区不能保证顺序性</p>
|
||
<p>如果有这样的需求的话,我们是可以解决的,把消息都存储同一个分区下就行了,有两种方式都可以进行设置,第一个是发送消息时指定分区号,第二个是发送消息时按照相同的业务设置相同的key,因为默认情况下分区也是通过key的hashcode值来选择分区的,hash值如果一样的话,分区肯定也是一样的</p>
|
||
<p><strong>面试官</strong>:Kafka的高可用机制有了解过嘛</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,主要是有两个层面,第一个是集群,第二个是提供了复制机制</p>
|
||
<p>kafka集群指的是由多个broker实例组成,即使某一台宕机,也不耽误其他broker继续对外提供服务</p>
|
||
<p>复制机制是可以保证kafka的高可用的,一个topic有多个分区,每个分区有多个副本,有一个leader,其余的是follower,副本存储在不同的broker中;所有的分区副本的内容是都是相同的,如果leader发生故障时,会自动将其中一个follower提升为leader,保证了系统的容错性、高可用性</p>
|
||
<p><strong>面试官</strong>:解释一下复制机制中的ISR</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>ISR的意思是in-sync replica,就是需要同步复制保存的follower</p>
|
||
<p>其中分区副本有很多的follower,分为了两类,一个是ISR,与leader副本同步保存数据,另外一个普通的副本,是异步同步数据,当leader挂掉之后,会优先从ISR副本列表中选取一个作为leader,因为ISR是同步保存数据,数据更加的完整一些,所以优先选择ISR副本列表</p>
|
||
<p><strong>面试官</strong>:Kafka数据清理机制了解过嘛</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>嗯,了解过~~</p>
|
||
<p>Kafka中topic的数据存储在分区上,分区如果文件过大会分段存储segment</p>
|
||
<p>每个分段都在磁盘上以索引(xxxx.index)和日志文件(xxxx.log)的形式存储,这样分段的好处是,第一能够减少单个文件内容的大小,查找数据方便,第二方便kafka进行日志清理。</p>
|
||
<p>在kafka中提供了两个日志的清理策略:</p>
|
||
<p>第一,根据消息的保留时间,当消息保存的时间超过了指定的时间,就会触发清理,默认是168小时( 7天)</p>
|
||
<p>第二是根据topic存储的数据大小,当topic所占的日志文件大小大于一定的阈值,则开始删除最久的消息。这个默认是关闭的</p>
|
||
<p>这两个策略都可以通过kafka的broker中的配置文件进行设置</p>
|
||
<p><strong>面试官</strong>:Kafka中实现高性能的设计有了解过嘛</p>
|
||
<p><strong>候选人</strong>:</p>
|
||
<p>Kafka 高性能,是多方面协同的结果,包括宏观架构、分布式存储、ISR 数据同步、以及高效的利用磁盘、操作系统特性等。主要体现有这么几点:</p>
|
||
<p>消息分区:不受单台服务器的限制,可以不受限的处理更多的数据</p>
|
||
<p>顺序读写:磁盘顺序读写,提升读写效率</p>
|
||
<p>页缓存:把磁盘中的数据缓存到内存中,把对磁盘的访问变为对内存的访问</p>
|
||
<p>零拷贝:减少上下文切换及数据拷贝</p>
|
||
<p>消息压缩:减少磁盘IO和网络IO</p>
|
||
<p>分批发送:将消息打包批量发送,减少网络开销</p>
|
||
</blockquote>
|
||
]]></content>
|
||
<categories>
|
||
<category>面试</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>面试</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>前端基础知识</title>
|
||
<url>/posts/432.html</url>
|
||
<content><![CDATA[<h1 id="一-VSCode的使用"><a href="#一-VSCode的使用" class="headerlink" title="一.VSCode的使用"></a>一.VSCode的使用</h1><h2 id="常用插件"><a href="#常用插件" class="headerlink" title="常用插件"></a>常用插件</h2><p><img src="/pictures/image-20230521233651126.png" alt="image-20230521233651126"></p>
|
||
<h1 id="二-ES6"><a href="#二-ES6" class="headerlink" title="二. ES6"></a>二. ES6</h1><p><a href="https://www.runoob.com/w3cnote/es6-tutorial.html">菜鸟ES6教程教程</a></p>
|
||
<h2 id="1-简介"><a href="#1-简介" class="headerlink" title="1.简介"></a>1.简介</h2><p> ES6, 全称 ECMAScript 6.0 ,是 JavaScript 的下一个版本标准,2015.06 发版。ES6 主要是为了解决 ES5 的先天不足,比如 JavaScript 里并没有类的概念,但是目前浏览器的 JavaScript 是 ES5 版本,大多数高版本的浏览器也支持 ES6,不过只实现了 ES6 的部分特性和功能。</p>
|
||
<h2 id="2-基础语法"><a href="#2-基础语法" class="headerlink" title="2.基础语法"></a>2.基础语法</h2><img src="/pictures/es6-tutorial.jpg" alt="img" style="zoom:150%;" />
|
||
|
||
<h3 id="2-1-声明变量"><a href="#2-1-声明变量" class="headerlink" title="2.1 声明变量"></a>2.1 声明变量</h3><ul>
|
||
<li>let 声明的变量有严格的作用域 var没有严格的作用域</li>
|
||
<li>let变量只能声明一次</li>
|
||
<li>let不存在变量提升 var存在变量提升(先使用后声明)</li>
|
||
<li>const声明的是常量,不能重新赋值</li>
|
||
<li>总计:使用let声明变量</li>
|
||
</ul>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>声明变量<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//1.有严格的作用域</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//var 声明的变量往往会越域</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//let 声明的变量有严格的作用域</span></span></span><br><span class="line"><span class="language-javascript"> {</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">var</span> a = <span class="number">1</span>;</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> b = <span class="number">1</span>;</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(a) <span class="comment">//不会报错</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(b) <span class="comment">//ReferenceError: b is not defined,有严格的作用域,所以会报错</span></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//2.let的变量只能声明一次</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">var</span> m = <span class="number">1</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">var</span> m = <span class="number">2</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> n = <span class="number">3</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">// let n = 4</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(m) <span class="comment">//不会报错</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(n) <span class="comment">//Identifier 'n' has already been declared 不能声明两次</span></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//3.let不存在变量提升 var存在变量提升</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>,<span class="title function_">log</span>(x)</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">var</span> x = <span class="number">10</span>; <span class="comment">//这里不会报错,可以先使用后定义</span></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//4.const声明的是常量,不能重新赋值</span></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//总计:使用let声明变量</span></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-2-解构表达式和模板字符串"><a href="#2-2-解构表达式和模板字符串" class="headerlink" title="2.2 解构表达式和模板字符串"></a>2.2 解构表达式和模板字符串</h3><ul>
|
||
<li>数组的解构</li>
|
||
<li>对象的解构</li>
|
||
<li>字符串API的扩展</li>
|
||
<li>模板字符串</li>
|
||
</ul>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>解构表达式<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//解构表达式</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//1.原始的数组的赋值方式</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> arr = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">// let a = arr[0]</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">// let b = arr[1]</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">// let c = arr[2]</span></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//2.使用解构表达式给数组赋值(数组解构)</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> [a, b, c] = arr;</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(a, b, c);</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//3.使用解构表达式给对象赋值(对象解构)</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">const</span> person = {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">name</span>: <span class="string">"jack"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">age</span>: <span class="number">21</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">language</span>: [<span class="string">'java'</span>, <span class="string">'js'</span>, <span class="string">'css'</span>]</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//原始的赋值方式</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">// const name = person.name</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">// const age = person.age</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">// const language = person.language</span></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//使用解构赋值(对象解构)</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//const { name, age, language } = person</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//更换属性名</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">const</span> { <span class="attr">name</span>: abc, age, language } = person</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//将属性名name更换为abc</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(abc, age, language)</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//4.字符串扩展</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//几个新的字符串API</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> str = <span class="string">"hello.vue"</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//是不是以什么开头</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(str.<span class="title function_">startsWith</span>(<span class="string">"hello"</span>));<span class="comment">//true</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//是不是以什么结束</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(str.<span class="title function_">endsWith</span>(<span class="string">".vue"</span>));<span class="comment">//true</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//是不是包含什么</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(str.<span class="title function_">includes</span>(<span class="string">"e"</span>));<span class="comment">//true</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(str.<span class="title function_">includes</span>(<span class="string">"hello"</span>));<span class="comment">//true</span></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//5.模板字符串</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//${}插值</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> name = <span class="string">"Tom"</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> result = <span class="string">`你好<span class="subst">${name}</span>`</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(result)</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//可以直接调用字符串的返回值组成一个新的字符串</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">function</span> <span class="title function_">fun</span>(<span class="params"></span>){</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">return</span> <span class="string">"这是一个函数"</span></span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> result = <span class="string">`你好<span class="subst">${name}</span>,我想说:<span class="subst">${fun()}</span>`</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(result)</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-3-函数优化"><a href="#2-3-函数优化" class="headerlink" title="2.3 函数优化"></a>2.3 函数优化</h3><ul>
|
||
<li>默认初始值</li>
|
||
<li>不定参数</li>
|
||
<li>箭头函数</li>
|
||
</ul>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>函数优化<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//1.函数优化</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//在ES6以前,我们无法给一个函数参数设置默认值,只能采用变通的写法</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">function</span> <span class="title function_">add</span>(<span class="params">a, b</span>) {</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//判断b是否为空 如果为空就给默认值1</span></span></span><br><span class="line"><span class="language-javascript"> b = b || <span class="number">1</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">return</span> a + b</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//传一个参数</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="title function_">add</span>(<span class="number">10</span>)) <span class="comment">//结果是11</span></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//优化后 直接在参数上写上默认的值 如果没有传就会自动使用默认值</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">function</span> <span class="title function_">add2</span>(<span class="params">a, b = <span class="number">1</span></span>) {</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">return</span> a + b</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="title function_">add2</span>(<span class="number">20</span>)) <span class="comment">//结果是21</span></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//2.不定参数 类似于java里面的可变形参</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">function</span> <span class="title function_">fun</span>(<span class="params">...values</span>) {</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(values.<span class="property">length</span>)</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> <span class="title function_">fun</span>(<span class="number">1</span>, <span class="number">2</span>)</span></span><br><span class="line"><span class="language-javascript"> <span class="title function_">fun</span>(<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>)</span></span><br><span class="line"><span class="language-javascript"> <span class="title function_">fun</span>(<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>)</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//3.箭头函数</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//以前的声明方法</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">var</span> print = <span class="keyword">function</span> (<span class="params">obj</span>) {</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(obj)</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">var</span> <span class="title function_">print1</span> = obj => <span class="variable language_">console</span>.<span class="title function_">log</span>(obj)</span></span><br><span class="line"><span class="language-javascript"> <span class="title function_">print1</span>(<span class="string">"hello"</span>) <span class="comment">//输出hello</span></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//求两数之和</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//以前的方法</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">var</span> sum = <span class="keyword">function</span> (<span class="params">a, b</span>) {</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">return</span> a + b</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//使用箭头函数</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">var</span> <span class="title function_">sum2</span> = (<span class="params">a, b</span>) => a + b <span class="comment">//方法体中只有一行代码 不用写return</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="title function_">sum2</span>(<span class="number">11</span>, <span class="number">3</span>))</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">var</span> <span class="title function_">sum3</span> = (<span class="params">a, b</span>) => {<span class="comment">//方法体中有多行代码 写法如下</span></span></span><br><span class="line"><span class="language-javascript"> c = a + b;</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">return</span> a + c</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="title function_">sum3</span>(<span class="number">11</span>, <span class="number">3</span>))</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//复杂一点的箭头函数</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">const</span> person = {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">name</span>: <span class="string">"jack"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">age</span>: <span class="number">21</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">language</span>: [<span class="string">'java'</span>, <span class="string">'js'</span>, <span class="string">'css'</span>]</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//原始的方法</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">function</span> <span class="title function_">hello</span>(<span class="params">person</span>) {</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">"hello "</span> + person.<span class="property">name</span>)</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//单纯的箭头函数</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">var</span> <span class="title function_">hello2</span> = (<span class="params">obj</span>) => <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">"hello,"</span> + obj.<span class="property">name</span>)</span></span><br><span class="line"><span class="language-javascript"> <span class="title function_">hello2</span>(person)</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//箭头函数加解构表达式</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">var</span> <span class="title function_">hello3</span> = (<span class="params">{name}</span>) => <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">"hello,"</span> + name)</span></span><br><span class="line"><span class="language-javascript"> <span class="title function_">hello3</span>(person)</span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-4-对象优化"><a href="#2-4-对象优化" class="headerlink" title="2.4 对象优化"></a>2.4 对象优化</h3><ul>
|
||
<li>对象新增的API</li>
|
||
<li>声明对象的简写方式</li>
|
||
<li>对象函数属性的简写</li>
|
||
</ul>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>对象优化<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//1.对象相关的API</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//定义一个person对象</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">const</span> person = {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">name</span>: <span class="string">"jack"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">age</span>: <span class="number">21</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">language</span>: [<span class="string">'java'</span>, <span class="string">'js'</span>, <span class="string">'css'</span>]</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//测试对象新增的API</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//返回对象所有的属性信息</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="title class_">Object</span>.<span class="title function_">keys</span>(person)) <span class="comment">//['name', 'age', 'language']</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//返回对象中vaules</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="title class_">Object</span>.<span class="title function_">values</span>(person))<span class="comment">// ['jack', 21, Array(3)]</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//返回key-vaues</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="title class_">Object</span>.<span class="title function_">entries</span>(person))<span class="comment">// [Array(2), Array(2), Array(2)]</span></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//将source1和source2的属性合并到target中</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">const</span> target = { <span class="attr">a</span>: <span class="number">1</span> }</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">const</span> source1 = { <span class="attr">b</span>: <span class="number">2</span> }</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">const</span> source2 = { <span class="attr">c</span>: <span class="number">3</span> }</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//将source1和source2中的属性合并在一起</span></span></span><br><span class="line"><span class="language-javascript"> <span class="title class_">Object</span>.<span class="title function_">assign</span>(target, source1, source2)</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(target) <span class="comment">//{a: 1, b: 2, c: 3}</span></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//2.声明对象的简写方式</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//声明两个变量</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">const</span> age = <span class="number">23</span>;</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">const</span> name = <span class="string">"张三"</span>;</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//原始的方式然后声明一个对象,属性值为这两个变量的值</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">const</span> person1 = { <span class="attr">age</span>: age, <span class="attr">name</span>: name }</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(person1)</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//ES6的方式</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">const</span> person2 = { age, name }<span class="comment">// 属性名和属性值代表的变量的名字一样可以省写</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(person2)</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//3.对象函数属性的简写</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> person3 = {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">name</span>: <span class="string">"jack"</span>,<span class="comment">//对象的属性</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//以前的语法格式</span></span></span><br><span class="line"><span class="language-javascript"> <span class="attr">eat</span>: <span class="keyword">function</span> (<span class="params">food</span>) {<span class="comment">//对象的方法</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="variable language_">this</span>.<span class="property">name</span> + <span class="string">"在吃"</span> + food)</span></span><br><span class="line"><span class="language-javascript"> },</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//使用箭头有函数简写 箭头函数中this.name无法使用</span></span></span><br><span class="line"><span class="language-javascript"> <span class="attr">eat2</span>: <span class="function"><span class="params">food</span> =></span> <span class="variable language_">console</span>.<span class="title function_">log</span>(person3.<span class="property">name</span> + <span class="string">"在吃"</span> + food),</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="title function_">eat3</span>(<span class="params">food</span>) {</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="variable language_">this</span>.<span class="property">name</span> + <span class="string">"在吃"</span> + food)</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> person3.<span class="title function_">eat</span>(<span class="string">"香蕉"</span>)</span></span><br><span class="line"><span class="language-javascript"> person3.<span class="title function_">eat2</span>(<span class="string">"苹果"</span>)</span></span><br><span class="line"><span class="language-javascript"> person3.<span class="title function_">eat3</span>(<span class="string">"梨子"</span>)</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//4.对象的扩展运算符</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//拷贝对象(深拷贝)</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//将person01的值拷贝给someone</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> person01 = { <span class="attr">name</span>: <span class="string">"Amy"</span>, <span class="attr">age</span>: <span class="number">15</span> }</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> someone = { ...person01 }</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(someone)</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//合并对象</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> age1 = { <span class="attr">age</span>: <span class="number">15</span> }</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> name1 = { <span class="attr">name</span>: <span class="string">"Amy"</span> }</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> person03 = { ...age1, ...name1 }<span class="comment">//两个对象属性的合并一个对象中,如果有相同的值,后一个覆盖前面的那一个属性的值</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(person03)<span class="comment">//{age: 15, name: 'Amy'}</span></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-5-数组的map、reduce方法"><a href="#2-5-数组的map、reduce方法" class="headerlink" title="2.5 数组的map、reduce方法"></a>2.5 数组的map、reduce方法</h3><ul>
|
||
<li>map方法</li>
|
||
<li>reduce方法</li>
|
||
</ul>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>map和reduce<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//数组中新增了map和reduce方法</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//map():接收一个函数,将原数组中的所有元素用这个函数处理后放入新数组返回</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> arr = [<span class="string">'1'</span>, <span class="string">'20'</span>, <span class="string">'-5'</span>, <span class="string">'3'</span>]</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//需求:将原数组中的每一个值乘以2并返回</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//第一种方法</span></span></span><br><span class="line"><span class="language-javascript"> arr1 = arr.<span class="title function_">map</span>(<span class="function">(<span class="params">item</span>) =></span> {<span class="comment">//item为数组中的每一个元素</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">return</span> item * <span class="number">2</span></span></span><br><span class="line"><span class="language-javascript"> })</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(arr1)</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//第二种方法</span></span></span><br><span class="line"><span class="language-javascript"> arr2 = arr.<span class="title function_">map</span>(<span class="function"><span class="params">item</span> =></span> item * <span class="number">2</span>)</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(arr2)</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//reduce()方法:为数组中的每一个元素依次执行回调函数,不包括数组中被删除或从未被赋值的元素</span></span></span><br><span class="line"><span class="language-javascript"> arr3 = [<span class="number">2</span>, <span class="number">40</span>, -<span class="number">10</span>, <span class="number">6</span>]</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//arr.reduce(callback,[initialValue]) //可以传一个回调函数callback,也可以传一个初始值initialValue</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//传入的是回调函数 可以传入的值有</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">/**</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> * previousValue (上一次调用回调返回的值,或者是提供的初始值initialValue)</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> * currentValue (数组中当前被处理的元素)</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> * index (当前元素在数组中的索引)</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> * array (调用reduce的数组)</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> * */</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> result = arr3.<span class="title function_">reduce</span>(<span class="function">(<span class="params">a, b</span>) =></span> {<span class="comment">//这个方法相当于求数组中每一个元素的和</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">"上一次处理后的值:"</span> + a)</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">"当前处理的值:"</span> + b)</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">return</span> a + b;</span></span><br><span class="line"><span class="language-javascript"> })</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(result)</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">/**结果</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> * 上一次处理后的值:2</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> 当前处理的值:40</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> 上一次处理后的值:42</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> 当前处理的值:-10</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> 上一次处理后的值:32</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> 当前处理的值:6</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> 38</span></span></span><br><span class="line"><span class="comment"><span class="language-javascript"> **/</span></span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-6-promise异步编排"><a href="#2-6-promise异步编排" class="headerlink" title="2.6 promise异步编排"></a>2.6 promise异步编排</h3><p><strong>解决回调地域的问题</strong></p>
|
||
<p> Promise构造函数接受一个函数作为参数,该函数的两个参数分别是resolve和reject。它们是两个函数,由 JavaScript 引擎提供,不用自己部署。resolve函数的作用是,将Promise对象的状态从“未完成”变为“成功”(即从 pending 变为 resolved),在异步操作成功时调用,并将异步操作的结果,作为参数传递出去;reject函数的作用是,将Promise对象的状态从“未完成”变为“失败”(即从 pending 变为 rejected),在异步操作失败时调用,并将异步操作报出的错误,作为参数传递出去。</p>
|
||
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line"><span class="keyword">let</span> promise = <span class="keyword">new</span> <span class="title class_">Promise</span>(<span class="keyword">function</span>(<span class="params">resolve, reject</span>) {</span><br><span class="line"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">'Promise'</span>);</span><br><span class="line"> <span class="title function_">resolve</span>();</span><br><span class="line">});</span><br><span class="line"></span><br><span class="line">promise.<span class="title function_">then</span>(<span class="keyword">function</span>(<span class="params"></span>) {</span><br><span class="line"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">'resolved.'</span>);</span><br><span class="line">});</span><br><span class="line"></span><br><span class="line"><span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">'Hi!'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">// Promise</span></span><br><span class="line"><span class="comment">// Hi!</span></span><br><span class="line"><span class="comment">// resolved</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>原有的基础上进一步的封装,链式调用</strong></p>
|
||
<h2 id="3-模块化"><a href="#3-模块化" class="headerlink" title="3.模块化"></a>3.模块化</h2><h3 id="3-1-什么是模块化"><a href="#3-1-什么是模块化" class="headerlink" title="3.1 什么是模块化"></a>3.1 什么是模块化</h3><p> 模块化就是把代码进行拆分,分辨重复使用。类似java中的导包:要使用一个包,必须先导包。而JS中没有包的概念,换来的是模块。</p>
|
||
<p>模块功能主要由两个命令构成: export和import</p>
|
||
<ul>
|
||
<li>export命令用于规定模块的对外接口</li>
|
||
<li>import命令用于导入其他模块提供的功能</li>
|
||
</ul>
|
||
<h3 id="3-2-export"><a href="#3-2-export" class="headerlink" title="3.2 export"></a>3.2 export</h3><p><strong>export不仅可以导出对象,一切js对象都可以导出。比如:基本类型的变量、函数、数组、对象</strong></p>
|
||
<p>比如我们定义了一个js文件hello.js,里面有一个对象</p>
|
||
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">const</span> util = {</span><br><span class="line"> <span class="title function_">dsum</span>(<span class="params">a, b</span>) {</span><br><span class="line"> <span class="keyword">return</span> a + b;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>我们可以使用export将这个对象导出</p>
|
||
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">const</span> util = {</span><br><span class="line"> <span class="title function_">dsum</span>(<span class="params">a, b</span>) {</span><br><span class="line"> <span class="keyword">return</span> a + b;</span><br><span class="line"> }</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">export</span> { util }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>也可以简写成</p>
|
||
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">export</span> <span class="keyword">const</span> util = {</span><br><span class="line"> <span class="title function_">dsum</span>(<span class="params">a, b</span>) {</span><br><span class="line"> <span class="keyword">return</span> a + b;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>当要导出多个值时,还可以简写。比如我有一个文件: user.js</p>
|
||
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">var</span> name = <span class="string">"jack"</span></span><br><span class="line"><span class="keyword">var</span> age = <span class="number">21</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">export</span>{name, age}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-3-import"><a href="#3-3-import" class="headerlink" title="3.3 import"></a>3.3 import</h3><p>比如我们之前定义了两个JS文件</p>
|
||
<p>hello.js</p>
|
||
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">const</span> util = {</span><br><span class="line"> <span class="title function_">dsum</span>(<span class="params">a, b</span>) {</span><br><span class="line"> <span class="keyword">return</span> a + b;</span><br><span class="line"> }</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">export</span> { util }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>user.js</p>
|
||
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">var</span> name = <span class="string">"jack"</span></span><br><span class="line"><span class="keyword">var</span> age = <span class="number">21</span></span><br><span class="line"><span class="keyword">function</span> <span class="title function_">add</span>(<span class="params">a, b</span>) {</span><br><span class="line"> <span class="keyword">return</span> a + b</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="keyword">export</span> { name, age, add }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>我们在main.js文件中导入上面的两个文件,并使用上面的两个文件的方法</p>
|
||
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> util <span class="keyword">from</span> <span class="string">"./hello"</span> <span class="comment">//这里只能是util 不能是其他的名字</span></span><br><span class="line"><span class="keyword">import</span> {name,age,add} <span class="keyword">from</span> <span class="string">'./user'</span> <span class="comment">//可以不用全部导入 只用导入需要的即可</span></span><br><span class="line"></span><br><span class="line">util.<span class="title function_">sum</span>(<span class="number">1</span>,<span class="number">2</span>)</span><br><span class="line"><span class="variable language_">console</span>.<span class="title function_">log</span>(name);</span><br><span class="line"><span class="title function_">add</span>(<span class="number">1</span>,<span class="number">2</span>)</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-4-注意"><a href="#3-4-注意" class="headerlink" title="3.4 注意"></a>3.4 注意</h3><p>当我们这样定义时,导入的时候可以自定义导入时使用的变量名</p>
|
||
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">export</span> <span class="keyword">default</span> { <span class="comment">//导出的时候这样写</span></span><br><span class="line"> <span class="title function_">dsum</span>(<span class="params">a, b</span>) {</span><br><span class="line"> <span class="keyword">return</span> a + b;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> xxx <span class="keyword">from</span> <span class="string">"./hello"</span> <span class="comment">//这里使用可以随意的取名</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h1 id="三-Vue"><a href="#三-Vue" class="headerlink" title="三.Vue"></a>三.Vue</h1><h2 id="1-MVVM思想"><a href="#1-MVVM思想" class="headerlink" title="1.MVVM思想"></a>1.MVVM思想</h2><ul>
|
||
<li>M:即 Model,模型,包括数据和一些基本操作</li>
|
||
<li>V:即View视图,页面渲染结果</li>
|
||
<li>VM:即 View-Model,模型与视图间的双向操作(无需开发人员干涉)</li>
|
||
</ul>
|
||
<p> 在MVVM之前,开发人员从后端获取需要的数据模型,然后要通过DOM操作 Model渲染到View中。而后当用户操作视图,我们还需要通过DOM获取View中的数据,然后同步到Model中。而MVVM中的VM要做的事情就是把DOM操作完全封装起来,开发人员不用再关心Model和View之间是如何互相影响的:</p>
|
||
<h2 id="2-vue的简介"><a href="#2-vue的简介" class="headerlink" title="2.vue的简介"></a>2.vue的简介</h2><p> Vue (发音为 /vjuː/,类似 <strong>view</strong>) 是一款用于构建用户界面的 JavaScript 框架。它基于标准 HTML、CSS 和 JavaScript 构建,并提供了一套声明式的、组件化的编程模型,帮助你高效地开发用户界面。无论是简单还是复杂的界面,Vue 都可以胜任。</p>
|
||
<p><strong><a href="https://v2.cn.vuejs.org/">Vue2官方文档</a></strong></p>
|
||
<h2 id="3-语法基础"><a href="#3-语法基础" class="headerlink" title="3.语法基础"></a>3.语法基础</h2><h3 id="3-1-快速入门"><a href="#3-1-快速入门" class="headerlink" title="3.1 快速入门"></a>3.1 快速入门</h3><p>1.创建一个文件夹,用VSCode打开</p>
|
||
<p>2.下载vue的依赖</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">初始化项目</span></span><br><span class="line">npm init -y</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">安装vue的依赖,这里vue2和vue3版本语法有些差别,使用的时候要注意</span></span><br><span class="line">npm install vue@2 </span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3.创建一个index.html文件</p>
|
||
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>Vue入门<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">id</span>=<span class="string">"app"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">h1</span>></span>{{name}},是个傻子<span class="tag"></<span class="name">h1</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./node_modules/vue/dist/vue.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//这里最新版的vue上面无法获取到name的值</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> vm = <span class="keyword">new</span> <span class="title class_">Vue</span>({</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">el</span>: <span class="string">"#app"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">data</span>: {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">name</span>:<span class="string">"张三"</span></span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> });</span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-2-基本的语法和插件的安装"><a href="#3-2-基本的语法和插件的安装" class="headerlink" title="3.2 基本的语法和插件的安装"></a>3.2 基本的语法和插件的安装</h3><h4 id="3-2-1双向绑定v-model"><a href="#3-2-1双向绑定v-model" class="headerlink" title="3.2.1双向绑定v-model"></a>3.2.1双向绑定v-model</h4><figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>Vue入门<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">id</span>=<span class="string">"app"</span>></span></span><br><span class="line"> <span class="comment"><!-- 双向绑定 --></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"text"</span> <span class="attr">v-model</span>=<span class="string">"num"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">h1</span>></span>{{name}}今年{{num}}岁了<span class="tag"></<span class="name">h1</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./node_modules/vue/dist/vue.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//声明式渲染</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> vm = <span class="keyword">new</span> <span class="title class_">Vue</span>({</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">el</span>: <span class="string">"#app"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">data</span>: {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">name</span>:<span class="string">"张三"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">num</span>: <span class="number">1</span></span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> });</span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-2-2事件处理"><a href="#3-2-2事件处理" class="headerlink" title="3.2.2事件处理"></a>3.2.2事件处理</h4><figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>Vue入门<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">id</span>=<span class="string">"app"</span>></span></span><br><span class="line"> <span class="comment"><!-- 双向绑定 --></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"text"</span> <span class="attr">v-model</span>=<span class="string">"num"</span>></span></span><br><span class="line"> <span class="comment"><!-- 点击事件绑定 --></span></span><br><span class="line"> <span class="tag"><<span class="name">button</span> <span class="attr">v-on:click</span>=<span class="string">"num++"</span>></span>点赞<span class="tag"></<span class="name">button</span>></span></span><br><span class="line"> <span class="comment"><!-- 取消点赞 --></span></span><br><span class="line"> <span class="tag"><<span class="name">button</span> <span class="attr">v-on:click</span>=<span class="string">"cancle()"</span>></span>取消点赞<span class="tag"></<span class="name">button</span>></span><span class="tag"></<span class="name">button</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">h1</span>></span>有{{num}}为{{name}}点赞!<span class="tag"></<span class="name">h1</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./node_modules/vue/dist/vue.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//声明式渲染</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">let</span> vm = <span class="keyword">new</span> <span class="title class_">Vue</span>({</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">el</span>: <span class="string">"#app"</span>, <span class="comment">//绑定元素</span></span></span><br><span class="line"><span class="language-javascript"> <span class="attr">data</span>: {<span class="comment">//封装数据</span></span></span><br><span class="line"><span class="language-javascript"> <span class="attr">name</span>:<span class="string">"张三"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">num</span>: <span class="number">1</span></span></span><br><span class="line"><span class="language-javascript"> },</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">methods</span>:{<span class="comment">//封装方法</span></span></span><br><span class="line"><span class="language-javascript"> <span class="title function_">cancle</span>(<span class="params"></span>){</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">this</span>.<span class="property">num</span>--;</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> });</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//v-xx 相当于指令</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//总结</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//1.创建vue的实例,关联页面的模板,将自己的数据(data)渲染到关联的模板</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//2.使用指令简化对dom的操作 例如 v-XX</span></span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-2-3VUE代码提示插件和浏览器插件"><a href="#3-2-3VUE代码提示插件和浏览器插件" class="headerlink" title="3.2.3VUE代码提示插件和浏览器插件"></a>3.2.3VUE代码提示插件和浏览器插件</h4><p><strong><a href="https://wwvc.lanzouk.com/ibGDO0x9717i">浏览器插件地址</a></strong> 直接解压,打开浏览器插件的开发者模式,选择加载已解压的文件,选择chrome目录即可</p>
|
||
<p><img src="/pictures/image-20230525192244158.png" alt="image-20230525192244158"></p>
|
||
<img src="/pictures/image-20230525191246045.png" alt="image-20230525191246045" style="zoom:200%;" />
|
||
|
||
<h4 id="3-2-4常用指令"><a href="#3-2-4常用指令" class="headerlink" title="3.2.4常用指令"></a>3.2.4常用指令</h4><h5 id="v-html-和-v-text"><a href="#v-html-和-v-text" class="headerlink" title="v-html 和 v-text"></a>v-html 和 v-text</h5><figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>常用指令<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">id</span>=<span class="string">"app"</span>></span></span><br><span class="line"> <span class="comment"><!-- 1.显示类的指令 --></span></span><br><span class="line"> <span class="comment"><!-- 插值表达式会发生插值闪烁的问题,先显示{{msg}}后显示内容 --></span></span><br><span class="line"> <span class="comment"><!-- 打印的是<h1>Hello</h1> --></span></span><br><span class="line"> {{msg}} <span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> {{1+1}} <span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> {{hello()}} <span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">span</span> <span class="attr">v-text</span>=<span class="string">"msg"</span>></span><span class="tag"></<span class="name">span</span>></span></span><br><span class="line"> <span class="comment"><!-- 直接显示h1的大标题 --></span></span><br><span class="line"> <span class="tag"><<span class="name">span</span> <span class="attr">v-html</span>=<span class="string">"msg"</span>></span><span class="tag"></<span class="name">span</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./node_modules/vue/dist/vue.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">new</span> <span class="title class_">Vue</span>({</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">el</span>:<span class="string">"#app"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">data</span>:{</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">msg</span>:<span class="string">"<h1>Hello</h1>"</span></span></span><br><span class="line"><span class="language-javascript"> },</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">methods</span>: {</span></span><br><span class="line"><span class="language-javascript"> <span class="title function_">hello</span>(<span class="params"></span>){</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">return</span> <span class="string">"hello"</span>;</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> },</span></span><br><span class="line"><span class="language-javascript"> })</span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="v-bind单向绑定"><a href="#v-bind单向绑定" class="headerlink" title="v-bind单向绑定"></a>v-bind单向绑定</h5><figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>单向绑定<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">id</span> = <span class="string">"app"</span>></span></span><br><span class="line"> <span class="comment"><!-- 单向绑定 --></span></span><br><span class="line"> <span class="tag"><<span class="name">a</span> <span class="attr">v-bind:href</span>=<span class="string">"link"</span>></span>百度<span class="tag"></<span class="name">a</span>></span></span><br><span class="line"> <span class="comment"><!-- class style也可以通过标签进行单向绑定 --></span></span><br><span class="line"> <span class="tag"><<span class="name">span</span> <span class="attr">v-bind:style</span>=<span class="string">"{color:color}"</span>></span>你好<span class="tag"></<span class="name">span</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">span</span> <span class="attr">:style</span>=<span class="string">"{color:color}"</span>></span>使用缩写形式的单向绑定<span class="tag"></<span class="name">span</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./node_modules/vue/dist/vue.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">new</span> <span class="title class_">Vue</span>({</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">el</span>: <span class="string">"#app"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">data</span>: {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">link</span>:<span class="string">"http://www.baidu.com"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">color</span>: <span class="string">'green'</span></span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> })</span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="v-model-双向绑定"><a href="#v-model-双向绑定" class="headerlink" title="v-model 双向绑定"></a>v-model 双向绑定</h5><figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>双向绑定<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">id</span> = <span class="string">"app"</span>></span></span><br><span class="line"> 精通的语言:<span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"checkbox"</span> <span class="attr">v-model</span>=<span class="string">"language"</span> <span class="attr">value</span>=<span class="string">"java"</span>></span>JAVA <span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"checkbox"</span> <span class="attr">v-model</span>=<span class="string">"language"</span> <span class="attr">value</span>=<span class="string">"php"</span>></span>PHP <span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"checkbox"</span> <span class="attr">v-model</span>=<span class="string">"language"</span> <span class="attr">value</span>=<span class="string">"python"</span>></span>Python <span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> 选中了: {{language}}</span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./node_modules/vue/dist/vue.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">new</span> <span class="title class_">Vue</span>({</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">el</span>: <span class="string">"#app"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">data</span>: {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">language</span>:[]</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> })</span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230526164858205.png" alt="image-20230526164858205"></p>
|
||
<h5 id="v-on-事件绑定"><a href="#v-on-事件绑定" class="headerlink" title="v-on 事件绑定"></a>v-on 事件绑定</h5><figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>事件绑定<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">id</span>=<span class="string">"app"</span>></span></span><br><span class="line"> <span class="comment"><!-- 绑定一个单机事件 --></span></span><br><span class="line"> <span class="tag"><<span class="name">button</span> <span class="attr">v-on:click</span>=<span class="string">"num++"</span>></span>v-on:click的方式点赞<span class="tag"></<span class="name">button</span>></span><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> <span class="comment"><!-- 简写的方式实现点赞 --></span></span><br><span class="line"> <span class="tag"><<span class="name">button</span> @<span class="attr">click</span>=<span class="string">"num++"</span>></span>@click的方式点赞<span class="tag"></<span class="name">button</span>></span><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> <span class="comment"><!-- 点击事件指定一个回调函数 --></span></span><br><span class="line"> <span class="tag"><<span class="name">button</span> <span class="attr">v-on:click</span>=<span class="string">"cancle()"</span>></span>取消点赞<span class="tag"></<span class="name">button</span>></span><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> 点赞的数量:{{num}}</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./node_modules/vue/dist/vue.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">new</span> <span class="title class_">Vue</span>({</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">el</span>: <span class="string">"#app"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">data</span>: {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">num</span>: <span class="number">0</span></span></span><br><span class="line"><span class="language-javascript"> },</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">methods</span>: {</span></span><br><span class="line"><span class="language-javascript"> <span class="title function_">cancle</span>(<span class="params"></span>){</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">this</span>.<span class="property">num</span>--;</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> },</span></span><br><span class="line"><span class="language-javascript"> })</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<img src="/pictures/image-20230526170222378.png" alt="image-20230526170222378" style="zoom:150%;" />
|
||
|
||
<h5 id="v-for-循环显示"><a href="#v-for-循环显示" class="headerlink" title="v-for 循环显示"></a>v-for 循环显示</h5><figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>循环遍历<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">id</span>=<span class="string">"app"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">ul</span>></span></span><br><span class="line"> <span class="comment"><!-- 1.遍历数组 --></span></span><br><span class="line"> <span class="comment"><!-- 可以使用v-for="user in users"遍历用户信息 --></span></span><br><span class="line"> <span class="comment"><!-- 获取下标的信息加上一个index --></span></span><br><span class="line"> <span class="tag"><<span class="name">li</span> <span class="attr">v-for</span>=<span class="string">"(user,index) in users"</span> <span class="attr">:key</span>=<span class="string">""</span>></span></span><br><span class="line"> 序号:{{index+1}} <span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> 姓名:{{user.name}} <span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> 性别:{{user.gender}} <span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> 年龄:{{user.age}} <span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> <span class="comment"><!-- 2.遍历对象,获取每一个属性信息 --></span></span><br><span class="line"> 对象信息:</span><br><span class="line"> <span class="tag"><<span class="name">span</span> <span class="attr">v-for</span>=<span class="string">"(v,k,i) in user"</span>></span>属性索引={{i}}|属性名={{k}}|属性值={{v}}|<span class="tag"></<span class="name">span</span>></span><span class="tag"><<span class="name">br</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">li</span>></span></span><br><span class="line"> <span class="comment"><!-- 遍历的时候加上 :key 提高渲染的效率 --></span></span><br><span class="line"> <span class="comment"><!-- <li v-for="(user,index) in users" :key=""> --></span></span><br><span class="line"> <span class="tag"></<span class="name">ul</span>></span></span><br><span class="line"> </span><br><span class="line"> <span class="comment"><!-- 遍历数组 --></span></span><br><span class="line"> <span class="tag"><<span class="name">ul</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">li</span> <span class="attr">v-for</span>=<span class="string">"(item,index) in nums"</span> <span class="attr">::key</span>=<span class="string">"index"</span>></span></span><br><span class="line"> {{item}}</span><br><span class="line"> <span class="tag"></<span class="name">li</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">ul</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./node_modules/vue/dist/vue.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">new</span> <span class="title class_">Vue</span>({</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">el</span>: <span class="string">"#app"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">data</span>: {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">users</span>: [</span></span><br><span class="line"><span class="language-javascript"> { <span class="attr">name</span>: <span class="string">"mary"</span>, <span class="attr">gender</span>: <span class="string">'女'</span>, <span class="attr">age</span>: <span class="number">21</span> },</span></span><br><span class="line"><span class="language-javascript"> { <span class="attr">name</span>: <span class="string">"tom"</span>, <span class="attr">gender</span>: <span class="string">'男'</span>, <span class="attr">age</span>: <span class="number">35</span> },</span></span><br><span class="line"><span class="language-javascript"> { <span class="attr">name</span>: <span class="string">"mike"</span>, <span class="attr">gender</span>: <span class="string">'男'</span>, <span class="attr">age</span>: <span class="number">21</span> },</span></span><br><span class="line"><span class="language-javascript"> { <span class="attr">name</span>: <span class="string">"amy"</span>, <span class="attr">gender</span>: <span class="string">'女'</span>, <span class="attr">age</span>: <span class="number">64</span> }</span></span><br><span class="line"><span class="language-javascript"> ],</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">nums</span>:[<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,<span class="number">4</span>,<span class="number">5</span>,<span class="number">6</span>,<span class="number">7</span>,<span class="number">8</span>,<span class="number">9</span>,<span class="number">10</span>,<span class="number">11</span>]</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> })</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230526172228532.png" alt="image-20230526172228532"></p>
|
||
<h5 id="v-if-和-v-show"><a href="#v-if-和-v-show" class="headerlink" title="v-if 和 v-show"></a>v-if 和 v-show</h5><figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>判断<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="comment"><!-- v-if 条件判断,当结果为true时,所有的元素才会被渲染 --></span></span><br><span class="line"> <span class="comment"><!-- v-show 当得到的结果为true时,所有的元素才会被显示 --></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">id</span>=<span class="string">"app"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">button</span> <span class="attr">v-on:click</span>=<span class="string">"show = !show"</span>></span>点击显示与否<span class="tag"></<span class="name">button</span>></span><span class="tag"></<span class="name">button</span>></span></span><br><span class="line"> <span class="comment"><!-- 1.使用v-if显示 --></span></span><br><span class="line"> <span class="tag"><<span class="name">h1</span> <span class="attr">v-if</span>=<span class="string">"show"</span>></span>if=看到我...<span class="tag"></<span class="name">h1</span>></span></span><br><span class="line"> <span class="comment"><!-- 2.使用v-show显示 --></span></span><br><span class="line"> <span class="tag"><<span class="name">h1</span> <span class="attr">v-show</span>=<span class="string">"show"</span>></span>show=显示...<span class="tag"></<span class="name">h1</span>></span><span class="tag"></<span class="name">h1</span>></span></span><br><span class="line"> <span class="comment"><!-- 多重判断 --></span></span><br><span class="line"> <span class="comment"><!-- v-if、v-else-if、v-else --></span></span><br><span class="line"> <span class="comment"><!-- 循环的时候也可以加上判断 --></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./node_modules/vue/dist/vue.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">new</span> <span class="title class_">Vue</span>({</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">el</span>: <span class="string">"#app"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">data</span>: {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">show</span>:<span class="literal">true</span></span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> })</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-2-5-计算属性和侦听器"><a href="#3-2-5-计算属性和侦听器" class="headerlink" title="3.2.5 计算属性和侦听器"></a>3.2.5 计算属性和侦听器</h4><figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>计算属性和侦听器<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">id</span>=<span class="string">"app"</span>></span></span><br><span class="line"> <span class="comment"><!-- 计算属性 --></span></span><br><span class="line"> <span class="tag"><<span class="name">ul</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">li</span>></span>西游记;价格:{{xyjPrice}},数量:<span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"number"</span> <span class="attr">v-model</span>=<span class="string">"xyjNum"</span>></span><span class="tag"></<span class="name">li</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">li</span>></span>水浒传;价格:{{shzPrice}},数量:<span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"number"</span> <span class="attr">v-model</span>=<span class="string">"shzNum"</span>></span><span class="tag"></<span class="name">li</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">li</span>></span>总价:{{totalPrice}}<span class="tag"></<span class="name">li</span>></span></span><br><span class="line"> {{msg}}</span><br><span class="line"> <span class="tag"></<span class="name">ul</span>></span></span><br><span class="line"> <span class="comment"><!-- 侦听器,监听属性值的变化 --></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./node_modules/vue/dist/vue.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">new</span> <span class="title class_">Vue</span>({</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">el</span>: <span class="string">"#app"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">data</span>: {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">xyjPrice</span>: <span class="number">99.98</span>, <span class="comment">//西游记价格</span></span></span><br><span class="line"><span class="language-javascript"> <span class="attr">shzPrice</span>: <span class="number">99.00</span>, <span class="comment">//水浒传价格</span></span></span><br><span class="line"><span class="language-javascript"> <span class="attr">xyjNum</span>: <span class="number">0</span>, <span class="comment">//西游记的数量</span></span></span><br><span class="line"><span class="language-javascript"> <span class="attr">shzNum</span>: <span class="number">0</span>, <span class="comment">//水浒传的数量</span></span></span><br><span class="line"><span class="language-javascript"> <span class="attr">msg</span>: <span class="string">""</span> <span class="comment">//提示的消息</span></span></span><br><span class="line"><span class="language-javascript"> },</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">computed</span>: {<span class="comment">//计算属性</span></span></span><br><span class="line"><span class="language-javascript"> <span class="title function_">totalPrice</span>(<span class="params"></span>) {<span class="comment">//计算总价</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">return</span> <span class="variable language_">this</span>.<span class="property">xyjPrice</span> * <span class="variable language_">this</span>.<span class="property">xyjNum</span> + <span class="variable language_">this</span>.<span class="property">shzPrice</span> * <span class="variable language_">this</span>.<span class="property">shzNum</span></span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> },</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">watch</span>: {<span class="comment">//监听器</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//newVal:新值</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//oldVal:旧值</span></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//下面的这个方法是监听当购买的数量超出了3,就提示超库存了,并把输入框的值设置为最大的3</span></span></span><br><span class="line"><span class="language-javascript"> <span class="attr">xyjNum</span>: <span class="keyword">function</span> (<span class="params">newVal, oldVal</span>) {<span class="comment">//监听西游记数量的变化</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">"newVal:"</span> + newVal + <span class="string">" | "</span> + <span class="string">"oldVal:"</span> + oldVal)</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">if</span> (newVal >= <span class="number">3</span>) {</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">this</span>.<span class="property">msg</span> = <span class="string">"库存超出了限制"</span></span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">this</span>.<span class="property">xyjNum</span> = <span class="number">3</span></span></span><br><span class="line"><span class="language-javascript"> } <span class="keyword">else</span> {</span></span><br><span class="line"><span class="language-javascript"> <span class="variable language_">this</span>.<span class="property">msg</span> = <span class="string">""</span></span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> })</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-2-6-过滤器"><a href="#3-2-6-过滤器" class="headerlink" title="3.2.6 过滤器"></a>3.2.6 过滤器</h4><figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>过滤器<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">div</span> <span class="attr">id</span>=<span class="string">"app"</span>></span></span><br><span class="line"> <span class="comment"><!-- 过滤器常用来处理文本格式化的操作,过滤器可以用在两个地方:插值表达式和v-bind表达式 --></span></span><br><span class="line"> <span class="tag"><<span class="name">ul</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">li</span> <span class="attr">v-for</span>=<span class="string">"user in userList"</span>></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"><!-- 姓名:{{user.name}} | 性别:{{user.gender== 1?"男":"女"}} --></span></span><br><span class="line"> <span class="comment"><!-- 方式二:使用过滤器的方式 其中 | 是管道符 genderFilter是过滤器 --></span></span><br><span class="line"> 姓名:{{user.name}} | 性别:{{user.gender | genderFilter}}</span><br><span class="line"> <span class="tag"></<span class="name">li</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">ul</span>></span></span><br><span class="line"><span class="tag"></<span class="name">div</span>></span></span><br><span class="line"><span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./node_modules/vue/dist/vue.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="title class_">Vue</span>.<span class="title function_">filter</span>(<span class="string">"gFilter"</span>, <span class="keyword">function</span> (<span class="params">val</span>) {<span class="comment">//全局过滤器</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">if</span> (val == <span class="number">1</span>) {</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">return</span> <span class="string">"男··"</span></span></span><br><span class="line"><span class="language-javascript"> } <span class="keyword">else</span> {</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">return</span> <span class="string">"女··"</span></span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> })</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">new</span> <span class="title class_">Vue</span>({</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">el</span>: <span class="string">"#app"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">data</span>: {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">userList</span>: [</span></span><br><span class="line"><span class="language-javascript"> { <span class="attr">id</span>: <span class="number">1</span>, <span class="attr">name</span>: <span class="string">"jacky"</span>, <span class="attr">gender</span>: <span class="number">1</span> },</span></span><br><span class="line"><span class="language-javascript"> { <span class="attr">id</span>: <span class="number">2</span>, <span class="attr">name</span>: <span class="string">"peter"</span>, <span class="attr">gender</span>: <span class="number">0</span> },</span></span><br><span class="line"><span class="language-javascript"> ]</span></span><br><span class="line"><span class="language-javascript"> },</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">filters</span>: {<span class="comment">//局部的过滤器</span></span></span><br><span class="line"><span class="language-javascript"> <span class="title function_">genderFilter</span>(<span class="params">val</span>) {</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">if</span> (val == <span class="number">1</span>) {</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">return</span> <span class="string">"男"</span></span></span><br><span class="line"><span class="language-javascript"> } <span class="keyword">else</span> {</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">return</span> <span class="string">"女"</span></span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> })</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-3-组件化"><a href="#3-3-组件化" class="headerlink" title="3.3 组件化"></a>3.3 组件化</h3><p> 在大型应用开发的时候,页面可以划分成很多部分。往往不同的页面,也会有相同的部分。例如可能会有相同的头部导航。但是每个页面都都独自开发,这无疑增加了开发的成本。所以我们会把页面的不同部分拆分成独立的组件,然后在不同的页面就可以共享这些组件,避免重复开发。</p>
|
||
<img src="/pictures/image-20230527215736955.png" alt="image-20230527215736955" style="zoom:150%;" />
|
||
|
||
<h4 id="3-3-1-全局组件"><a href="#3-3-1-全局组件" class="headerlink" title="3.3.1 全局组件"></a>3.3.1 全局组件</h4><figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>组件化<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">id</span>=<span class="string">"app"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">button</span> @<span class="attr">click</span>=<span class="string">"count++"</span>></span>我被点击了{{count}}次<span class="tag"></<span class="name">button</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- 组件的使用 --></span></span><br><span class="line"> <span class="tag"><<span class="name">counter</span>></span><span class="tag"></<span class="name">counter</span>></span></span><br><span class="line"> </span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./node_modules/vue/dist/vue.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//1.全局声明一个组件</span></span></span><br><span class="line"><span class="language-javascript"> <span class="title class_">Vue</span>.<span class="title function_">component</span>(<span class="string">"counter"</span>, {<span class="comment">//counter是组件的名称,可以随便起名,见名知意就行</span></span></span><br><span class="line"><span class="language-javascript"> <span class="attr">template</span>: <span class="string">`<button @click="count++">我被点击了{{count}}次</button>`</span>,<span class="comment">//模板</span></span></span><br><span class="line"><span class="language-javascript"> <span class="title function_">data</span>(<span class="params"></span>) { <span class="comment">//模板中的属性信息,这里的data必须是一个函数</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">return</span> {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">count</span>: <span class="number">1</span></span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> });</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">new</span> <span class="title class_">Vue</span>({</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">el</span>: <span class="string">"#app"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">data</span>: {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">count</span>: <span class="number">0</span></span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> })</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<img src="/pictures/image-20230527220905922.png" alt="image-20230527220905922" style="zoom:150%;" />
|
||
|
||
<h4 id="3-3-2-局部组件"><a href="#3-3-2-局部组件" class="headerlink" title="3.3.2 局部组件"></a>3.3.2 局部组件</h4><figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE <span class="keyword">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"X-UA-Compatible"</span> <span class="attr">content</span>=<span class="string">"IE=edge"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1.0"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>组件化<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">id</span>=<span class="string">"app"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">button</span> @<span class="attr">click</span>=<span class="string">"count++"</span>></span>我被点击了{{count}}次<span class="tag"></<span class="name">button</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- 局部组件的使用 --></span></span><br><span class="line"> <span class="tag"><<span class="name">button-counter</span>></span><span class="tag"></<span class="name">button-counter</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./node_modules/vue/dist/vue.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span>></span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//声明一个局部的组件</span></span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">const</span> buttonCounter = {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">template</span>: <span class="string">`<button @click="count++">我被点击了{{count}}次</button>`</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="title function_">data</span>(<span class="params"></span>) { </span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">return</span> {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">count</span>: <span class="number">1</span></span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> <span class="keyword">new</span> <span class="title class_">Vue</span>({</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">el</span>: <span class="string">"#app"</span>,</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">data</span>: {</span></span><br><span class="line"><span class="language-javascript"> <span class="attr">count</span>: <span class="number">0</span></span></span><br><span class="line"><span class="language-javascript"> },</span></span><br><span class="line"><span class="language-javascript"> <span class="comment">//声明一个局部的组件</span></span></span><br><span class="line"><span class="language-javascript"> <span class="attr">components</span>:{</span></span><br><span class="line"><span class="language-javascript"> <span class="string">'button-counter'</span>:buttonCounter</span></span><br><span class="line"><span class="language-javascript"> }</span></span><br><span class="line"><span class="language-javascript"> })</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"> </span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-3-生命周期和钩子函数"><a href="#3-3-生命周期和钩子函数" class="headerlink" title="3.3 生命周期和钩子函数"></a>3.3 生命周期和钩子函数</h3><p><strong>生命周期图</strong></p>
|
||
<p><img src="/pictures/image-20230527221756442.png" alt="image-20230527221756442"></p>
|
||
<h3 id="3-4-Vue模块化开发"><a href="#3-4-Vue模块化开发" class="headerlink" title="3.4 Vue模块化开发"></a>3.4 Vue模块化开发</h3><p><strong>1.全局安装webpack</strong></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">npm install webpack -g</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>2.全局安装vue脚手架</strong></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">npm install -g @vue/cli-init</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>3.初始化vue的项目</strong></p>
|
||
<p>创建一个文件夹,打开cmd,切换到这个文件夹,执行以下的命令</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">vue脚手架使用webpacke模板初始化一个项目</span></span><br><span class="line">vue init webpack 项目名称 </span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>4.启动vue的项目</strong></p>
|
||
<p>项目中的package.json中有scripts,代表我们能运行的命令</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">启动项目</span></span><br><span class="line">npm start </span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">或者</span></span><br><span class="line">npm run dev </span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">将项目打包</span></span><br><span class="line">npm run build </span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="4-Eelment-UI"><a href="#4-Eelment-UI" class="headerlink" title="4.Eelment-UI"></a>4.Eelment-UI</h2><p><strong>官方文档:<a href="https://element.eleme.cn/#/zh-CN/component/quickstart">https://element.eleme.cn/#/zh-CN/component/quickstart</a></strong></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>前端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>前端</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>统一异常处理</title>
|
||
<url>/posts/31385.html</url>
|
||
<content><![CDATA[<p>我们想让异常结果也显示为统一的返回结果对象,并且统一处理系统的异常信息,那么需要统一异常处理。</p>
|
||
<p><img src="/pictures/image-20230506153955544.png" alt="image-20230506153955544"></p>
|
||
<h2 id="1-全局异常处理"><a href="#1-全局异常处理" class="headerlink" title="1.全局异常处理"></a>1.全局异常处理</h2><p>异常返回的结果也为统一的返回结果的对象</p>
|
||
<figure class="highlight java"><table><tr><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="keyword">import</span> com.atguigu.common.result.Result;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.ControllerAdvice;</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.ResponseBody;</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/6</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">@ControllerAdvice</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">GlobalExceptionHandler</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="meta">@ExceptionHandler(Exception.class)</span> <span class="comment">//标记什么异常使用该方法</span></span><br><span class="line"> <span class="meta">@ResponseBody</span> <span class="comment">//返回的是json数据</span></span><br><span class="line"> <span class="keyword">public</span> Result <span class="title function_">error</span><span class="params">(Exception e)</span>{</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> <span class="keyword">return</span> Result.fail().message(<span class="string">"全局异常处理器捕获到该异常"</span>);</span><br><span class="line"> }</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="meta">@ExceptionHandler(ArithmeticException.class)</span> <span class="comment">//标记什么异常使用该方法</span></span><br><span class="line"> <span class="meta">@ResponseBody</span> <span class="comment">//返回的是json数据</span></span><br><span class="line"> <span class="keyword">public</span> Result <span class="title function_">error</span><span class="params">(ArithmeticException e)</span>{</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> <span class="keyword">return</span> Result.fail().message(<span class="string">"数学运算异常"</span>);</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"> * GuiguException为自定义的异常</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@ExceptionHandler(GuiguException.class)</span> <span class="comment">//标记什么异常使用该方法</span></span><br><span class="line"> <span class="meta">@ResponseBody</span> <span class="comment">//返回的是json数据</span></span><br><span class="line"> <span class="keyword">public</span> Result <span class="title function_">error</span><span class="params">(GuiguException e)</span>{</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> <span class="comment">//获取抛出异常的时候填入的code和message的值并返回</span></span><br><span class="line"> <span class="keyword">return</span> Result.fail().code(e.getCode()).message(e.getMessage());</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="2-自定义异常"><a href="#2-自定义异常" class="headerlink" title="2.自定义异常"></a>2.自定义异常</h2><h3 id="创建异常类-继承RuntimeException"><a href="#创建异常类-继承RuntimeException" class="headerlink" title="创建异常类 继承RuntimeException"></a>创建异常类 继承RuntimeException</h3><figure class="highlight java"><table><tr><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="keyword">import</span> com.atguigu.common.result.ResultCodeEnum;</span><br><span class="line"><span class="keyword">import</span> lombok.Data;</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/6</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_">GuiguException</span> <span class="keyword">extends</span> <span class="title class_">RuntimeException</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="keyword">private</span> Integer code;</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 message;</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">public</span> <span class="title function_">GuiguException</span><span class="params">(Integer code, String message)</span> {</span><br><span class="line"> <span class="built_in">super</span>(message);</span><br><span class="line"> <span class="built_in">this</span>.code = code;</span><br><span class="line"> <span class="built_in">this</span>.message = message;</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 class="doctag">@param</span> resultCodeEnum 枚举类型的结果信息</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="title function_">GuiguException</span><span class="params">(ResultCodeEnum resultCodeEnum)</span> {</span><br><span class="line"> <span class="built_in">super</span>(resultCodeEnum.getMessage());</span><br><span class="line"> <span class="built_in">this</span>.code = resultCodeEnum.getCode();</span><br><span class="line"> <span class="built_in">this</span>.message = resultCodeEnum.getMessage();</span><br><span class="line"> }</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> String <span class="title function_">toString</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"GuliException{"</span> +</span><br><span class="line"> <span class="string">"code="</span> + code +</span><br><span class="line"> <span class="string">", message="</span> + <span class="built_in">this</span>.getMessage() +</span><br><span class="line"> <span class="string">'}'</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="在需要抛出自定义异常的地方抛出异常"><a href="#在需要抛出自定义异常的地方抛出异常" class="headerlink" title="在需要抛出自定义异常的地方抛出异常"></a>在需要抛出自定义异常的地方抛出异常</h3><figure class="highlight java"><table><tr><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">@ApiOperation("查询所有角色的接口")</span></span><br><span class="line"> <span class="meta">@GetMapping("/findAll")</span></span><br><span class="line"> <span class="keyword">public</span> Result<List<SysRole>> <span class="title function_">findAll</span><span class="params">()</span> {</span><br><span class="line"> List<SysRole> sysRoles = sysRoleService.list();</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">//这里我们使用除零模拟异常</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">1</span>/<span class="number">0</span>;</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">GuiguException</span>(<span class="number">2001</span>, <span class="string">"抛出了自定义的异常"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> Result.ok(sysRoles);</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="全局异常处理器捕获异常并返回异常信息"><a href="#全局异常处理器捕获异常并返回异常信息" class="headerlink" title="全局异常处理器捕获异常并返回异常信息"></a>全局异常处理器捕获异常并返回异常信息</h3><p><img src="/pictures/image-20230506154605339.png" alt="image-20230506154605339"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>Java</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>常见问题和细节知识</title>
|
||
<url>/posts/14438.html</url>
|
||
<content><![CDATA[<h1 id="一-常见问题"><a href="#一-常见问题" class="headerlink" title="一.常见问题"></a>一.常见问题</h1><h2 id="1-前后端时间格式的问题"><a href="#1-前后端时间格式的问题" class="headerlink" title="1.前后端时间格式的问题"></a>1.前后端时间格式的问题</h2><p>配置文件中设置时间的格式和时区</p>
|
||
<p><img src="/pictures/image-20230506130238222.png" alt="image-20230506130238222"></p>
|
||
<h2 id="2-MyBatis分页插件统计总记录数total失效的问题"><a href="#2-MyBatis分页插件统计总记录数total失效的问题" class="headerlink" title="2.MyBatis分页插件统计总记录数total失效的问题"></a>2.MyBatis分页插件统计总记录数total失效的问题</h2><p>检查一下分页插件的配置 选择以下正确的分页插件配置</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.common.config.mp;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.DbType;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;</span><br><span class="line"><span class="keyword">import</span> org.mybatis.spring.annotation.MapperScan;</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="comment">/**</span></span><br><span class="line"><span class="comment"> * mp的分页插件</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="meta">@MapperScan("com.atguigu.auth.mapper")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MybatisPlusConfig</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除)</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Bean</span></span><br><span class="line"> <span class="keyword">public</span> MybatisPlusInterceptor <span class="title function_">mybatisPlusInterceptor</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">MybatisPlusInterceptor</span> <span class="variable">interceptor</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">MybatisPlusInterceptor</span>();</span><br><span class="line"> interceptor.addInnerInterceptor(<span class="keyword">new</span> <span class="title class_">PaginationInnerInterceptor</span>(DbType.MYSQL));</span><br><span class="line"> <span class="keyword">return</span> interceptor;</span><br><span class="line"> }</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> ConfigurationCustomizer <span class="title function_">configurationCustomizer</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> configuration -> configuration.setUseDeprecatedExecutor(<span class="literal">false</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.config;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.core.injector.ISqlInjector;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;</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="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/3/4</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> mybatis-plus的配置文件</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_">MpConfig</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="meta">@Bean</span></span><br><span class="line"> <span class="keyword">public</span> PaginationInterceptor <span class="title function_">paginationInterceptor</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">PaginationInterceptor</span>();</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="3-网关中的路由问题"><a href="#3-网关中的路由问题" class="headerlink" title="3.网关中的路由问题"></a>3.网关中的路由问题</h2><p>网关中的路由匹配问题,模糊的路由放在精确的路由前面,容易是精确的路由配置失效</p>
|
||
<figure class="highlight yaml"><table><tr><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/(?<segment>.*),/$\{segment}</span></span><br><span class="line"> </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">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="attr">filters:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">RewritePath=/api/(?<segment>.*),/renren-fast/$\{segment}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="4-Docker中部署mysql后SpringBoot连接时提示表不存在"><a href="#4-Docker中部署mysql后SpringBoot连接时提示表不存在" class="headerlink" title="4.Docker中部署mysql后SpringBoot连接时提示表不存在"></a>4.Docker中部署mysql后SpringBoot连接时提示表不存在</h2><p>使用Docer启动容器的时候设置忽略大小写,表不存在是因为表名大小写的原因。</p>
|
||
<p><strong>方案一:启动的时候加上–lower_case_table_names= 1</strong></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">docker run -p 3306:3306 --name mysql -v /usr/local/docker/mysql/conf:/etc/mysql -v /usr/local/docker/mysql/logs:/var/log/mysql -v /usr/local/docker/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7 --lower_case_table_names= 1</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>方案二: 修改mysql挂载在宿主机的配置文件</strong></p>
|
||
<figure class="highlight properties"><table><tr><td class="code"><pre><span class="line"><span class="comment"># 在配置文件中添加如下的配置</span></span><br><span class="line"><span class="attr">lower_case_table_names</span>=<span class="string">1</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h1 id="二-细节知识"><a href="#二-细节知识" class="headerlink" title="二.细节知识"></a>二.细节知识</h1><h2 id="1-Linux开启-关闭防火墙的命令"><a href="#1-Linux开启-关闭防火墙的命令" class="headerlink" title="1.Linux开启/关闭防火墙的命令"></a>1.Linux开启/关闭防火墙的命令</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">检查防火墙状态:</span></span><br><span class="line">systemctl status firewalld</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">开启防火墙</span></span><br><span class="line">systemctl start firewalld</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">关闭防火墙(有时间限制)</span></span><br><span class="line">systemctl stop firewalld</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置开机禁用防火墙(先执行上面一条命令之后执行此命令,即可永久关闭)</span></span><br><span class="line">systemctl disable firewalld.service</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置开机启用防火墙</span></span><br><span class="line">systemctl enable firewalld.service</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="2-windows查看端口占用情况-杀死端口的命令"><a href="#2-windows查看端口占用情况-杀死端口的命令" class="headerlink" title="2.windows查看端口占用情况,杀死端口的命令"></a>2.windows查看端口占用情况,杀死端口的命令</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查询被占用的端口号的信息</span></span><br><span class="line">netstat -ano | findstr "8080"</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">根据端口号的PID杀死该端口的进程 其中 17156 是8080端口的PID值</span></span><br><span class="line">taskkill /pid 17156 /f</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="3-Linux开启关闭键盘背光灯"><a href="#3-Linux开启关闭键盘背光灯" class="headerlink" title="3.Linux开启关闭键盘背光灯"></a>3.Linux开启关闭键盘背光灯</h2><figure class="highlight shell"><table><tr><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">xset led named "Scroll Lock"</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">关闭键盘背光灯</span></span><br><span class="line">xset -led named "Scroll Lock"</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="4-关闭Mysql的服务"><a href="#4-关闭Mysql的服务" class="headerlink" title="4.关闭Mysql的服务"></a>4.关闭Mysql的服务</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查找是否安装了mysql的服务</span></span><br><span class="line">rpm -qa | grep -i mysql</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看mysql服务的状态</span></span><br><span class="line">service mysqld status</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">关闭mysql的服务</span></span><br><span class="line">service mysqld stop</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">重启的命令</span></span><br><span class="line">service mysqld restart</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">关闭开机自启动</span></span><br><span class="line">systemctl disable mysqld</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="5-前端向后端传递对象数据"><a href="#5-前端向后端传递对象数据" class="headerlink" title="5.前端向后端传递对象数据"></a>5.前端向后端传递对象数据</h2><p>传递普通对象参数的写法</p>
|
||
<p>params: searchObj</p>
|
||
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line"><span class="title function_">getPageList</span>(<span class="params">current,limit,searchObj</span>){</span><br><span class="line"> <span class="keyword">return</span> <span class="title function_">request</span>({</span><br><span class="line"> <span class="attr">url</span>: <span class="string">`<span class="subst">${api_name}</span>/<span class="subst">${current}</span>/<span class="subst">${limit}</span>`</span>,</span><br><span class="line"> <span class="attr">method</span>: <span class="string">'get'</span>,</span><br><span class="line"> <span class="attr">params</span>: searchObj <span class="comment">//使用这种方式进行传递</span></span><br><span class="line"> })</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@GetMapping("/{page}/{limit}")</span></span><br><span class="line"><span class="keyword">public</span> Result <span class="title function_">pageQueryRole</span><span class="params">(<span class="meta">@PathVariable</span> Long page,</span></span><br><span class="line"><span class="params"> <span class="meta">@PathVariable</span> Integer limit,</span></span><br><span class="line"><span class="params"> SysRoleQueryVo sysRoleQueryVo)</span> { <span class="comment">//普通的对象进行接收 没有添加注解</span></span><br><span class="line"></span><br><span class="line"> Page<SysRole> pageParam = <span class="keyword">new</span> <span class="title class_">Page</span><>(page, limit);</span><br><span class="line"> LambdaQueryWrapper<SysRole> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><>();</span><br><span class="line"> queryWrapper.like(!StringUtils.isEmpty(sysRoleQueryVo.getRoleName()),SysRole::getRoleName, sysRoleQueryVo.getRoleName());</span><br><span class="line"> Page<SysRole> sysRolePage = sysRoleService.page(pageParam, queryWrapper);</span><br><span class="line"> <span class="keyword">return</span> Result.ok(sysRolePage);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>json格式的传递</p>
|
||
<p>data: searchObj</p>
|
||
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line"><span class="title function_">add</span>(<span class="params">sysRole</span>){</span><br><span class="line"> <span class="keyword">return</span> <span class="title function_">request</span>({</span><br><span class="line"> <span class="attr">url</span>: <span class="string">`<span class="subst">${api_name}</span>/save`</span>,</span><br><span class="line"> <span class="attr">method</span>: <span class="string">'post'</span>,</span><br><span class="line"> <span class="attr">data</span>: sysRole <span class="comment">//使用这种方式进行传递</span></span><br><span class="line"> })</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@PostMapping("/save")</span></span><br><span class="line"> <span class="keyword">public</span> Result <span class="title function_">save</span><span class="params">(<span class="meta">@RequestBody</span> SysRole sysRole)</span>{ <span class="comment">//JSON格式对象的传递 需要使用注解@RequestBody</span></span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isSave</span> <span class="operator">=</span> sysRoleService.save(sysRole);</span><br><span class="line"> <span class="keyword">return</span> isSave? Result.ok() : Result.fail();</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="6-调整日志的级别"><a href="#6-调整日志的级别" class="headerlink" title="6.调整日志的级别"></a>6.调整日志的级别</h2><figure class="highlight yaml"><table><tr><td class="code"><pre><span class="line"><span class="attr">logging:</span></span><br><span class="line"> <span class="attr">level:</span></span><br><span class="line"> <span class="comment"># 注意这里包的路径,要根据实际情况t</span></span><br><span class="line"> <span class="attr">com.atguigu.gulimall:</span> <span class="string">debug</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="7-JsonInclude注解"><a href="#7-JsonInclude注解" class="headerlink" title="7.@JsonInclude注解"></a>7.@JsonInclude注解</h2><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@JsonInclude(JsonInclude.Include.NON_EMPTY)</span><span class="comment">//这里是当children为空的时候,向前端传递数据就不带这个</span></span><br><span class="line"><span class="keyword">private</span> List<CategoryEntity> children;</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="8-node相关的问题"><a href="#8-node相关的问题" class="headerlink" title="8.node相关的问题"></a>8.node相关的问题</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看node的版本</span></span><br><span class="line">node -v</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看npm的版本</span></span><br><span class="line">npm -v</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看npm使用的镜像源(npm镜像源)</span></span><br><span class="line">npm get registry</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">设置淘宝镜像源</span></span><br><span class="line">npm config set registry http://registry.npm.taobao.org</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>Java</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>SpringBoot整合Knife4j</title>
|
||
<url>/posts/855.html</url>
|
||
<content><![CDATA[<h2 id="1-介绍"><a href="#1-介绍" class="headerlink" title="1.介绍"></a>1.介绍</h2><p>一句话介绍Knife4j: Swagger的增强版,界面更好看,功能更加的丰富</p>
|
||
<p>文档地址:<a href="https://doc.xiaominfo.com/">https://doc.xiaominfo.com/</a></p>
|
||
<p><img src="/pictures/image-20230505222154471.png" alt="image-20230505222154471"></p>
|
||
<p><img src="/pictures/image-20230505223651097.png" alt="image-20230505223651097"></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><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!--引入Knife4j的官方start包,该指南选择Spring Boot版本<3.0,开发者需要注意--></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.github.xiaoymin<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>knife4j-openapi2-spring-boot-starter<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>4.0.0<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-2-编写配置类"><a href="#2-2-编写配置类" class="headerlink" title="2.2 编写配置类"></a>2.2 编写配置类</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.common.config.knife4j;</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> springfox.documentation.builders.ApiInfoBuilder;</span><br><span class="line"><span class="keyword">import</span> springfox.documentation.builders.ParameterBuilder;</span><br><span class="line"><span class="keyword">import</span> springfox.documentation.builders.PathSelectors;</span><br><span class="line"><span class="keyword">import</span> springfox.documentation.builders.RequestHandlerSelectors;</span><br><span class="line"><span class="keyword">import</span> springfox.documentation.schema.ModelRef;</span><br><span class="line"><span class="keyword">import</span> springfox.documentation.service.ApiInfo;</span><br><span class="line"><span class="keyword">import</span> springfox.documentation.service.Contact;</span><br><span class="line"><span class="keyword">import</span> springfox.documentation.service.Parameter;</span><br><span class="line"><span class="keyword">import</span> springfox.documentation.spi.DocumentationType;</span><br><span class="line"><span class="keyword">import</span> springfox.documentation.spring.web.plugins.Docket;</span><br><span class="line"><span class="keyword">import</span> springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;</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> 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/5</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> knife4j配置信息</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"></span><br><span class="line"><span class="meta">@Configuration</span></span><br><span class="line"><span class="meta">@EnableSwagger2WebMvc</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Knife4jConfig</span> {</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> Docket <span class="title function_">adminApiConfig</span><span class="params">()</span>{</span><br><span class="line"> List<Parameter> pars = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> <span class="type">ParameterBuilder</span> <span class="variable">tokenPar</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ParameterBuilder</span>();</span><br><span class="line"> tokenPar.name(<span class="string">"token"</span>)</span><br><span class="line"> .description(<span class="string">"用户token"</span>)</span><br><span class="line"> .defaultValue(<span class="string">""</span>)</span><br><span class="line"> .modelRef(<span class="keyword">new</span> <span class="title class_">ModelRef</span>(<span class="string">"string"</span>))</span><br><span class="line"> .parameterType(<span class="string">"header"</span>)</span><br><span class="line"> .required(<span class="literal">false</span>)</span><br><span class="line"> .build();</span><br><span class="line"> pars.add(tokenPar.build());</span><br><span class="line"> <span class="comment">//添加head参数end</span></span><br><span class="line"></span><br><span class="line"> <span class="type">Docket</span> <span class="variable">adminApi</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Docket</span>(DocumentationType.SWAGGER_2)</span><br><span class="line"> .groupName(<span class="string">"adminApi"</span>)</span><br><span class="line"> .apiInfo(adminApiInfo())</span><br><span class="line"> .select()</span><br><span class="line"> <span class="comment">//只显示admin路径下的页面</span></span><br><span class="line"> .apis(RequestHandlerSelectors.basePackage(<span class="string">"com.atguigu"</span>))</span><br><span class="line"> .paths(PathSelectors.regex(<span class="string">"/admin/.*"</span>))</span><br><span class="line"> .build()</span><br><span class="line"> .globalOperationParameters(pars);</span><br><span class="line"> <span class="keyword">return</span> adminApi;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> ApiInfo <span class="title function_">adminApiInfo</span><span class="params">()</span>{</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">ApiInfoBuilder</span>()</span><br><span class="line"> .title(<span class="string">"后台管理系统-API文档"</span>)</span><br><span class="line"> .description(<span class="string">"本文档描述了后台管理系统微服务接口定义"</span>)</span><br><span class="line"> .version(<span class="string">"1.0"</span>)</span><br><span class="line"> .contact(<span class="keyword">new</span> <span class="title class_">Contact</span>(<span class="string">"JasonGong"</span>, <span class="string">""</span>, <span class="string">"2602183349@qq.com"</span>))</span><br><span class="line"> .build();</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-3-使用"><a href="#2-3-使用" class="headerlink" title="2.3 使用"></a>2.3 使用</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.auth.controller;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.atguigu.auth.service.SysRoleService;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.common.result.Result;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.model.system.SysRole;</span><br><span class="line"><span class="keyword">import</span> io.swagger.annotations.Api;</span><br><span class="line"><span class="keyword">import</span> io.swagger.annotations.ApiOperation;</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.web.bind.annotation.CrossOrigin;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.GetMapping;</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.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> 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/5</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">@Api(tags = "角色管理的接口")</span></span><br><span class="line"><span class="meta">@RestController</span></span><br><span class="line"><span class="meta">@RequestMapping("/admin/system/sysRole")</span></span><br><span class="line"><span class="meta">@CrossOrigin</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">SysRoleController</span> {</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> SysRoleService sysRoleService;</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="meta">@ApiOperation("查询所有角色的接口")</span></span><br><span class="line"> <span class="meta">@GetMapping("/findAll")</span></span><br><span class="line"> <span class="keyword">public</span> Result<List<SysRole>> <span class="title function_">findAll</span><span class="params">()</span>{</span><br><span class="line"> List<SysRole> sysRoles = sysRoleService.list();</span><br><span class="line"> <span class="keyword">return</span> Result.ok(sysRoles);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-4接口文档的访问地址"><a href="#2-4接口文档的访问地址" class="headerlink" title="2.4接口文档的访问地址"></a>2.4接口文档的访问地址</h3><figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"># 端口号根据项目的端口号进行改变</span><br><span class="line">http://localhost:8080/doc.html </span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230505223433369.png" alt="image-20230505223433369"></p>
|
||
<p><img src="/pictures/image-20230505223331221.png"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>SpringBoot</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>阿里云对象存储OSS</title>
|
||
<url>/posts/6319.html</url>
|
||
<content><![CDATA[<h2 id="1-官网介绍"><a href="#1-官网介绍" class="headerlink" title="1.官网介绍"></a>1.官网介绍</h2><p> 阿里云对象存储OSS(Object Storage Service)是一款海量、安全、低成本、高可靠的云存储服务,可提供99.9999999999%(12个9)的数据持久性,99.995%的数据可用性。多种存储类型供选择,全面优化存储成本。OSS具有与平台无关的RESTful API接口,您可以在任何应用、任何时间、任何地点存储和访问任意类型的数据。您可以使用阿里云提供的API、SDK接口或者OSS迁移工具轻松地将海量数据移入或移出阿里云OSS。数据存储到阿里云OSS以后,您可以选择标准存储(Standard)作为移动应用、大型网站、图片分享或热点音视频的主要存储方式,也可以选择成本更低、存储期限更长的低频访问存储(Infrequent Access)、归档存储(Archive)、冷归档存储(Cold Archive)作为不经常访问数据的存储方式。</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>(1)申请阿里云账号<br>(2)实名认证<br>(3)开通“对象存储OSS”服务<br>(4)进入管理控制台</p>
|
||
<h3 id="2-2-创建Bucket"><a href="#2-2-创建Bucket" class="headerlink" title="2.2 创建Bucket"></a>2.2 创建Bucket</h3><p>点击创建Bucket</p>
|
||
<p><img src="/pictures/image-20230422210404204.png" alt="image-20230422210404204"></p>
|
||
<p>填写相关的信息</p>
|
||
<p><img src="/pictures/image-20230422211448747.png" alt="image-20230422211448747"></p>
|
||
<h3 id="2-3获取AccessKey保存备用"><a href="#2-3获取AccessKey保存备用" class="headerlink" title="2.3获取AccessKey保存备用"></a>2.3获取AccessKey保存备用</h3><p>AccessKey拥有对阿里云提供服务(对象存储、短信服务、视频点播服务等等)的控制权,要妥善保管</p>
|
||
<p><img src="/pictures/image-20230422211940485.png" alt="image-20230422211940485"></p>
|
||
<h3 id="2-4-查看开发文档"><a href="#2-4-查看开发文档" class="headerlink" title="2.4 查看开发文档"></a>2.4 查看开发文档</h3><p>刚开始不会使用的话,查看开发文档是入门的最好方式</p>
|
||
<p><img src="/pictures/image-20230422212508029.png" alt="image-20230422212508029"></p>
|
||
<h3 id="2-5-入门案例"><a href="#2-5-入门案例" class="headerlink" title="2.5 入门案例"></a>2.5 入门案例</h3><p>创建一个SpringBoot工程</p>
|
||
<h4 id="1-引入依赖"><a href="#1-引入依赖" class="headerlink" title="1.引入依赖"></a>1.引入依赖</h4><p>可以引入一个日期工具类<strong>joda-time</strong> 方便后面生成图片存储的路径</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.aliyun.oss<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>aliyun-sdk-oss<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>3.15.1<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="2-修改配置文件"><a href="#2-修改配置文件" class="headerlink" title="2.修改配置文件"></a>2.修改配置文件</h4><p>入门案例中以下值会直接在代码中写死,先不从配置文件中获取</p>
|
||
<figure class="highlight properties"><table><tr><td class="code"><pre><span class="line"><span class="comment"># 地域节点 bucket概览中查看</span></span><br><span class="line"><span class="attr">aliyun.oss.endpoint</span>=<span class="string">oss-cn-beijing.aliyuncs.com</span></span><br><span class="line"><span class="comment"># accessKey</span></span><br><span class="line"><span class="attr">aliyun.oss.accessKeyId</span>=<span class="string">LTAI4G4SV6WtST7UYH77XXXX</span></span><br><span class="line"><span class="comment"># secret</span></span><br><span class="line"><span class="attr">aliyun.oss.secret</span>=<span class="string">X9KHNYgztNr9MI5Zp8JffXXXXXXXX</span></span><br><span class="line"><span class="comment"># bucket名</span></span><br><span class="line"><span class="attr">aliyun.oss.bucket</span>=<span class="string">yygh-atguigu</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="3-创建读取配置文件的配置类"><a href="#3-创建读取配置文件的配置类" class="headerlink" title="3.创建读取配置文件的配置类"></a>3.创建读取配置文件的配置类</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Component</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ConstantOssPropertiesUtils</span> <span class="keyword">implements</span> <span class="title class_">InitializingBean</span> {</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Value("${aliyun.oss.endpoint}")</span></span><br><span class="line"> <span class="keyword">private</span> String endpoint;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Value("${aliyun.oss.accessKeyId}")</span></span><br><span class="line"> <span class="keyword">private</span> String accessKeyId;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Value("${aliyun.oss.secret}")</span></span><br><span class="line"> <span class="keyword">private</span> String secret;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Value("${aliyun.oss.bucket}")</span></span><br><span class="line"> <span class="keyword">private</span> String bucket;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String EDNPOINT;</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String ACCESS_KEY_ID;</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String SECRECT;</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String BUCKET;</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> <span class="keyword">void</span> <span class="title function_">afterPropertiesSet</span><span class="params">()</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> EDNPOINT=endpoint;</span><br><span class="line"> ACCESS_KEY_ID=accessKeyId;</span><br><span class="line"> SECRECT=secret;</span><br><span class="line"> BUCKET=bucket;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="4-测试案例"><a href="#4-测试案例" class="headerlink" title="4.测试案例"></a>4.测试案例</h4><p>以下测试案例由官方开发文档提供</p>
|
||
<p>1.通过代码创建Bucket</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Demo</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> <span class="comment">// Endpoint以华东1(杭州)为例,其它Region请按实际情况填写。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">endpoint</span> <span class="operator">=</span> <span class="string">"https://oss-cn-hangzhou.aliyuncs.com"</span>;</span><br><span class="line"> <span class="comment">// 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">accessKeyId</span> <span class="operator">=</span> <span class="string">"yourAccessKeyId"</span>;</span><br><span class="line"> <span class="type">String</span> <span class="variable">accessKeySecret</span> <span class="operator">=</span> <span class="string">"yourAccessKeySecret"</span>;</span><br><span class="line"> <span class="comment">// 填写Bucket名称,例如examplebucket。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">bucketName</span> <span class="operator">=</span> <span class="string">"examplebucket"</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, accessKeyId, accessKeySecret);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">// 创建存储空间。</span></span><br><span class="line"> ossClient.createBucket(bucketName);</span><br><span class="line"></span><br><span class="line"> } <span class="keyword">catch</span> (OSSException oe) {</span><br><span class="line"> System.out.println(<span class="string">"Caught an OSSException, which means your request made it to OSS, "</span></span><br><span class="line"> + <span class="string">"but was rejected with an error response for some reason."</span>);</span><br><span class="line"> System.out.println(<span class="string">"Error Message:"</span> + oe.getErrorMessage());</span><br><span class="line"> System.out.println(<span class="string">"Error Code:"</span> + oe.getErrorCode());</span><br><span class="line"> System.out.println(<span class="string">"Request ID:"</span> + oe.getRequestId());</span><br><span class="line"> System.out.println(<span class="string">"Host ID:"</span> + oe.getHostId());</span><br><span class="line"> } <span class="keyword">catch</span> (ClientException ce) {</span><br><span class="line"> System.out.println(<span class="string">"Caught an ClientException, which means the client encountered "</span></span><br><span class="line"> + <span class="string">"a serious internal problem while trying to communicate with OSS, "</span></span><br><span class="line"> + <span class="string">"such as not being able to access the network."</span>);</span><br><span class="line"> System.out.println(<span class="string">"Error Message:"</span> + ce.getMessage());</span><br><span class="line"> } <span class="keyword">finally</span> {</span><br><span class="line"> <span class="keyword">if</span> (ossClient != <span class="literal">null</span>) {</span><br><span class="line"> ossClient.shutdown();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.上传文件</p>
|
||
<p>以下代码用于通过流式上传的方式将文件上传到OSS。</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> com.aliyun.oss.ClientException;</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.OSSException;</span><br><span class="line"><span class="keyword">import</span> java.io.ByteArrayInputStream;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Demo</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> <span class="comment">// Endpoint以华东1(杭州)为例,其它Region请按实际情况填写。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">endpoint</span> <span class="operator">=</span> <span class="string">"https://oss-cn-hangzhou.aliyuncs.com"</span>;</span><br><span class="line"> <span class="comment">// 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">accessKeyId</span> <span class="operator">=</span> <span class="string">"yourAccessKeyId"</span>;</span><br><span class="line"> <span class="type">String</span> <span class="variable">accessKeySecret</span> <span class="operator">=</span> <span class="string">"yourAccessKeySecret"</span>;</span><br><span class="line"> <span class="comment">// 填写Bucket名称,例如examplebucket。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">bucketName</span> <span class="operator">=</span> <span class="string">"examplebucket"</span>;</span><br><span class="line"> <span class="comment">// 填写Object完整路径,例如exampledir/exampleobject.txt。Object完整路径中不能包含Bucket名称。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">objectName</span> <span class="operator">=</span> <span class="string">"exampledir/exampleobject.txt"</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, accessKeyId, accessKeySecret);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">String</span> <span class="variable">content</span> <span class="operator">=</span> <span class="string">"Hello OSS"</span>;</span><br><span class="line"> ossClient.putObject(bucketName, objectName, <span class="keyword">new</span> <span class="title class_">ByteArrayInputStream</span>(content.getBytes()));</span><br><span class="line"> } <span class="keyword">catch</span> (OSSException oe) {</span><br><span class="line"> System.out.println(<span class="string">"Caught an OSSException, which means your request made it to OSS, "</span></span><br><span class="line"> + <span class="string">"but was rejected with an error response for some reason."</span>);</span><br><span class="line"> System.out.println(<span class="string">"Error Message:"</span> + oe.getErrorMessage());</span><br><span class="line"> System.out.println(<span class="string">"Error Code:"</span> + oe.getErrorCode());</span><br><span class="line"> System.out.println(<span class="string">"Request ID:"</span> + oe.getRequestId());</span><br><span class="line"> System.out.println(<span class="string">"Host ID:"</span> + oe.getHostId());</span><br><span class="line"> } <span class="keyword">catch</span> (ClientException ce) {</span><br><span class="line"> System.out.println(<span class="string">"Caught an ClientException, which means the client encountered "</span></span><br><span class="line"> + <span class="string">"a serious internal problem while trying to communicate with OSS, "</span></span><br><span class="line"> + <span class="string">"such as not being able to access the network."</span>);</span><br><span class="line"> System.out.println(<span class="string">"Error Message:"</span> + ce.getMessage());</span><br><span class="line"> } <span class="keyword">finally</span> {</span><br><span class="line"> <span class="keyword">if</span> (ossClient != <span class="literal">null</span>) {</span><br><span class="line"> ossClient.shutdown();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>3.下载文件</p>
|
||
<p>以下代码用于通过流式下载方式从OSS下载文件。</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> com.aliyun.oss.ClientException;</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.OSSException;</span><br><span class="line"><span class="keyword">import</span> com.aliyun.oss.model.OSSObject;</span><br><span class="line"><span class="keyword">import</span> java.io.BufferedReader;</span><br><span class="line"><span class="keyword">import</span> java.io.InputStream;</span><br><span class="line"><span class="keyword">import</span> java.io.InputStreamReader;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Demo</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> <span class="comment">// Endpoint以华东1(杭州)为例,其它Region请按实际情况填写。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">endpoint</span> <span class="operator">=</span> <span class="string">"https://oss-cn-hangzhou.aliyuncs.com"</span>;</span><br><span class="line"> <span class="comment">// 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">accessKeyId</span> <span class="operator">=</span> <span class="string">"yourAccessKeyId"</span>;</span><br><span class="line"> <span class="type">String</span> <span class="variable">accessKeySecret</span> <span class="operator">=</span> <span class="string">"yourAccessKeySecret"</span>;</span><br><span class="line"> <span class="comment">// 填写Bucket名称,例如examplebucket。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">bucketName</span> <span class="operator">=</span> <span class="string">"examplebucket"</span>;</span><br><span class="line"> <span class="comment">// 填写Object完整路径,例如exampledir/exampleobject.txt。Object完整路径中不能包含Bucket名称。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">objectName</span> <span class="operator">=</span> <span class="string">"exampledir/exampleobject.txt"</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, accessKeyId, accessKeySecret);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">// 调用ossClient.getObject返回一个OSSObject实例,该实例包含文件内容及文件元信息。</span></span><br><span class="line"> <span class="type">OSSObject</span> <span class="variable">ossObject</span> <span class="operator">=</span> ossClient.getObject(bucketName, objectName);</span><br><span class="line"> <span class="comment">// 调用ossObject.getObjectContent获取文件输入流,可读取此输入流获取其内容。</span></span><br><span class="line"> <span class="type">InputStream</span> <span class="variable">content</span> <span class="operator">=</span> ossObject.getObjectContent();</span><br><span class="line"> <span class="keyword">if</span> (content != <span class="literal">null</span>) {</span><br><span class="line"> <span class="type">BufferedReader</span> <span class="variable">reader</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">BufferedReader</span>(<span class="keyword">new</span> <span class="title class_">InputStreamReader</span>(content));</span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">line</span> <span class="operator">=</span> reader.readLine();</span><br><span class="line"> <span class="keyword">if</span> (line == <span class="literal">null</span>) <span class="keyword">break</span>;</span><br><span class="line"> System.out.println(<span class="string">"\n"</span> + line);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">// 数据读取完成后,获取的流必须关闭,否则会造成连接泄漏,导致请求无连接可用,程序无法正常工作。</span></span><br><span class="line"> content.close();</span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">catch</span> (OSSException oe) {</span><br><span class="line"> System.out.println(<span class="string">"Caught an OSSException, which means your request made it to OSS, "</span></span><br><span class="line"> + <span class="string">"but was rejected with an error response for some reason."</span>);</span><br><span class="line"> System.out.println(<span class="string">"Error Message:"</span> + oe.getErrorMessage());</span><br><span class="line"> System.out.println(<span class="string">"Error Code:"</span> + oe.getErrorCode());</span><br><span class="line"> System.out.println(<span class="string">"Request ID:"</span> + oe.getRequestId());</span><br><span class="line"> System.out.println(<span class="string">"Host ID:"</span> + oe.getHostId());</span><br><span class="line"> } <span class="keyword">catch</span> (ClientException ce) {</span><br><span class="line"> System.out.println(<span class="string">"Caught an ClientException, which means the client encountered "</span></span><br><span class="line"> + <span class="string">"a serious internal problem while trying to communicate with OSS, "</span></span><br><span class="line"> + <span class="string">"such as not being able to access the network."</span>);</span><br><span class="line"> System.out.println(<span class="string">"Error Message:"</span> + ce.getMessage());</span><br><span class="line"> } <span class="keyword">finally</span> {</span><br><span class="line"> <span class="keyword">if</span> (ossClient != <span class="literal">null</span>) {</span><br><span class="line"> ossClient.shutdown();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>4.列举文件</p>
|
||
<p>以下代码用于列举examplebucket存储空间下的文件。默认列举100个文件。</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> com.aliyun.oss.ClientException;</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.OSSException;</span><br><span class="line"><span class="keyword">import</span> com.aliyun.oss.model.OSSObjectSummary;</span><br><span class="line"><span class="keyword">import</span> com.aliyun.oss.model.ObjectListing;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Demo</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> <span class="comment">// Endpoint以华东1(杭州)为例,其它Region请按实际情况填写。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">endpoint</span> <span class="operator">=</span> <span class="string">"https://oss-cn-hangzhou.aliyuncs.com"</span>;</span><br><span class="line"> <span class="comment">// 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">accessKeyId</span> <span class="operator">=</span> <span class="string">"yourAccessKeyId"</span>;</span><br><span class="line"> <span class="type">String</span> <span class="variable">accessKeySecret</span> <span class="operator">=</span> <span class="string">"yourAccessKeySecret"</span>;</span><br><span class="line"> <span class="comment">// 填写Bucket名称,例如examplebucket。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">bucketName</span> <span class="operator">=</span> <span class="string">"examplebucket"</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, accessKeyId, accessKeySecret);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">// ossClient.listObjects返回ObjectListing实例,包含此次listObject请求的返回结果。</span></span><br><span class="line"> <span class="type">ObjectListing</span> <span class="variable">objectListing</span> <span class="operator">=</span> ossClient.listObjects(bucketName);</span><br><span class="line"> <span class="comment">// objectListing.getObjectSummaries获取所有文件的描述信息。</span></span><br><span class="line"> <span class="keyword">for</span> (OSSObjectSummary objectSummary : objectListing.getObjectSummaries()) {</span><br><span class="line"> System.out.println(<span class="string">" - "</span> + objectSummary.getKey() + <span class="string">" "</span> +</span><br><span class="line"> <span class="string">"(size = "</span> + objectSummary.getSize() + <span class="string">")"</span>);</span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">catch</span> (OSSException oe) {</span><br><span class="line"> System.out.println(<span class="string">"Caught an OSSException, which means your request made it to OSS, "</span></span><br><span class="line"> + <span class="string">"but was rejected with an error response for some reason."</span>);</span><br><span class="line"> System.out.println(<span class="string">"Error Message:"</span> + oe.getErrorMessage());</span><br><span class="line"> System.out.println(<span class="string">"Error Code:"</span> + oe.getErrorCode());</span><br><span class="line"> System.out.println(<span class="string">"Request ID:"</span> + oe.getRequestId());</span><br><span class="line"> System.out.println(<span class="string">"Host ID:"</span> + oe.getHostId());</span><br><span class="line"> } <span class="keyword">catch</span> (ClientException ce) {</span><br><span class="line"> System.out.println(<span class="string">"Caught an ClientException, which means the client encountered "</span></span><br><span class="line"> + <span class="string">"a serious internal problem while trying to communicate with OSS, "</span></span><br><span class="line"> + <span class="string">"such as not being able to access the network."</span>);</span><br><span class="line"> System.out.println(<span class="string">"Error Message:"</span> + ce.getMessage());</span><br><span class="line"> } <span class="keyword">finally</span> {</span><br><span class="line"> <span class="keyword">if</span> (ossClient != <span class="literal">null</span>) {</span><br><span class="line"> ossClient.shutdown();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>5.删除文件</p>
|
||
<p>以下代码用于删除指定文件。</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> com.aliyun.oss.ClientException;</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.OSSException;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Demo</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> <span class="comment">// Endpoint以华东1(杭州)为例,其它Region请按实际情况填写。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">endpoint</span> <span class="operator">=</span> <span class="string">"https://oss-cn-hangzhou.aliyuncs.com"</span>;</span><br><span class="line"> <span class="comment">// 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">accessKeyId</span> <span class="operator">=</span> <span class="string">"yourAccessKeyId"</span>;</span><br><span class="line"> <span class="type">String</span> <span class="variable">accessKeySecret</span> <span class="operator">=</span> <span class="string">"yourAccessKeySecret"</span>;</span><br><span class="line"> <span class="comment">// 填写Bucket名称,例如examplebucket。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">bucketName</span> <span class="operator">=</span> <span class="string">"examplebucket"</span>;</span><br><span class="line"> <span class="comment">// 填写Object完整路径,例如exampledir/exampleobject.txt。Object完整路径中不能包含Bucket名称。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">objectName</span> <span class="operator">=</span> <span class="string">"exampledir/exampleobject.txt"</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, accessKeyId, accessKeySecret);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">// 删除文件。</span></span><br><span class="line"> ossClient.deleteObject(bucketName, objectName);</span><br><span class="line"> } <span class="keyword">catch</span> (OSSException oe) {</span><br><span class="line"> System.out.println(<span class="string">"Caught an OSSException, which means your request made it to OSS, "</span></span><br><span class="line"> + <span class="string">"but was rejected with an error response for some reason."</span>);</span><br><span class="line"> System.out.println(<span class="string">"Error Message:"</span> + oe.getErrorMessage());</span><br><span class="line"> System.out.println(<span class="string">"Error Code:"</span> + oe.getErrorCode());</span><br><span class="line"> System.out.println(<span class="string">"Request ID:"</span> + oe.getRequestId());</span><br><span class="line"> System.out.println(<span class="string">"Host ID:"</span> + oe.getHostId());</span><br><span class="line"> } <span class="keyword">catch</span> (ClientException ce) {</span><br><span class="line"> System.out.println(<span class="string">"Caught an ClientException, which means the client encountered "</span></span><br><span class="line"> + <span class="string">"a serious internal problem while trying to communicate with OSS, "</span></span><br><span class="line"> + <span class="string">"such as not being able to access the network."</span>);</span><br><span class="line"> System.out.println(<span class="string">"Error Message:"</span> + ce.getMessage());</span><br><span class="line"> } <span class="keyword">finally</span> {</span><br><span class="line"> <span class="keyword">if</span> (ossClient != <span class="literal">null</span>) {</span><br><span class="line"> ossClient.shutdown();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="5-项目中使用OSS对象存储"><a href="#5-项目中使用OSS对象存储" class="headerlink" title="5.项目中使用OSS对象存储"></a>5.项目中使用OSS对象存储</h4><h5 id="1-文件的上传操作"><a href="#1-文件的上传操作" class="headerlink" title="1.文件的上传操作"></a>1.文件的上传操作</h5><p>controller层</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> com.atguigu.yygh.common.result.Result;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.yygh.oss.service.OSSService;</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.web.bind.annotation.PostMapping;</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 class="keyword">import</span> org.springframework.web.multipart.MultipartFile;</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/4/22</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">@RestController</span></span><br><span class="line"><span class="meta">@RequestMapping("/api/oss/file")</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">OSSController</span> {</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> OSSService ossService;</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">@PostMapping("/fileUpload")</span></span><br><span class="line"> <span class="keyword">public</span> Result <span class="title function_">fileUpload</span><span class="params">(MultipartFile file)</span>{</span><br><span class="line"> <span class="comment">//上传文件,返回文件的url地址</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">url</span> <span class="operator">=</span> ossService.upload(file);</span><br><span class="line"> <span class="keyword">return</span> Result.ok(url);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>service层</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> com.aliyun.oss.ClientException;</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.OSSException;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.yygh.oss.service.OSSService;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.yygh.oss.utils.ConstantOssPropertiesUtils;</span><br><span class="line"><span class="keyword">import</span> org.joda.time.DateTime;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Service;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.multipart.MultipartFile;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.ByteArrayInputStream;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.io.InputStream;</span><br><span class="line"><span class="keyword">import</span> java.util.UUID;</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/4/22</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> OSS文件相关操作</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Service</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">OSSServiceImpl</span> <span class="keyword">implements</span> <span class="title class_">OSSService</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 class="doctag">@param</span> file 文件</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> String <span class="title function_">upload</span><span class="params">(MultipartFile file)</span> {</span><br><span class="line"> <span class="comment">// Endpoint,地域节点信息</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">endpoint</span> <span class="operator">=</span> ConstantOssPropertiesUtils.EDNPOINT;</span><br><span class="line"> <span class="comment">// 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">accessKeyId</span> <span class="operator">=</span> ConstantOssPropertiesUtils.ACCESS_KEY_ID;</span><br><span class="line"> <span class="type">String</span> <span class="variable">accessKeySecret</span> <span class="operator">=</span> ConstantOssPropertiesUtils.SECRECT;</span><br><span class="line"> <span class="comment">// Bucket名称</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">bucketName</span> <span class="operator">=</span> ConstantOssPropertiesUtils.BUCKET;</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, accessKeyId, accessKeySecret);</span><br><span class="line"> <span class="comment">//生成文件名 生成文件名的策略是日期/文件名.jpg 文件名由UUID随机生成</span></span><br><span class="line"> <span class="comment">//获取原始的文件名</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">originalFilename</span> <span class="operator">=</span> file.getOriginalFilename();</span><br><span class="line"> <span class="comment">//分割出扩展名</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">suffixFilename</span> <span class="operator">=</span> originalFilename.substring(originalFilename.lastIndexOf(<span class="string">"."</span>));</span><br><span class="line"> <span class="comment">//得到随机的文件名</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">prefixFilename</span> <span class="operator">=</span> UUID.randomUUID().toString();</span><br><span class="line"> <span class="comment">//得到文件名</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">filename</span> <span class="operator">=</span> prefixFilename + suffixFilename;</span><br><span class="line"> <span class="comment">//将文件按照日期进行分类 日期/文件名.jpg</span></span><br><span class="line"> <span class="comment">//获取当前的日期 使用时间作为目录</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">filePath</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">DateTime</span>().toString(<span class="string">"yyyy/MM/dd"</span>);</span><br><span class="line"> <span class="comment">//得到最终的文件名</span></span><br><span class="line"> filename = filePath + <span class="string">"/"</span> + filename;</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">//获取上传文件的流</span></span><br><span class="line"> <span class="type">InputStream</span> <span class="variable">inputStream</span> <span class="operator">=</span> file.getInputStream();</span><br><span class="line"> <span class="comment">//上传文件</span></span><br><span class="line"> ossClient.putObject(bucketName, filename, inputStream);</span><br><span class="line"> <span class="comment">//拼接文件的url地址并返回</span></span><br><span class="line"> <span class="comment">//https://edu-guli-0306.oss-cn-beijing.aliyuncs.com/81ea0d8d-0e52-4749-be58-6292410deec6.jpg</span></span><br><span class="line"> <span class="keyword">return</span> <span class="string">"https://"</span> + bucketName + <span class="string">"."</span> + endpoint + <span class="string">"/"</span> + filename;</span><br><span class="line"> } <span class="keyword">catch</span> (IOException e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> } <span class="keyword">finally</span> {</span><br><span class="line"> <span class="keyword">if</span> (ossClient != <span class="literal">null</span>) {</span><br><span class="line"> ossClient.shutdown();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="3-Aliyun-Spring-Boot-OSS"><a href="#3-Aliyun-Spring-Boot-OSS" class="headerlink" title="3.Aliyun Spring Boot OSS"></a>3.Aliyun Spring Boot OSS</h2><p><strong>[使用文档](<a href="https://github.com/alibaba/aliyun-spring-boot/blob/master/aliyun-spring-boot-samples/aliyun-oss-spring-boot-sample/README-zh.md">aliyun-spring-boot/README-zh.md at master · alibaba/aliyun-spring-boot · GitHub</a>)</strong></p>
|
||
<p>相比与上面的Demo,这个Demo更加的简便,编写的代码比较少</p>
|
||
<p><strong>项目说明</strong></p>
|
||
<p> 如果您的应用是 Spring Cloud 应用,且需要使用阿里云的 OSS 服务进行云端的文件存储,例如电商业务中常见的商品图片存储,那么您可以使用 OSS starter 完成 Spring Cloud 应用的对象存储。</p>
|
||
<p>阿里云对象存储服务(Object Storage Service,简称 OSS),是阿里云提供的海量、安全、低成本、高可靠的云存储服务。您可以在任何应用、任何时间、任何地点存储和访问任意类型的数据。更多 OSS 相关的信息,请参考 <a href="https://www.aliyun.com/product/oss">OSS官网</a>。</p>
|
||
<h3 id="1-引入依赖-1"><a href="#1-引入依赖-1" class="headerlink" title="1.引入依赖"></a>1.引入依赖</h3><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!-- 阿里云的对象存储的依赖--></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.alibaba.cloud<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-cloud-starter-alicloud-oss<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.1.0.RELEASE<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">type</span>></span>pom<span class="tag"></<span class="name">type</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-在配置文件中增加配置"><a href="#2-在配置文件中增加配置" class="headerlink" title="2.在配置文件中增加配置"></a>2.在配置文件中增加配置</h3><figure class="highlight properties"><table><tr><td class="code"><pre><span class="line"><span class="attr">spring.cloud.alicloud.access-key</span>=<span class="string">************</span></span><br><span class="line"><span class="attr">spring.cloud.alicloud.secret-key</span>=<span class="string">************</span></span><br><span class="line"><span class="attr">spring.cloud.alicloud.oss.endpoint</span>=<span class="string">************</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-测试使用"><a href="#3-测试使用" class="headerlink" title="3.测试使用"></a>3.测试使用</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Autowired</span></span><br><span class="line">OSSClient ossClient;</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">@Test</span></span><br><span class="line"><span class="keyword">void</span> <span class="title function_">testUpload</span><span class="params">()</span> <span class="keyword">throws</span> FileNotFoundException {</span><br><span class="line"> <span class="type">String</span> <span class="variable">bucketName</span> <span class="operator">=</span> <span class="string">"gulimall-0611"</span>;</span><br><span class="line"> <span class="type">String</span> <span class="variable">objectName</span> <span class="operator">=</span> <span class="string">"test1.jpg"</span>;</span><br><span class="line"> <span class="type">InputStream</span> <span class="variable">inputStream</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">FileInputStream</span>(<span class="string">"C:\\Gong\\data\\test.jpg"</span>);</span><br><span class="line"> <span class="comment">// 创建PutObjectRequest对象。</span></span><br><span class="line"> ossClient.putObject(bucketName,objectName,inputStream);</span><br><span class="line"> ossClient.shutdown();</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-在项目中使用OSS进行文件的上传和下载的操作"><a href="#4-在项目中使用OSS进行文件的上传和下载的操作" class="headerlink" title="4.在项目中使用OSS进行文件的上传和下载的操作"></a>4.在项目中使用OSS进行文件的上传和下载的操作</h3><p><strong>服务端签名直传</strong> 使用这种方式可以减轻本地服务器的压力</p>
|
||
<p>参考文档:<a href="https://help.aliyun.com/document_detail/91868.htm?spm=a2c4g.31927.0.0.44193d70tJDLJb#concept-ahk-rfz-2fb">https://help.aliyun.com/document_detail/91868.htm?spm=a2c4g.31927.0.0.44193d70tJDLJb#concept-ahk-rfz-2fb</a></p>
|
||
<img src="/pictures/image-20230611214209712.png" alt="image-20230611214209712" style="zoom:150%;" />
|
||
|
||
<h4 id="4-1-获取文件上传相关的签名信息"><a href="#4-1-获取文件上传相关的签名信息" class="headerlink" title="4.1 获取文件上传相关的签名信息"></a>4.1 获取文件上传相关的签名信息</h4><p>获取签名信息的接口</p>
|
||
<figure class="highlight java"><table><tr><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> 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> {</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("${spring.cloud.alicloud.oss.endpoint}")</span></span><br><span class="line"> <span class="keyword">private</span> String endpoint;</span><br><span class="line"> <span class="meta">@Value("${spring.cloud.alicloud.oss.bucket}")</span></span><br><span class="line"> <span class="keyword">private</span> String bucket;</span><br><span class="line"> <span class="meta">@Value("${spring.cloud.alicloud.access-key}")</span></span><br><span class="line"> <span class="keyword">private</span> String accessId;</span><br><span class="line"> <span class="meta">@Value("${spring.cloud.alicloud.secret-key}")</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("/oss/policy")</span></span><br><span class="line"> <span class="keyword">public</span> Map<String, String> <span class="title function_">policy</span><span class="params">()</span> {</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">"https://"</span>+bucket+<span class="string">"."</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 = "https://192.168.0.0:8888";</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">"yyyy/MM/dd"</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">"/"</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<String, String> respMap = <span class="literal">null</span>;</span><br><span class="line"> <span class="keyword">try</span> {</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">"utf-8"</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><String, String>();</span><br><span class="line"> respMap.put(<span class="string">"accessId"</span>, accessId);</span><br><span class="line"> respMap.put(<span class="string">"policy"</span>, encodedPolicy);</span><br><span class="line"> respMap.put(<span class="string">"signature"</span>, postSignature);</span><br><span class="line"> respMap.put(<span class="string">"dir"</span>, dir);</span><br><span class="line"> respMap.put(<span class="string">"host"</span>, host);</span><br><span class="line"> respMap.put(<span class="string">"expire"</span>, String.valueOf(expireEndTime / <span class="number">1000</span>));</span><br><span class="line"> <span class="comment">// respMap.put("expire", formatISO8601Date(expiration));</span></span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> System.out.println(e.getMessage());</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> respMap;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>访问接口之后返回的数据格式</p>
|
||
<figure class="highlight json"><table><tr><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"accessId"</span><span class="punctuation">:</span> <span class="string">"LTAI5tDDwk18w2S7w1KF24oT"</span><span class="punctuation">,</span><span class="comment">//access-key</span></span><br><span class="line"> <span class="attr">"policy"</span><span class="punctuation">:</span> <span class="string">"eyJleHBpcmF0aW9uIjoiMjAyMy0wNi0xMVQxNDoxNzozMi43OTdaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMTA0ODU3NjAwMF0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCIyMDIzLzA2LzExLyJdXX0="</span><span class="punctuation">,</span><span class="comment">//策略,加密之后的结果</span></span><br><span class="line"> <span class="attr">"signature"</span><span class="punctuation">:</span> <span class="string">"n67QffiYHceO2Hf7g8MDXgWsfpw="</span><span class="punctuation">,</span><span class="comment">//签名</span></span><br><span class="line"> <span class="attr">"dir"</span><span class="punctuation">:</span> <span class="string">"2023/06/11/"</span><span class="punctuation">,</span><span class="comment">//上传到的文件的地址</span></span><br><span class="line"> <span class="attr">"host"</span><span class="punctuation">:</span> <span class="string">"https://gulimall-0611.oss-cn-beijing.aliyuncs.com"</span><span class="punctuation">,</span><span class="comment">//上传到的主机的</span></span><br><span class="line"> <span class="attr">"expire"</span><span class="punctuation">:</span> <span class="string">"1686493052"</span><span class="comment">//过期时间</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>前端相关的代码</p>
|
||
<p><strong>前端相关的代码可以借鉴一下谷粒商城的前端上传文件的组件,里面封装了多文件上传和单文件上传的功能</strong></p>
|
||
<p><img src="/pictures/image-20230612111805518.png" alt="image-20230612111805518"></p>
|
||
<p>出现跨域的问题</p>
|
||
<p><img src="/pictures/image-20230612114314757.png" alt="image-20230612114314757"></p>
|
||
<p>解决方法</p>
|
||
<p><img src="/pictures/image-20230612114238391.png" alt="image-20230612114238391"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>云计算</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>Docker容器化技术</title>
|
||
<url>/posts/19306.html</url>
|
||
<content><![CDATA[<p><img src="/pictures/docker01.png" alt="img"></p>
|
||
<h2 id="1-Docker概念"><a href="#1-Docker概念" class="headerlink" title="1.Docker概念"></a>1.Docker概念</h2><p>• Docker 是一个开源的应用容器引擎 </p>
|
||
<p>• 诞生于 2013 年初,基于 Go 语言实现, dotCloud 公司出品(后改名为Docker Inc) </p>
|
||
<p>• Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级、可移植的容器中,然后发布到任何流行的 Linux 机器上。</p>
|
||
<p>• 容器是完全使用沙箱机制,相互隔离 </p>
|
||
<p>• 容器性能开销极低。</p>
|
||
<p>• Docker 从 17.03 版本之后分为 CE(Community Edition: 社区版) 和 EE(Enterprise Edition: 企业版)</p>
|
||
<h2 id="2-安装Docker"><a href="#2-安装Docker" class="headerlink" title="2.安装Docker"></a>2.安装Docker</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">1、yum 包更新到最新</span> </span><br><span class="line">yum update</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">2、安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的</span> </span><br><span class="line">yum install -y yum-utils device-mapper-persistent-data lvm2</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">3、 设置yum源</span></span><br><span class="line">yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">4、 安装docker,出现输入的界面都按 y</span> </span><br><span class="line">yum install -y docker-ce</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">5、 查看docker版本,验证是否验证成功</span></span><br><span class="line">docker -v</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="3-配置Docker镜像加速器"><a href="#3-配置Docker镜像加速器" class="headerlink" title="3.配置Docker镜像加速器"></a>3.配置Docker镜像加速器</h2><p>提升下载速度</p>
|
||
<h3 id="第一步:登录阿里云获取镜像加速地址"><a href="#第一步:登录阿里云获取镜像加速地址" class="headerlink" title="第一步:登录阿里云获取镜像加速地址"></a>第一步:登录阿里云获取镜像加速地址</h3><p>每个人的加速器地址不一样</p>
|
||
<p><img src="/pictures/image-20230421103035776.png" alt="image-20230421103035776"></p>
|
||
<h3 id="第二步:Linux命令行执行如下命令"><a href="#第二步:Linux命令行执行如下命令" class="headerlink" title="第二步:Linux命令行执行如下命令"></a>第二步:Linux命令行执行如下命令</h3><p>直接将阿里云上提供的命令直接粘贴到命令行即可</p>
|
||
<p><img src="/pictures/image-20230421103610184.png" alt="image-20230421103610184"></p>
|
||
<p><img src="/pictures/image-20230421103755984.png" alt="image-20230421103755984"></p>
|
||
<h3 id="第三步:查看是否配置成功"><a href="#第三步:查看是否配置成功" class="headerlink" title="第三步:查看是否配置成功"></a>第三步:查看是否配置成功</h3><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看刚才配置的文件是否存在</span></span><br><span class="line">cat /etc/docker/daemon.json</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>出现下图所示的内容表示配置成功</p>
|
||
<p><img src="/pictures/image-20230421104103726.png" alt="image-20230421104103726"></p>
|
||
<h2 id="4-Docker相关命令"><a href="#4-Docker相关命令" class="headerlink" title="4.Docker相关命令"></a>4.Docker相关命令</h2><h3 id="4-1-Docker进程相关的命令"><a href="#4-1-Docker进程相关的命令" class="headerlink" title="4.1 Docker进程相关的命令"></a>4.1 Docker进程相关的命令</h3><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">启动docker服务:</span></span><br><span class="line">systemctl start docker </span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">停止docker服务:</span></span><br><span class="line">systemctl stop docker </span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">重启docker服务:</span></span><br><span class="line">systemctl restart docker</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看docker服务状态:</span></span><br><span class="line">systemctl status docker </span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置开机启动docker服务:</span></span><br><span class="line">systemctl enable docker</span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
<h3 id="4-2-Docker镜像相关的命令"><a href="#4-2-Docker镜像相关的命令" class="headerlink" title="4.2 Docker镜像相关的命令"></a>4.2 Docker镜像相关的命令</h3><p>查看镜像对应版本号的网站: <a href="https://hub.docker.com/">https://hub.docker.com/</a></p>
|
||
<p><img src="/pictures/image-20230421110034731.png" alt="image-20230421110034731"></p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><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">docker images –q # 查看所用镜像的id</span><br><span class="line"><span class="meta prompt_"></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">搜索镜像:从网络中查找需要的镜像</span></span><br><span class="line">docker search 镜像名称</span><br><span class="line"><span class="meta prompt_"></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">拉取镜像:从Docker仓库下载镜像到本地,镜像名称格式为 名称:版本号,如果版本号不指定则是最新的版本。</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">如果不知道镜像版本,可以去docker hub 搜索对应镜像查看。</span></span><br><span class="line">docker pull 镜像名称 # 默认下载的是latest版本的镜像</span><br><span class="line">docker pull 镜像名称:版本号 #下载指定版本的镜像</span><br><span class="line"><span class="meta prompt_"></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">删除镜像: 删除本地镜像</span></span><br><span class="line">docker rmi 镜像id # 删除指定本地镜像</span><br><span class="line">docker rmi 镜像名称:版本号 #删除指定版本的镜像</span><br><span class="line">docker rmi `docker images -q` # 删除所有本地镜像</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
<h3 id="4-3-容器相关的命令"><a href="#4-3-容器相关的命令" class="headerlink" title="4.3 容器相关的命令"></a>4.3 容器相关的命令</h3><figure class="highlight shell"><table><tr><td class="code"><pre><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">docker ps –a # 查看所有容器</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 参数</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 rm $(docker ps -a -q)</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>参数说明:<br>• -i:保持容器运行。通常与 -t 同时使用。加入it这两个参数后,容器创建后自动进入容器中,退出容器后,容器自动关闭。<br>• -t:为容器重新分配一个伪输入终端,通常与 -i 同时使用。<br>• -d:以守护(后台)模式运行容器。创建一个容器在后台运行,需要使用docker exec 进入容器。退出后,容器不会关闭。<br>• -it 创建的容器一般称为交互式容器,-id 创建的容器一般称为守护式容器<br>• –name:为创建的容器命名。</p>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">进入容器</span></span><br><span class="line">docker exec 参数 # 退出容器,容器不会关闭</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">停止容器</span></span><br><span class="line">docker stop 容器名称</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">启动容器</span></span><br><span class="line">docker start 容器名称</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">删除容器:如果容器是运行状态则删除失败,需要停止容器才能删除</span></span><br><span class="line">docker rm 容器名称</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看容器信息</span></span><br><span class="line">docker inspect 容器名称</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看容器的日志信息</span></span><br><span class="line">docker logs 容器名称</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
<h2 id="5-Docker-应用部署"><a href="#5-Docker-应用部署" class="headerlink" title="5.Docker 应用部署"></a>5.Docker 应用部署</h2><div class="note danger flat"><p>Docker中常见的应用安装部署,详细内容请参考下面文章</p>
|
||
<p><a href="https://qingling.icu/posts/20683.html">Linux中开发环境的搭建 | The Blog (qingling.icu)</a></p>
|
||
</div>
|
||
|
||
<p><a href="https://qingling.icu/posts/63333.html">开发环境的搭建 | The Blog (qingling.icu)</a></p>
|
||
<p><strong>5.1、部署MySQL</strong></p>
|
||
<ol>
|
||
<li>搜索mysql镜像</li>
|
||
</ol>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">docker search mysql</span><br></pre></td></tr></table></figure>
|
||
|
||
<ol start="2">
|
||
<li>拉取mysql镜像</li>
|
||
</ol>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">docker pull mysql:5.6</span><br></pre></td></tr></table></figure>
|
||
|
||
<ol start="3">
|
||
<li>创建容器,设置端口映射、目录映射</li>
|
||
</ol>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">在/root目录下创建mysql目录用于存储mysql数据信息</span></span><br><span class="line">mkdir ~/mysql</span><br><span class="line">cd ~/mysql</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">docker run -id \</span><br><span class="line">-p 3307:3306 \</span><br><span class="line">--name=c_mysql \</span><br><span class="line">-v $PWD/conf:/etc/mysql/conf.d \</span><br><span class="line">-v $PWD/logs:/logs \</span><br><span class="line">-v $PWD/data:/var/lib/mysql \</span><br><span class="line">-e MYSQL_ROOT_PASSWORD=123456 \</span><br><span class="line">mysql:5.6</span><br></pre></td></tr></table></figure>
|
||
|
||
<ul>
|
||
<li>参数说明:<ul>
|
||
<li><strong>-p 3307:3306</strong>:将容器的 3306 端口映射到宿主机的 3307 端口。</li>
|
||
<li><strong>-v $PWD/conf:/etc/mysql/conf.d</strong>:将主机当前目录下的 conf/my.cnf 挂载到容器的 /etc/mysql/my.cnf。配置目录</li>
|
||
<li><strong>-v $PWD/logs:/logs</strong>:将主机当前目录下的 logs 目录挂载到容器的 /logs。日志目录</li>
|
||
<li><strong>-v $PWD/data:/var/lib/mysql</strong> :将主机当前目录下的data目录挂载到容器的 /var/lib/mysql 。数据目录</li>
|
||
<li><strong>-e MYSQL_ROOT_PASSWORD=123456:</strong>初始化 root 用户的密码。</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<ol start="4">
|
||
<li>进入容器,操作mysql</li>
|
||
</ol>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">docker exec –it c_mysql /bin/bash</span><br></pre></td></tr></table></figure>
|
||
|
||
<ol start="5">
|
||
<li>使用外部机器连接容器中的mysql</li>
|
||
</ol>
|
||
<p><img src="/pictures/1573636765632.png" alt="1573636765632"></p>
|
||
<p><strong>5.2、部署Tomcat</strong></p>
|
||
<ol>
|
||
<li>搜索tomcat镜像</li>
|
||
</ol>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">docker search tomcat</span><br></pre></td></tr></table></figure>
|
||
|
||
<ol start="2">
|
||
<li>拉取tomcat镜像</li>
|
||
</ol>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">docker pull tomcat</span><br></pre></td></tr></table></figure>
|
||
|
||
<ol start="3">
|
||
<li>创建容器,设置端口映射、目录映射</li>
|
||
</ol>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">在/root目录下创建tomcat目录用于存储tomcat数据信息</span></span><br><span class="line">mkdir ~/tomcat</span><br><span class="line">cd ~/tomcat</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">docker run -id --name=c_tomcat \</span><br><span class="line">-p 8080:8080 \</span><br><span class="line">-v $PWD:/usr/local/tomcat/webapps \</span><br><span class="line">tomcat </span><br></pre></td></tr></table></figure>
|
||
|
||
<ul>
|
||
<li><p>参数说明:</p>
|
||
<ul>
|
||
<li><p><strong>-p 8080:8080:</strong>将容器的8080端口映射到主机的8080端口</p>
|
||
<p><strong>-v $PWD:/usr/local/tomcat/webapps:</strong>将主机中当前目录挂载到容器的webapps</p>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<ol start="4">
|
||
<li>使用外部机器访问tomcat</li>
|
||
</ol>
|
||
<p><img src="/pictures/1573649804623.png" alt="1573649804623"></p>
|
||
<p><strong>5.3 部署Nginx</strong></p>
|
||
<ol>
|
||
<li>搜索nginx镜像</li>
|
||
</ol>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">docker search nginx</span><br></pre></td></tr></table></figure>
|
||
|
||
<ol start="2">
|
||
<li>拉取nginx镜像</li>
|
||
</ol>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">docker pull nginx</span><br></pre></td></tr></table></figure>
|
||
|
||
<ol start="3">
|
||
<li>创建容器,设置端口映射、目录映射</li>
|
||
</ol>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">在/root目录下创建nginx目录用于存储nginx数据信息</span></span><br><span class="line">mkdir ~/nginx</span><br><span class="line">cd ~/nginx</span><br><span class="line">mkdir conf</span><br><span class="line">cd conf</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">在~/nginx/conf/下创建nginx.conf文件,粘贴下面内容</span></span><br><span class="line">vim nginx.conf</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">user nginx;</span><br><span class="line">worker_processes 1;</span><br><span class="line"></span><br><span class="line">error_log /var/log/nginx/error.log warn;</span><br><span class="line">pid /var/run/nginx.pid;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">events {</span><br><span class="line"> worker_connections 1024;</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">http {</span><br><span class="line"> include /etc/nginx/mime.types;</span><br><span class="line"> default_type application/octet-stream;</span><br><span class="line"></span><br><span class="line"> log_format main '$remote_addr - $remote_user [$time_local] "$request" '</span><br><span class="line"> '$status $body_bytes_sent "$http_referer" '</span><br><span class="line"> '"$http_user_agent" "$http_x_forwarded_for"';</span><br><span class="line"></span><br><span class="line"> access_log /var/log/nginx/access.log main;</span><br><span class="line"></span><br><span class="line"> sendfile on;</span><br><span class="line"> #tcp_nopush on;</span><br><span class="line"></span><br><span class="line"> keepalive_timeout 65;</span><br><span class="line"></span><br><span class="line"> #gzip on;</span><br><span class="line"></span><br><span class="line"> include /etc/nginx/conf.d/*.conf;</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">docker run -id --name=c_nginx \</span><br><span class="line">-p 80:80 \</span><br><span class="line">-v $PWD/conf/nginx.conf:/etc/nginx/nginx.conf \</span><br><span class="line">-v $PWD/logs:/var/log/nginx \</span><br><span class="line">-v $PWD/html:/usr/share/nginx/html \</span><br><span class="line">nginx</span><br></pre></td></tr></table></figure>
|
||
|
||
<ul>
|
||
<li>参数说明:<ul>
|
||
<li><strong>-p 80:80</strong>:将容器的 80端口映射到宿主机的 80 端口。</li>
|
||
<li><strong>-v $PWD/conf/nginx.conf:/etc/nginx/nginx.conf</strong>:将主机当前目录下的 /conf/nginx.conf 挂载到容器的 :/etc/nginx/nginx.conf。配置目录</li>
|
||
<li><strong>-v $PWD/logs:/var/log/nginx</strong>:将主机当前目录下的 logs 目录挂载到容器的/var/log/nginx。日志目录</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<ol start="4">
|
||
<li>使用外部机器访问nginx</li>
|
||
</ol>
|
||
<p><img src="/pictures/1573652396669.png" alt="1573652396669"></p>
|
||
<p><strong>5.4 部署Redis</strong></p>
|
||
<ol>
|
||
<li>搜索redis镜像</li>
|
||
</ol>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">docker search redis</span><br></pre></td></tr></table></figure>
|
||
|
||
<ol start="2">
|
||
<li>拉取redis镜像</li>
|
||
</ol>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">docker pull redis:5.0</span><br></pre></td></tr></table></figure>
|
||
|
||
<ol start="3">
|
||
<li>创建容器,设置端口映射</li>
|
||
</ol>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">docker run -id --name=c_redis -p 6379:6379 redis:5.0</span><br></pre></td></tr></table></figure>
|
||
|
||
<ol start="4">
|
||
<li>使用外部机器连接redis</li>
|
||
</ol>
|
||
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">./redis-cli.exe -h 192.168.149.135 -p 6379</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>运维</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>Docker</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>微信登录</title>
|
||
<url>/posts/45572.html</url>
|
||
<content><![CDATA[<h2 id="1、OAuth2"><a href="#1、OAuth2" class="headerlink" title="1、OAuth2"></a>1、OAuth2</h2><p>微信登录使用了OAuth2解决方案</p>
|
||
<h3 id="1-1-OAuth2解决什么问题"><a href="#1-1-OAuth2解决什么问题" class="headerlink" title="1.1 OAuth2解决什么问题"></a>1.1 OAuth2解决什么问题</h3><h4 id="1-1-1-开放系统间授权"><a href="#1-1-1-开放系统间授权" class="headerlink" title="1.1.1 开放系统间授权"></a>1.1.1 开放系统间授权</h4><p>照片拥有者想要在云冲印服务上打印照片,云冲印服务需要访问云存储服务上的资源</p>
|
||
<p><img src="/pictures/clip_image002.jpg" alt="IMG_256"></p>
|
||
<h4 id="1-1-2图例"><a href="#1-1-2图例" class="headerlink" title="1.1.2图例"></a>1.1.2图例</h4><p>资源拥有者:照片拥有者</p>
|
||
<p>客户应用:云冲印</p>
|
||
<p>受保护的资源:照片</p>
|
||
<p><img src="/pictures/clip_image004.jpg" alt="IMG_256"></p>
|
||
<h4 id="1-1-3方式一:用户名密码复制"><a href="#1-1-3方式一:用户名密码复制" class="headerlink" title="1.1.3方式一:用户名密码复制"></a>1.1.3方式一:用户名密码复制</h4><p><img src="/pictures/clip_image006.jpg" alt="IMG_258"></p>
|
||
<p>用户将自己的”云存储”服务的用户名和密码,告诉”云冲印”,后者就可以读取用户的照片了。这样的做法有以下几个严重的缺点。</p>
|
||
<p>(1)”云冲印”为了后续的服务,会保存用户的密码,这样很不安全。</p>
|
||
<p>(2)Google不得不部署密码登录,而我们知道,单纯的密码登录并不安全。</p>
|
||
<p>(3)”云冲印”拥有了获取用户储存在Google所有资料的权力,用户没法限制”云冲印”获得授权的范围和有效期。</p>
|
||
<p>(4)用户只有修改密码,才能收回赋予”云冲印”的权力。但是这样做,会使得其他所有获得用户授权的第三方应用程序全部失效。</p>
|
||
<p>(5)只要有一个第三方应用程序被破解,就会导致用户密码泄漏,以及所有被密码保护的数据泄漏。</p>
|
||
<p><strong>总结:</strong></p>
|
||
<p>将受保护的资源中的用户名和密码存储在客户应用的服务器上,使用时直接使用这个用户名和密码登录</p>
|
||
<p>适用于同一公司内部的多个系统,不适用于不受信的第三方应用</p>
|
||
<h4 id="1-1-4方式二:通用开发者key"><a href="#1-1-4方式二:通用开发者key" class="headerlink" title="1.1.4方式二:通用开发者key"></a>1.1.4方式二:通用开发者key</h4><p>适用于合作商或者授信的不同业务部门之间</p>
|
||
<p><img src="/pictures/clip_image008.jpg" alt="IMG_259"></p>
|
||
<h4 id="1-1-5方式三:颁发令牌"><a href="#1-1-5方式三:颁发令牌" class="headerlink" title="1.1.5方式三:颁发令牌"></a>1.1.5方式三:颁发令牌</h4><p>接近OAuth2方式,需要考虑如何管理令牌、颁发令牌、吊销令牌,需要统一的协议,因此就有了OAuth2协议</p>
|
||
<p><img src="/pictures/clip_image010.jpg" alt="IMG_256"></p>
|
||
<p><strong>令牌类比仆从钥匙</strong></p>
|
||
<p><img src="/pictures/clip_image012.jpg" alt="IMG_256"></p>
|
||
<h3 id="1-2-OAuth2最简向导"><a href="#1-2-OAuth2最简向导" class="headerlink" title="1.2 OAuth2最简向导"></a>1.2 OAuth2最简向导</h3><h4 id="1-2-1-OAuth主要角色"><a href="#1-2-1-OAuth主要角色" class="headerlink" title="1.2.1 OAuth主要角色"></a>1.2.1 OAuth主要角色</h4><p><img src="/pictures/clip_image014.jpg" alt="IMG_256"></p>
|
||
<h4 id="1-2-2最简向导"><a href="#1-2-2最简向导" class="headerlink" title="1.2.2最简向导"></a>1.2.2最简向导</h4><p>川崎高彦:OAuth2领域专家,开发了一个OAuth2 sass服务,OAuth2 as Service,并且做成了一个公司</p>
|
||
<p>在融资的过程中为了向投资人解释OAuth2是什么,于是写了一篇文章,《OAuth2最简向导》</p>
|
||
<h3 id="1-3-OAuth2的应用"><a href="#1-3-OAuth2的应用" class="headerlink" title="1.3 OAuth2的应用"></a>1.3 OAuth2的应用</h3><h4 id="1-3-1-微服务安全"><a href="#1-3-1-微服务安全" class="headerlink" title="1.3.1 微服务安全"></a>1.3.1 微服务安全</h4><p>现代微服务中系统微服务化以及应用的形态和设备类型增多,不能用传统的登录方式</p>
|
||
<p>核心的技术不是用户名和密码,而是token,由AuthServer颁发token,用户使用token进行登录</p>
|
||
<p><img src="/pictures/clip_image016.jpg" alt="IMG_256"></p>
|
||
<h4 id="1-3-2-社交登录"><a href="#1-3-2-社交登录" class="headerlink" title="1.3.2 社交登录"></a>1.3.2 社交登录</h4><p><img src="/pictures/clip_image018.jpg"></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>1、注册</p>
|
||
<p>微信开放平台:<a href="https://open.weixin.qq.com/">https://open.weixin.qq.com</a></p>
|
||
<p>2、邮箱激活</p>
|
||
<p>3、完善开发者资料</p>
|
||
<p>4、开发者资质认证</p>
|
||
<p>准备营业执照,1-2个工作日审批、300元</p>
|
||
<p>5、创建网站应用</p>
|
||
<p>提交审核,7个工作日审批</p>
|
||
<p>6、内网穿透</p>
|
||
<p>ngrok的使用</p>
|
||
<h3 id="2-2-授权流程"><a href="#2-2-授权流程" class="headerlink" title="2.2 授权流程"></a>2.2 授权流程</h3><p>参考文档:<a href="https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419316505&token=e547653f995d8f402704d5cb2945177dc8aa4e7e&lang=zh_CN">https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419316505&token=e547653f995d8f402704d5cb2945177dc8aa4e7e&lang=zh_CN</a></p>
|
||
<p><strong>获取access_token时序图</strong></p>
|
||
<p><img src="/pictures/clip_image002.gif" alt="IMG_256"></p>
|
||
<p>第一步:请求CODE(生成授权URL)</p>
|
||
<p>第二步:通过code获取access_token(开发回调URL)</p>
|
||
<h2 id="3、使用教程"><a href="#3、使用教程" class="headerlink" title="3、使用教程"></a>3、使用教程</h2><p>由于微信登录需要企业用户才能注册,这里我们使用的是尚硅谷的密钥</p>
|
||
<p>当前项目的启动端口设置为 8160 才可以获取到登录的二维码</p>
|
||
<h3 id="3-1-配置文件中添加配置"><a href="#3-1-配置文件中添加配置" class="headerlink" title="3.1 配置文件中添加配置"></a>3.1 配置文件中添加配置</h3><figure class="highlight properties"><table><tr><td class="code"><pre><span class="line"><span class="comment"># 微信开放平台appid</span></span><br><span class="line"><span class="attr">wx.open.app_id</span>=<span class="string">wxed9954c01bb89b47</span></span><br><span class="line"><span class="comment"># 微信开放平台appsecret</span></span><br><span class="line"><span class="attr">wx.open.app_secret</span>=<span class="string">a7482517235173ddb4083788de60b90e</span></span><br><span class="line"><span class="comment">#回调的地址</span></span><br><span class="line"><span class="attr">wx.open.redirect_url</span>=<span class="string">http://localhost:8160/api/ucenter/wx/callback</span></span><br><span class="line"><span class="comment">#前端项目的地址</span></span><br><span class="line"><span class="attr">yygh.baseUrl</span>=<span class="string">http://localhost:3000</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-2-编写配置类读取配置文件中的值"><a href="#3-2-编写配置类读取配置文件中的值" class="headerlink" title="3.2 编写配置类读取配置文件中的值"></a>3.2 编写配置类读取配置文件中的值</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> org.springframework.beans.factory.InitializingBean;</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.stereotype.Component;</span><br><span class="line"></span><br><span class="line"><span class="meta">@Component</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ConstantPropertiesUtil</span> <span class="keyword">implements</span> <span class="title class_">InitializingBean</span> {</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Value("${wx.open.app_id}")</span></span><br><span class="line"> <span class="keyword">private</span> String appId;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Value("${wx.open.app_secret}")</span></span><br><span class="line"> <span class="keyword">private</span> String appSecret;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Value("${wx.open.redirect_url}")</span></span><br><span class="line"> <span class="keyword">private</span> String redirectUrl;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Value("${yygh.baseUrl}")</span></span><br><span class="line"> <span class="keyword">private</span> String yyghBaseUrl;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String WX_OPEN_APP_ID;</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String WX_OPEN_APP_SECRET;</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String WX_OPEN_REDIRECT_URL;</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String YYGH_BASE_URL;</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> <span class="keyword">void</span> <span class="title function_">afterPropertiesSet</span><span class="params">()</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> WX_OPEN_APP_ID = appId;</span><br><span class="line"> WX_OPEN_APP_SECRET = appSecret;</span><br><span class="line"> WX_OPEN_REDIRECT_URL = redirectUrl;</span><br><span class="line"> YYGH_BASE_URL = yyghBaseUrl;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-3-生成二维码和扫描二维码之后的回调操作"><a href="#3-3-生成二维码和扫描二维码之后的回调操作" class="headerlink" title="3.3 生成二维码和扫描二维码之后的回调操作"></a>3.3 生成二维码和扫描二维码之后的回调操作</h3><h4 id="3-3-1-生成二维码"><a href="#3-3-1-生成二维码" class="headerlink" title="3.3.1 生成二维码"></a>3.3.1 生成二维码</h4><p>生成内嵌的二维码</p>
|
||
<p>返回给前端的相关参数</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th align="left">参数</th>
|
||
<th align="left">是否必须</th>
|
||
<th align="left">说明</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td align="left">self_redirect</td>
|
||
<td align="left">否</td>
|
||
<td align="left">true:手机点击确认登录后可以在 iframe 内跳转到 redirect_uri,false:手机点击确认登录后可以在 top window 跳转到 redirect_uri。默认为 false。</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="left">id</td>
|
||
<td align="left">是</td>
|
||
<td align="left">第三方页面显示二维码的容器id</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="left">appid</td>
|
||
<td align="left">是</td>
|
||
<td align="left">应用唯一标识,在微信开放平台提交应用审核通过后获得</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="left">scope</td>
|
||
<td align="left">是</td>
|
||
<td align="left">应用授权作用域,拥有多个作用域用逗号(,)分隔,网页应用目前仅填写snsapi_login即可</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="left">redirect_uri</td>
|
||
<td align="left">是</td>
|
||
<td align="left">重定向地址,需要进行UrlEncode</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="left">state</td>
|
||
<td align="left">否</td>
|
||
<td align="left">用于保持请求和回调的状态,授权请求后原样带回给第三方。该参数可用于防止csrf攻击(跨站请求伪造攻击),建议第三方带上该参数,可设置为简单的随机数加session进行校验</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="left">style</td>
|
||
<td align="left">否</td>
|
||
<td align="left">提供”black”、”white”可选,默认为黑色文字描述。详见文档底部FAQ</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="left">href</td>
|
||
<td align="left">否</td>
|
||
<td align="left">自定义样式链接,第三方可根据实际需求覆盖默认样式。详见文档底部FAQ</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<p>生成扫描二维码的后端部分</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> com.atguigu.yygh.common.result.Result;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.yygh.user.utils.ConstantPropertiesUtil;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Controller;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.CrossOrigin;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.GetMapping;</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.ResponseBody;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.UnsupportedEncodingException;</span><br><span class="line"><span class="keyword">import</span> java.net.URLEncoder;</span><br><span class="line"><span class="keyword">import</span> java.util.HashMap;</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/4/20</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">@Controller</span></span><br><span class="line"><span class="meta">@RequestMapping("/api/ucenter/wx")</span></span><br><span class="line"><span class="meta">@CrossOrigin</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WxController</span> {</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">@GetMapping("/getLoginParameters")</span></span><br><span class="line"> <span class="meta">@ResponseBody</span></span><br><span class="line"> <span class="keyword">public</span> Result <span class="title function_">getLoginParameters</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> HashMap<String, Object> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> map.put(<span class="string">"appid"</span>, ConstantPropertiesUtil.WX_OPEN_APP_ID);</span><br><span class="line"> map.put(<span class="string">"scope"</span>, <span class="string">"snsapi_login"</span>);</span><br><span class="line"> map.put(<span class="string">"redirect_uri"</span>, URLEncoder.encode(ConstantPropertiesUtil.WX_OPEN_REDIRECT_URL, <span class="string">"utf-8"</span>));</span><br><span class="line"> map.put(<span class="string">"state"</span>, System.currentTimeMillis() + <span class="string">""</span>);<span class="comment">//原样返回,可以没有</span></span><br><span class="line"> <span class="keyword">return</span> Result.ok(map);</span><br><span class="line"> } <span class="keyword">catch</span> (UnsupportedEncodingException e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> <span class="keyword">return</span> Result.fail();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>生成扫描二维码的前端部分</p>
|
||
<p>JS部分</p>
|
||
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> request <span class="keyword">from</span> <span class="string">'@/utils/request'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">export</span> <span class="keyword">default</span> {</span><br><span class="line"> <span class="comment">//获取生成二维码需要的参数信息</span></span><br><span class="line"> <span class="title function_">getLoginParam</span>(<span class="params"></span>) {</span><br><span class="line"> <span class="keyword">return</span> <span class="title function_">request</span>({</span><br><span class="line"> <span class="attr">url</span>: <span class="string">`/api/ucenter/wx/getLoginParam`</span>,</span><br><span class="line"> <span class="attr">method</span>: <span class="string">'get'</span></span><br><span class="line"> })</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>引入api</p>
|
||
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> weixinApi <span class="keyword">from</span> <span class="string">"@/api/weixin"</span>;</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>在mounted()方法中初始化微信js</p>
|
||
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line"><span class="title function_">mounted</span>(<span class="params"></span>) {</span><br><span class="line"> <span class="comment">//初始化微信js</span></span><br><span class="line"> <span class="keyword">const</span> script = <span class="variable language_">document</span>.<span class="title function_">createElement</span>(<span class="string">'script'</span>)</span><br><span class="line"> script.<span class="property">type</span> = <span class="string">'text/javascript'</span></span><br><span class="line"> script.<span class="property">src</span> = <span class="string">'https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js'</span></span><br><span class="line"> <span class="variable language_">document</span>.<span class="property">body</span>.<span class="title function_">appendChild</span>(script)</span><br><span class="line"> },</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>在页面中微信登录按钮绑定的是weixinLogin()点击事件,所以我们要在这个方法中初始化对象</p>
|
||
<p>向后端发起请求获取生成二维码需要的参数信息</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line">weixinLogin() {</span><br><span class="line"> weixinApi.getLoginParam().then((response) => {</span><br><span class="line"> <span class="type">var</span> <span class="variable">obj</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">WxLogin</span>({</span><br><span class="line"> self_redirect: <span class="literal">true</span>,</span><br><span class="line"> id: <span class="string">"weixinLogin"</span>, <span class="comment">// 需要显示的容器id <div id="weixinLogin"></div></span></span><br><span class="line"> appid: response.data.appid, <span class="comment">// appid</span></span><br><span class="line"> scope: response.data.scope, <span class="comment">// 网页默认即可</span></span><br><span class="line"> redirect_uri: response.data.redirectUri, <span class="comment">// 授权成功后回调的url</span></span><br><span class="line"> state: response.data.state, <span class="comment">// 可设置为简单的随机数加session用来校验</span></span><br><span class="line"> style: <span class="string">"black"</span>, <span class="comment">//。二维码的样式, 提供"black"、"white"可选</span></span><br><span class="line"> href: <span class="string">""</span>, <span class="comment">// 外部css文件url,需要https</span></span><br><span class="line"> });</span><br><span class="line"> });</span><br><span class="line"> },</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>点击微信登录之后,页面上的效果</p>
|
||
<p><img src="/pictures/image-20230421203717902.png" alt="image-20230421203717902"></p>
|
||
<h4 id="3-3-2-处理用户扫描成功之后的回调"><a href="#3-3-2-处理用户扫描成功之后的回调" class="headerlink" title="3.3.2 处理用户扫描成功之后的回调"></a>3.3.2 处理用户扫描成功之后的回调</h4><p>实现的思路:</p>
|
||
<p>用户扫描二维码 -> 点击确认 -> 会执行回调请求(请求配置文件中这个地址wx.open.redirect_url=<a href="http://localhost:8160/api/ucenter/wx/callback">http://localhost:8160/api/ucenter/wx/callback</a>) -> 获取回调请求中携带的参数,再根据参数获取扫描用户的信息,执行相关的操作</p>
|
||
<p>扫描成功之后发起如下的请求:</p>
|
||
<p><img src="/pictures/image-20230421205258647.png" alt="image-20230421205258647"></p>
|
||
<p><img src="/pictures/image-20230421210454720.png" alt="image-20230421210454720"></p>
|
||
<p>引入httpclient(不依赖浏览器发起请求)依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.apache.httpcomponents<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>httpclient<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>4.5.1<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>导入HttpClientUtils工具类</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> org.apache.commons.io.IOUtils;</span><br><span class="line"><span class="keyword">import</span> org.apache.commons.lang.StringUtils;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.Consts;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.HttpEntity;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.HttpResponse;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.NameValuePair;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.client.HttpClient;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.client.config.RequestConfig;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.client.config.RequestConfig.Builder;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.client.entity.UrlEncodedFormEntity;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.client.methods.HttpGet;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.client.methods.HttpPost;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.conn.ConnectTimeoutException;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.conn.ssl.SSLConnectionSocketFactory;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.conn.ssl.SSLContextBuilder;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.conn.ssl.TrustStrategy;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.conn.ssl.X509HostnameVerifier;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.entity.ContentType;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.entity.StringEntity;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.impl.client.CloseableHttpClient;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.impl.client.HttpClients;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.impl.conn.PoolingHttpClientConnectionManager;</span><br><span class="line"><span class="keyword">import</span> org.apache.http.message.BasicNameValuePair;</span><br><span class="line"><span class="keyword">import</span> javax.net.ssl.SSLContext;</span><br><span class="line"><span class="keyword">import</span> javax.net.ssl.SSLException;</span><br><span class="line"><span class="keyword">import</span> javax.net.ssl.SSLSession;</span><br><span class="line"><span class="keyword">import</span> javax.net.ssl.SSLSocket;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.net.SocketTimeoutException;</span><br><span class="line"><span class="keyword">import</span> java.security.GeneralSecurityException;</span><br><span class="line"><span class="keyword">import</span> java.security.cert.CertificateException;</span><br><span class="line"><span class="keyword">import</span> java.security.cert.X509Certificate;</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 class="keyword">import</span> java.util.Map;</span><br><span class="line"><span class="keyword">import</span> java.util.Map.Entry;</span><br><span class="line"><span class="keyword">import</span> java.util.Set;</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/4/21</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">class</span> <span class="title class_">HttpClientUtils</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">int</span> connTimeout=<span class="number">10000</span>;</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">int</span> readTimeout=<span class="number">10000</span>;</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> String charset=<span class="string">"UTF-8"</span>;</span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">static</span> <span class="type">HttpClient</span> <span class="variable">client</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">static</span> {</span><br><span class="line"> <span class="type">PoolingHttpClientConnectionManager</span> <span class="variable">cm</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">PoolingHttpClientConnectionManager</span>();</span><br><span class="line"> cm.setMaxTotal(<span class="number">128</span>);</span><br><span class="line"> cm.setDefaultMaxPerRoute(<span class="number">128</span>);</span><br><span class="line"> client = HttpClients.custom().setConnectionManager(cm).build();</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String <span class="title function_">postParameters</span><span class="params">(String url, String parameterStr)</span> <span class="keyword">throws</span> ConnectTimeoutException, SocketTimeoutException, Exception{</span><br><span class="line"> <span class="keyword">return</span> post(url,parameterStr,<span class="string">"application/x-www-form-urlencoded"</span>,charset,connTimeout,readTimeout);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String <span class="title function_">postParameters</span><span class="params">(String url, String parameterStr,String charset, Integer connTimeout, Integer readTimeout)</span> <span class="keyword">throws</span> ConnectTimeoutException, SocketTimeoutException, Exception{</span><br><span class="line"> <span class="keyword">return</span> post(url,parameterStr,<span class="string">"application/x-www-form-urlencoded"</span>,charset,connTimeout,readTimeout);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String <span class="title function_">postParameters</span><span class="params">(String url, Map<String, String> params)</span> <span class="keyword">throws</span> ConnectTimeoutException,</span><br><span class="line"> SocketTimeoutException, Exception {</span><br><span class="line"> <span class="keyword">return</span> postForm(url, params, <span class="literal">null</span>, connTimeout, readTimeout);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String <span class="title function_">postParameters</span><span class="params">(String url, Map<String, String> params, Integer connTimeout,Integer readTimeout)</span> <span class="keyword">throws</span> ConnectTimeoutException,</span><br><span class="line"> SocketTimeoutException, Exception {</span><br><span class="line"> <span class="keyword">return</span> postForm(url, params, <span class="literal">null</span>, connTimeout, readTimeout);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String <span class="title function_">get</span><span class="params">(String url)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> <span class="keyword">return</span> get(url, charset, <span class="literal">null</span>, <span class="literal">null</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String <span class="title function_">get</span><span class="params">(String url, String charset)</span> <span class="keyword">throws</span> Exception {</span><br><span class="line"> <span class="keyword">return</span> get(url, charset, connTimeout, readTimeout);</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"> * 发送一个 Post 请求, 使用指定的字符集编码.</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> url</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> body RequestBody</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> mimeType 例如 application/xml "application/x-www-form-urlencoded" a=1&b=2&c=3</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> charset 编码</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> connTimeout 建立链接超时时间,毫秒.</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> readTimeout 响应超时时间,毫秒.</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> ResponseBody, 使用指定的字符集编码.</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@throws</span> ConnectTimeoutException 建立链接超时异常</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@throws</span> SocketTimeoutException 响应超时</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@throws</span> Exception</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String <span class="title function_">post</span><span class="params">(String url, String body, String mimeType,String charset, Integer connTimeout, Integer readTimeout)</span></span><br><span class="line"> <span class="keyword">throws</span> ConnectTimeoutException, SocketTimeoutException, Exception {</span><br><span class="line"> <span class="type">HttpClient</span> <span class="variable">client</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> <span class="type">HttpPost</span> <span class="variable">post</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">HttpPost</span>(url);</span><br><span class="line"> <span class="type">String</span> <span class="variable">result</span> <span class="operator">=</span> <span class="string">""</span>;</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="keyword">if</span> (StringUtils.isNotBlank(body)) {</span><br><span class="line"> <span class="type">HttpEntity</span> <span class="variable">entity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">StringEntity</span>(body, ContentType.create(mimeType, charset));</span><br><span class="line"> post.setEntity(entity);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">// 设置参数</span></span><br><span class="line"> <span class="type">Builder</span> <span class="variable">customReqConf</span> <span class="operator">=</span> RequestConfig.custom();</span><br><span class="line"> <span class="keyword">if</span> (connTimeout != <span class="literal">null</span>) {</span><br><span class="line"> customReqConf.setConnectTimeout(connTimeout);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (readTimeout != <span class="literal">null</span>) {</span><br><span class="line"> customReqConf.setSocketTimeout(readTimeout);</span><br><span class="line"> }</span><br><span class="line"> post.setConfig(customReqConf.build());</span><br><span class="line"></span><br><span class="line"> HttpResponse res;</span><br><span class="line"> <span class="keyword">if</span> (url.startsWith(<span class="string">"https"</span>)) {</span><br><span class="line"> <span class="comment">// 执行 Https 请求.</span></span><br><span class="line"> client = createSSLInsecureClient();</span><br><span class="line"> res = client.execute(post);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">// 执行 Http 请求.</span></span><br><span class="line"> client = HttpClientUtils.client;</span><br><span class="line"> res = client.execute(post);</span><br><span class="line"> }</span><br><span class="line"> result = IOUtils.toString(res.getEntity().getContent(), charset);</span><br><span class="line"> } <span class="keyword">finally</span> {</span><br><span class="line"> post.releaseConnection();</span><br><span class="line"> <span class="keyword">if</span> (url.startsWith(<span class="string">"https"</span>) && client != <span class="literal">null</span>&& client <span class="keyword">instanceof</span> CloseableHttpClient) {</span><br><span class="line"> ((CloseableHttpClient) client).close();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> result;</span><br><span class="line"> }</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"> * 提交form表单</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> url</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> connTimeout</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> readTimeout</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span></span></span><br><span class="line"><span class="comment"> * <span class="doctag">@throws</span> ConnectTimeoutException</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@throws</span> SocketTimeoutException</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@throws</span> Exception</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String <span class="title function_">postForm</span><span class="params">(String url, Map<String, String> params, Map<String, String> headers, Integer connTimeout,Integer readTimeout)</span> <span class="keyword">throws</span> ConnectTimeoutException,</span><br><span class="line"> SocketTimeoutException, Exception {</span><br><span class="line"></span><br><span class="line"> <span class="type">HttpClient</span> <span class="variable">client</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> <span class="type">HttpPost</span> <span class="variable">post</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">HttpPost</span>(url);</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="keyword">if</span> (params != <span class="literal">null</span> && !params.isEmpty()) {</span><br><span class="line"> List<NameValuePair> formParams = <span class="keyword">new</span> <span class="title class_">ArrayList</span><NameValuePair>();</span><br><span class="line"> Set<Entry<String, String>> entrySet = params.entrySet();</span><br><span class="line"> <span class="keyword">for</span> (Entry<String, String> entry : entrySet) {</span><br><span class="line"> formParams.add(<span class="keyword">new</span> <span class="title class_">BasicNameValuePair</span>(entry.getKey(), entry.getValue()));</span><br><span class="line"> }</span><br><span class="line"> <span class="type">UrlEncodedFormEntity</span> <span class="variable">entity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">UrlEncodedFormEntity</span>(formParams, Consts.UTF_8);</span><br><span class="line"> post.setEntity(entity);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span> (headers != <span class="literal">null</span> && !headers.isEmpty()) {</span><br><span class="line"> <span class="keyword">for</span> (Entry<String, String> entry : headers.entrySet()) {</span><br><span class="line"> post.addHeader(entry.getKey(), entry.getValue());</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="type">Builder</span> <span class="variable">customReqConf</span> <span class="operator">=</span> RequestConfig.custom();</span><br><span class="line"> <span class="keyword">if</span> (connTimeout != <span class="literal">null</span>) {</span><br><span class="line"> customReqConf.setConnectTimeout(connTimeout);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (readTimeout != <span class="literal">null</span>) {</span><br><span class="line"> customReqConf.setSocketTimeout(readTimeout);</span><br><span class="line"> }</span><br><span class="line"> post.setConfig(customReqConf.build());</span><br><span class="line"> <span class="type">HttpResponse</span> <span class="variable">res</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> <span class="keyword">if</span> (url.startsWith(<span class="string">"https"</span>)) {</span><br><span class="line"> <span class="comment">// 执行 Https 请求.</span></span><br><span class="line"> client = createSSLInsecureClient();</span><br><span class="line"> res = client.execute(post);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">// 执行 Http 请求.</span></span><br><span class="line"> client = HttpClientUtils.client;</span><br><span class="line"> res = client.execute(post);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> IOUtils.toString(res.getEntity().getContent(), <span class="string">"UTF-8"</span>);</span><br><span class="line"> } <span class="keyword">finally</span> {</span><br><span class="line"> post.releaseConnection();</span><br><span class="line"> <span class="keyword">if</span> (url.startsWith(<span class="string">"https"</span>) && client != <span class="literal">null</span></span><br><span class="line"> && client <span class="keyword">instanceof</span> CloseableHttpClient) {</span><br><span class="line"> ((CloseableHttpClient) client).close();</span><br><span class="line"> }</span><br><span class="line"> }</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"> * 发送一个 GET 请求</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String <span class="title function_">get</span><span class="params">(String url, String charset, Integer connTimeout,Integer readTimeout)</span></span><br><span class="line"> <span class="keyword">throws</span> ConnectTimeoutException,SocketTimeoutException, Exception {</span><br><span class="line"></span><br><span class="line"> <span class="type">HttpClient</span> <span class="variable">client</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> <span class="type">HttpGet</span> <span class="variable">get</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">HttpGet</span>(url);</span><br><span class="line"> <span class="type">String</span> <span class="variable">result</span> <span class="operator">=</span> <span class="string">""</span>;</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="comment">// 设置参数</span></span><br><span class="line"> <span class="type">Builder</span> <span class="variable">customReqConf</span> <span class="operator">=</span> RequestConfig.custom();</span><br><span class="line"> <span class="keyword">if</span> (connTimeout != <span class="literal">null</span>) {</span><br><span class="line"> customReqConf.setConnectTimeout(connTimeout);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (readTimeout != <span class="literal">null</span>) {</span><br><span class="line"> customReqConf.setSocketTimeout(readTimeout);</span><br><span class="line"> }</span><br><span class="line"> get.setConfig(customReqConf.build());</span><br><span class="line"></span><br><span class="line"> <span class="type">HttpResponse</span> <span class="variable">res</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span> (url.startsWith(<span class="string">"https"</span>)) {</span><br><span class="line"> <span class="comment">// 执行 Https 请求.</span></span><br><span class="line"> client = createSSLInsecureClient();</span><br><span class="line"> res = client.execute(get);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">// 执行 Http 请求.</span></span><br><span class="line"> client = HttpClientUtils.client;</span><br><span class="line"> res = client.execute(get);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> result = IOUtils.toString(res.getEntity().getContent(), charset);</span><br><span class="line"> } <span class="keyword">finally</span> {</span><br><span class="line"> get.releaseConnection();</span><br><span class="line"> <span class="keyword">if</span> (url.startsWith(<span class="string">"https"</span>) && client != <span class="literal">null</span> && client <span class="keyword">instanceof</span> CloseableHttpClient) {</span><br><span class="line"> ((CloseableHttpClient) client).close();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> result;</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"> * 从 response 里获取 charset</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@SuppressWarnings("unused")</span></span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">static</span> String <span class="title function_">getCharsetFromResponse</span><span class="params">(HttpResponse ressponse)</span> {</span><br><span class="line"> <span class="comment">// Content-Type:text/html; charset=GBK</span></span><br><span class="line"> <span class="keyword">if</span> (ressponse.getEntity() != <span class="literal">null</span> && ressponse.getEntity().getContentType() != <span class="literal">null</span> && ressponse.getEntity().getContentType().getValue() != <span class="literal">null</span>) {</span><br><span class="line"> <span class="type">String</span> <span class="variable">contentType</span> <span class="operator">=</span> ressponse.getEntity().getContentType().getValue();</span><br><span class="line"> <span class="keyword">if</span> (contentType.contains(<span class="string">"charset="</span>)) {</span><br><span class="line"> <span class="keyword">return</span> contentType.substring(contentType.indexOf(<span class="string">"charset="</span>) + <span class="number">8</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</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"> * 创建 SSL连接</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span></span></span><br><span class="line"><span class="comment"> * <span class="doctag">@throws</span> GeneralSecurityException</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">static</span> CloseableHttpClient <span class="title function_">createSSLInsecureClient</span><span class="params">()</span> <span class="keyword">throws</span> GeneralSecurityException {</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">SSLContext</span> <span class="variable">sslContext</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SSLContextBuilder</span>().loadTrustMaterial(<span class="literal">null</span>, <span class="keyword">new</span> <span class="title class_">TrustStrategy</span>() {</span><br><span class="line"> <span class="keyword">public</span> <span class="type">boolean</span> <span class="title function_">isTrusted</span><span class="params">(X509Certificate[] chain,String authType)</span> <span class="keyword">throws</span> CertificateException {</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line"> }</span><br><span class="line"> }).build();</span><br><span class="line"></span><br><span class="line"> <span class="type">SSLConnectionSocketFactory</span> <span class="variable">sslsf</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SSLConnectionSocketFactory</span>(sslContext, <span class="keyword">new</span> <span class="title class_">X509HostnameVerifier</span>() {</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> <span class="type">boolean</span> <span class="title function_">verify</span><span class="params">(String arg0, SSLSession arg1)</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line"> }</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> <span class="keyword">void</span> <span class="title function_">verify</span><span class="params">(String host, SSLSocket ssl)</span></span><br><span class="line"> <span class="keyword">throws</span> IOException {</span><br><span class="line"> }</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> <span class="keyword">void</span> <span class="title function_">verify</span><span class="params">(String host, X509Certificate cert)</span></span><br><span class="line"> <span class="keyword">throws</span> SSLException {</span><br><span class="line"> }</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> <span class="keyword">void</span> <span class="title function_">verify</span><span class="params">(String host, String[] cns,</span></span><br><span class="line"><span class="params"> String[] subjectAlts)</span> <span class="keyword">throws</span> SSLException {</span><br><span class="line"> }</span><br><span class="line"> });</span><br><span class="line"> <span class="keyword">return</span> HttpClients.custom().setSSLSocketFactory(sslsf).build();</span><br><span class="line"></span><br><span class="line"> } <span class="keyword">catch</span> (GeneralSecurityException e) {</span><br><span class="line"> <span class="keyword">throw</span> e;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>Controller</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.yygh.user.controller;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.alibaba.fastjson.JSONObject;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.yygh.common.result.Result;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.yygh.user.utils.ConstantPropertiesUtil;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.yygh.user.utils.HttpClientUtils;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Controller;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.CrossOrigin;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.GetMapping;</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.ResponseBody;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.UnsupportedEncodingException;</span><br><span class="line"><span class="keyword">import</span> java.net.URLEncoder;</span><br><span class="line"><span class="keyword">import</span> java.util.HashMap;</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/4/20</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">@Controller</span></span><br><span class="line"><span class="meta">@RequestMapping("/api/ucenter/wx")</span></span><br><span class="line"><span class="meta">@CrossOrigin</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WxController</span> {</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">@GetMapping("/getLoginParam")</span></span><br><span class="line"> <span class="meta">@ResponseBody</span></span><br><span class="line"> <span class="keyword">public</span> Result <span class="title function_">getLoginParameters</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> HashMap<String, Object> map = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> map.put(<span class="string">"appid"</span>, ConstantPropertiesUtil.WX_OPEN_APP_ID);</span><br><span class="line"> map.put(<span class="string">"scope"</span>, <span class="string">"snsapi_login"</span>);</span><br><span class="line"> map.put(<span class="string">"redirect_uri"</span>, URLEncoder.encode(ConstantPropertiesUtil.WX_OPEN_REDIRECT_URL, <span class="string">"utf-8"</span>));</span><br><span class="line"> map.put(<span class="string">"state"</span>, System.currentTimeMillis() + <span class="string">""</span>);<span class="comment">//原样返回,可以没有</span></span><br><span class="line"> <span class="keyword">return</span> Result.ok(map);</span><br><span class="line"> } <span class="keyword">catch</span> (UnsupportedEncodingException e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> <span class="keyword">return</span> Result.fail();</span><br><span class="line"> }</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 class="doctag">@param</span> code 临时票据</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> state 生成微信二维码之前put进去的参数 原样返回</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("/callback")</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">callback</span><span class="params">(String code ,String state)</span>{</span><br><span class="line"> <span class="comment">//通过code、appid和app_secret去请求固定地址换取access_token</span></span><br><span class="line"> <span class="type">StringBuffer</span> <span class="variable">baseAccessTokenUrl</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">StringBuffer</span>()</span><br><span class="line"> .append(<span class="string">"https://api.weixin.qq.com/sns/oauth2/access_token"</span>) <span class="comment">//请求的固定地址</span></span><br><span class="line"> .append(<span class="string">"?appid=%s"</span>) <span class="comment">//%s占位符</span></span><br><span class="line"> .append(<span class="string">"&secret=%s"</span>)</span><br><span class="line"> .append(<span class="string">"&code=%s"</span>)</span><br><span class="line"> .append(<span class="string">"&grant_type=authorization_code"</span>);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//拼接完整之后的地址</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">accessTokenUrl</span> <span class="operator">=</span> String.format(baseAccessTokenUrl.toString(),</span><br><span class="line"> ConstantPropertiesUtil.WX_OPEN_APP_ID,</span><br><span class="line"> ConstantPropertiesUtil.WX_OPEN_APP_SECRET,</span><br><span class="line"> code);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//使用httpclient去请求这个地址换取access_token</span></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">String</span> <span class="variable">accessTokenInfo</span> <span class="operator">=</span> HttpClientUtils.get(accessTokenUrl);<span class="comment">//json格式的字符串</span></span><br><span class="line"> <span class="comment">//从这个字符串中获取openid和 access_token的值</span></span><br><span class="line"> <span class="type">JSONObject</span> <span class="variable">jsonObject</span> <span class="operator">=</span> JSONObject.parseObject(accessTokenInfo);</span><br><span class="line"> <span class="type">String</span> <span class="variable">accessToken</span> <span class="operator">=</span> jsonObject.getString(<span class="string">"access_token"</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">openid</span> <span class="operator">=</span> jsonObject.getString(<span class="string">"openid"</span>);</span><br><span class="line"> <span class="comment">//根据access_token和openid获取微信用户的基本信息</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">baseUserInfoUrl</span> <span class="operator">=</span> <span class="string">"https://api.weixin.qq.com/sns/userinfo"</span> +</span><br><span class="line"> <span class="string">"?access_token=%s"</span> +</span><br><span class="line"> <span class="string">"&openid=%s"</span>;</span><br><span class="line"> <span class="type">String</span> <span class="variable">userInfoUrl</span> <span class="operator">=</span> String.format(baseUserInfoUrl, accessToken, openid);</span><br><span class="line"> <span class="comment">//发起请求获取用户信息</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">userInfo</span> <span class="operator">=</span> HttpClientUtils.get(userInfoUrl);<span class="comment">//json格式的字符串</span></span><br><span class="line"> <span class="type">JSONObject</span> <span class="variable">parseObject</span> <span class="operator">=</span> JSONObject.parseObject(userInfo);</span><br><span class="line"> <span class="comment">//获取具体的用户信息</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">nickname</span> <span class="operator">=</span> parseObject.getString(<span class="string">"nickname"</span>);<span class="comment">//用户昵称</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">sex</span> <span class="operator">=</span> parseObject.getString(<span class="string">"sex"</span>);<span class="comment">//性别</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">language</span> <span class="operator">=</span> parseObject.getString(<span class="string">"language"</span>);<span class="comment">//语言</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">city</span> <span class="operator">=</span> parseObject.getString(<span class="string">"city"</span>);<span class="comment">//所在城市</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">province</span> <span class="operator">=</span> parseObject.getString(<span class="string">"province"</span>);<span class="comment">//省份</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">country</span> <span class="operator">=</span> parseObject.getString(<span class="string">"country"</span>);<span class="comment">//注册国家</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">headimgurl</span> <span class="operator">=</span> parseObject.getString(<span class="string">"headimgurl"</span>);<span class="comment">//头像的url地址</span></span><br><span class="line"> System.out.println(<span class="string">"昵称:"</span>+nickname+<span class="string">",性别:"</span>+sex+<span class="string">",语言:"</span>+language+<span class="string">",城市:"</span>+city+<span class="string">",省份:"</span>+province+<span class="string">",注册国家:"</span>+country+<span class="string">",头像地址:"</span>+headimgurl);</span><br><span class="line"> <span class="comment">//TODO 将扫码人的信息添加到数据库中</span></span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"redirect:地址信息&参数信息(用户信息或者token信息等)"</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>Java</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>JWT-token生成工具</title>
|
||
<url>/posts/28118.html</url>
|
||
<content><![CDATA[<h2 id="1-介绍"><a href="#1-介绍" class="headerlink" title="1.介绍"></a>1.介绍</h2><p> JWT(Json Web Token)是为了在网络应用环境间传递声明而执行的一种基于JSON的开放标准。JWT的声明一般被用来在身份提供者和服务提供者间传递被认证的用户身份信息,以便于从资源服务器获取资源。比如用在用户登录上。JWT最重要的作用就是对 token信息的<strong>防伪</strong>作用。 </p>
|
||
<p> JWT的原理: </p>
|
||
<p> 一个JWT由三个部分组成:公共部分、私有部分、签名部分。最后由这三者组合进行base64编码得到JWT。</p>
|
||
<p><img src="/pictures/image-20230420102523288.png" alt="image-20230420102523288"></p>
|
||
<p><img src="/pictures/image-20230420103234232.png" alt="image-20230420103234232"></p>
|
||
<p>1、 公共部分</p>
|
||
<p> 主要是该JWT的相关配置参数,比如签名的加密算法、格式类型、过期时间等等。</p>
|
||
<p> Key=ATGUIGU</p>
|
||
<p>2、 私有部分</p>
|
||
<p> 用户自定义的内容,根据实际需要真正要封装的信息。</p>
|
||
<p> userInfo{用户的Id,用户的昵称nickName}</p>
|
||
<p>3、 签名部分</p>
|
||
<p> SaltiP: 当前服务器的Ip地址!{linux 中配置代理服务器的ip}</p>
|
||
<p> 主要用户对JWT生成字符串的时候,进行加密{盐值}</p>
|
||
<p>最终组成 key+salt+userInfo -> token!</p>
|
||
<p>base64编码,并不是加密,只是把明文信息变成了不可见的字符串。但是其实只要用一些工具就可以把base64编码解成明文,所以不要在JWT中放入涉及私密的信息。</p>
|
||
<h2 id="2-使用"><a href="#2-使用" class="headerlink" title="2.使用"></a>2.使用</h2><h3 id="1-导入依赖"><a href="#1-导入依赖" class="headerlink" title="1.导入依赖"></a>1.导入依赖</h3><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>io.jsonwebtoken<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>jjwt<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>0.7.0<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-引入工具类"><a href="#2-引入工具类" class="headerlink" title="2.引入工具类"></a>2.引入工具类</h3><p>以下工具类根据情况任选一种即可</p>
|
||
<p>一种是在请求头中获取token,然后再获取用户的信息,另一种直接传入token,然后获取用户信息</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.yygh.common.helper;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> io.jsonwebtoken.*;</span><br><span class="line"><span class="keyword">import</span> org.springframework.util.StringUtils;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Date;</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/4/20</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">class</span> <span class="title class_">JwtHelper</span> {</span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">static</span> <span class="type">long</span> <span class="variable">tokenExpiration</span> <span class="operator">=</span> <span class="number">24</span>*<span class="number">60</span>*<span class="number">60</span>*<span class="number">1000</span>; <span class="comment">//token的过期时间</span></span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">static</span> <span class="type">String</span> <span class="variable">tokenSignKey</span> <span class="operator">=</span> <span class="string">"123456"</span>; <span class="comment">//token 签名的密钥</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 根据参数生成token</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> userId 用户的id</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> userName 用户名</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> token字符串</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String <span class="title function_">createToken</span><span class="params">(Long userId, String userName)</span> {</span><br><span class="line"> <span class="type">String</span> <span class="variable">token</span> <span class="operator">=</span> Jwts.builder()</span><br><span class="line"> .setSubject(<span class="string">"YYGH-USER"</span>) <span class="comment">//分类,自定义</span></span><br><span class="line"> .setExpiration(<span class="keyword">new</span> <span class="title class_">Date</span>(System.currentTimeMillis() + tokenExpiration))<span class="comment">//设置过期时间</span></span><br><span class="line"> .claim(<span class="string">"userId"</span>, userId)<span class="comment">//设置主体信息</span></span><br><span class="line"> .claim(<span class="string">"userName"</span>, userName)</span><br><span class="line"> .signWith(SignatureAlgorithm.HS512, tokenSignKey)<span class="comment">//签名hash</span></span><br><span class="line"> .compressWith(CompressionCodecs.GZIP)</span><br><span class="line"> .compact();</span><br><span class="line"> <span class="keyword">return</span> token;</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"> * 根据token字符串得到用户的id</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> Long <span class="title function_">getUserId</span><span class="params">(String token)</span> {</span><br><span class="line"> <span class="keyword">if</span>(StringUtils.isEmpty(token)) <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> Jws<Claims> claimsJws = Jwts.parser().setSigningKey(tokenSignKey).parseClaimsJws(token);</span><br><span class="line"> <span class="type">Claims</span> <span class="variable">claims</span> <span class="operator">=</span> claimsJws.getBody();</span><br><span class="line"> <span class="type">Integer</span> <span class="variable">userId</span> <span class="operator">=</span> (Integer)claims.get(<span class="string">"userId"</span>);</span><br><span class="line"> <span class="keyword">return</span> userId.longValue();</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"> * 根据token字符串得到用户名</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String <span class="title function_">getUserName</span><span class="params">(String token)</span> {</span><br><span class="line"> <span class="keyword">if</span>(StringUtils.isEmpty(token)) <span class="keyword">return</span> <span class="string">""</span>;</span><br><span class="line"> Jws<Claims> claimsJws</span><br><span class="line"> = Jwts.parser().setSigningKey(tokenSignKey).parseClaimsJws(token);</span><br><span class="line"> <span class="type">Claims</span> <span class="variable">claims</span> <span class="operator">=</span> claimsJws.getBody();</span><br><span class="line"> <span class="keyword">return</span> (String)claims.get(<span class="string">"userName"</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.commonutils;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> io.jsonwebtoken.Claims;</span><br><span class="line"><span class="keyword">import</span> io.jsonwebtoken.Jws;</span><br><span class="line"><span class="keyword">import</span> io.jsonwebtoken.Jwts;</span><br><span class="line"><span class="keyword">import</span> io.jsonwebtoken.SignatureAlgorithm;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.server.reactive.ServerHttpRequest;</span><br><span class="line"><span class="keyword">import</span> org.springframework.util.StringUtils;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletRequest;</span><br><span class="line"><span class="keyword">import</span> java.util.Date;</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> helen</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@since</span> 2019/10/16</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">JwtUtils</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 设置token的过期时间</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">long</span> <span class="variable">EXPIRE</span> <span class="operator">=</span> <span class="number">1000</span> * <span class="number">60</span> * <span class="number">60</span> * <span class="number">24</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="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">String</span> <span class="variable">APP_SECRET</span> <span class="operator">=</span> <span class="string">"ukc8BDbRigUDaY6pZFfWus2jZWLPHO"</span>;</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"> * 生成token字符串</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String <span class="title function_">getJwtToken</span><span class="params">(String id, String nickname)</span>{</span><br><span class="line"></span><br><span class="line"> <span class="type">String</span> <span class="variable">JwtToken</span> <span class="operator">=</span> Jwts.builder()</span><br><span class="line"> .setHeaderParam(<span class="string">"typ"</span>, <span class="string">"JWT"</span>)</span><br><span class="line"> .setHeaderParam(<span class="string">"alg"</span>, <span class="string">"HS256"</span>)</span><br><span class="line"> .setSubject(<span class="string">"guli-user"</span>)</span><br><span class="line"> .setIssuedAt(<span class="keyword">new</span> <span class="title class_">Date</span>())</span><br><span class="line"> .setExpiration(<span class="keyword">new</span> <span class="title class_">Date</span>(System.currentTimeMillis() + EXPIRE))</span><br><span class="line"> .claim(<span class="string">"id"</span>, id)</span><br><span class="line"> .claim(<span class="string">"nickname"</span>, nickname)</span><br><span class="line"> .signWith(SignatureAlgorithm.HS256, APP_SECRET)</span><br><span class="line"> .compact();</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> JwtToken;</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"> * 判断token是否存在与有效</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="type">boolean</span> <span class="title function_">checkToken</span><span class="params">(String jwtToken)</span> {</span><br><span class="line"> <span class="keyword">if</span>(StringUtils.isEmpty(jwtToken)) <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> Jwts.parser().setSigningKey(APP_SECRET).parseClaimsJws(jwtToken);</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</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"> * 判断token是否存在与有效</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="type">boolean</span> <span class="title function_">checkToken</span><span class="params">(HttpServletRequest request)</span> {</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">String</span> <span class="variable">jwtToken</span> <span class="operator">=</span> request.getHeader(<span class="string">"token"</span>);</span><br><span class="line"> <span class="keyword">if</span>(StringUtils.isEmpty(jwtToken)) <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"> Jwts.parser().setSigningKey(APP_SECRET).parseClaimsJws(jwtToken);</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</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"> * 根据token获取会员id</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String <span class="title function_">getMemberIdByJwtToken</span><span class="params">(HttpServletRequest request)</span> {</span><br><span class="line"> <span class="type">String</span> <span class="variable">jwtToken</span> <span class="operator">=</span> request.getHeader(<span class="string">"token"</span>);</span><br><span class="line"> <span class="keyword">if</span>(StringUtils.isEmpty(jwtToken)) <span class="keyword">return</span> <span class="string">""</span>;</span><br><span class="line"> Jws<Claims> claimsJws = Jwts.parser().setSigningKey(APP_SECRET).parseClaimsJws(jwtToken);</span><br><span class="line"> <span class="type">Claims</span> <span class="variable">claims</span> <span class="operator">=</span> claimsJws.getBody();</span><br><span class="line"> <span class="keyword">return</span> (String)claims.get(<span class="string">"id"</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-在登录中使用Jwt工具"><a href="#3-在登录中使用Jwt工具" class="headerlink" title="3.在登录中使用Jwt工具"></a>3.在登录中使用Jwt工具</h3><p>1.登录成功之后返回token字符串</p>
|
||
<p><img src="/pictures/image-20230420110340570.png" alt="image-20230420110340570"></p>
|
||
<p>2.前端处理的思路</p>
|
||
<p>获取token字符串 <strong>-></strong> 将token字符串和用户信息存放在cokkie中 <strong>-></strong> 页面在cokkie中获取用户信息显示在页面上</p>
|
||
<p>前端登录与否的校验、后端网关登录与否的校验…….</p>
|
||
<p>之后补充完整的代码示例 这里没有遇到好的登录示例 ……….</p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>Java</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>SpringBoot整合MongoDB</title>
|
||
<url>/posts/12929.html</url>
|
||
<content><![CDATA[<h2 id="1-介绍"><a href="#1-介绍" class="headerlink" title="1.介绍"></a>1.介绍</h2><p> MongoDB是一个基于分布式文件存储的数据库。由C++语言编写。旨在为WEB应用提供可扩展的高性能数据存储解决方案。<br>MongoDB是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的。它支持的数据结构非常松散,是类似json的bson格式,因此可以存储比较复杂的数据类型。Mongo最大的特点是它支持的查询语言非常强大,其语法有点类似于面向对象的查询语言,几乎可以实现类似关系数据库单表查询的绝大部分功能,而且还支持对数据建立索引。</p>
|
||
<p><strong>适用场景</strong><br>1、网站数据:Mongo非常适合实时的插入,更新与查询,并具备网站实时数据存储所需的复制及高度伸缩性。<br>2、缓存:由于性能很高,Mongo也适合作为信息基础设施的缓存层。在系统重启之后,由M ongo搭建的持久化缓存层可以避免下层的数据源过载。<br>3、大尺寸,低价值的数据:使用传统的关系型数据库存储一些数据时可能会比较昂贵, 在此之前,很多时候程序员往往会选择传统的文件进行存储。<br>4、高伸缩性的场景:Mongo非常适合由数十或数百台服务器组成的数据库。Mongo的路线图中已经包含对Map Reduce弓摩的内置支持。<br>5、用于对象及 JSON数据的存储:Mongo的BSON数据格式非常适合文档化格式的存储 及查询。<br><strong>不适用场合</strong><br>1、高度事务性的系统:例如银行或会计系统。传统的关系型数据库目前还是更适用于需要大量原子性复杂事务的应用程序。<br>2、传统的商业智能应用:针对特定问题的BI数据库会对产生高度优化的查询方式。对于此类应用,数据仓库可能是更合适的选择。 </p>
|
||
<p>中文文档:<a href="https://docs.mongoing.com/">https://docs.mongoing.com/</a></p>
|
||
<h2 id="2-入门"><a href="#2-入门" class="headerlink" title="2.入门"></a>2.入门</h2><p> spring-data-mongodb提供了MongoTemplate与MongoRepository两种方式访问mongodb,MongoRepository操作简单,MongoTemplate操作灵活,我们在项目中可以灵活适用这两种方式操作mongodb,MongoRepository的缺点是不够灵活,MongoTemplate正好可以弥补不足</p>
|
||
<h3 id="2-1引入依赖"><a href="#2-1引入依赖" class="headerlink" title="2.1引入依赖"></a>2.1引入依赖</h3><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-data-mongodb<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-2-配置文件中添加MongoDB的配置"><a href="#2-2-配置文件中添加MongoDB的配置" class="headerlink" title="2.2 配置文件中添加MongoDB的配置"></a>2.2 配置文件中添加MongoDB的配置</h3><figure class="highlight properties"><table><tr><td class="code"><pre><span class="line"><span class="attr">spring.data.mongodb.uri</span>=<span class="string">mongodb://localhost:27017/test</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-3-创建对应的实体类"><a href="#2-3-创建对应的实体类" class="headerlink" title="2.3 创建对应的实体类"></a>2.3 创建对应的实体类</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Data</span></span><br><span class="line"><span class="meta">@Document("User")</span> <span class="comment">//指定实体类对应的MongoDB集合的名称</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">User</span> {</span><br><span class="line"> <span class="meta">@Id</span> <span class="comment">//自动生成的主键ID</span></span><br><span class="line"> <span class="keyword">private</span> String id;</span><br><span class="line"> <span class="keyword">private</span> String name;</span><br><span class="line"> <span class="keyword">private</span> Integer age;</span><br><span class="line"> <span class="keyword">private</span> String email;</span><br><span class="line"> <span class="keyword">private</span> String createDate;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-4-常用的方法"><a href="#2-4-常用的方法" class="headerlink" title="2.4 常用的方法"></a>2.4 常用的方法</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">//常用方法</span></span><br><span class="line">mongoTemplate.findAll(User.class); <span class="comment">//查询User文档的全部数据</span></span><br><span class="line">mongoTemplate.findById(<id>, User.class); <span class="comment">//查询User文档id为id的数据</span></span><br><span class="line">mongoTemplate.find(query, User.class); <span class="comment">//根据query内的查询条件查询</span></span><br><span class="line">mongoTemplate.upsert(query, update, User.class);<span class="comment">// 修改</span></span><br><span class="line">mongoTemplate.remove(query, User.class);<span class="comment">// 删除</span></span><br><span class="line">mongoTemplate.insert(User);<span class="comment">//新增</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight markdown"><table><tr><td class="code"><pre><span class="line">Query对象</span><br><span class="line">1、创建一个query对象(用来封装所有条件对象),再创建一个criteria对象(用来构建条件)</span><br><span class="line"></span><br><span class="line">2、精准条件:criteria.and(“key”).is(“条件”)</span><br><span class="line"> 模糊条件:criteria.and(“key”).regex(“条件”)</span><br><span class="line"> </span><br><span class="line">3、封装条件:query.addCriteria(criteria)</span><br><span class="line"></span><br><span class="line">4、大于(创建新的criteria):Criteria gt = Criteria.where(“key”).gt(“条件”)</span><br><span class="line"> 小于(创建新的criteria):Criteria lt = Criteria.where(“key”).lt(“条件”)</span><br><span class="line"> </span><br><span class="line">5、Query.addCriteria(new Criteria().andOperator(gt,lt));</span><br><span class="line"></span><br><span class="line">6、一个query中只能有一个andOperator() 其参数也可以是Criteria数组</span><br><span class="line"></span><br><span class="line">7、排序 :query.with(new Sort(Sort.Direction.ASC, "age"). and(new Sort(Sort.Direction.DESC, "date")))</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight markdown"><table><tr><td class="code"><pre><span class="line">主要注解:</span><br><span class="line"></span><br><span class="line">@Document,文档是 MongoDB 中最基本的数据单元,由键值对组成,类似于 JSON 格式,可以存储不同字段,字段的值可以包括其他文档,数组和文档数组。</span><br><span class="line"></span><br><span class="line">@Id(主键):用来将成员变量的值映射为文档的<span class="emphasis">_id的值</span></span><br><span class="line"><span class="emphasis"></span></span><br><span class="line"><span class="emphasis">@Indexed(索引): 索引是一种特殊的数据结构,存储在一个易于遍历读取的数据集合中,能够对数据库文档中的数据进行排序。索引能极大提高文档查询效率,如果没有设置索引,MongoDB 会遍历集合中的整个文档,选取符合查询条件的文档记录。这种查询效率是非常低的。</span></span><br><span class="line"><span class="emphasis"></span></span><br><span class="line"><span class="emphasis">@Field(字段): 文档中的字段,类似于 MySql 中的列。</span></span><br><span class="line"><span class="emphasis"></span></span><br><span class="line"><span class="emphasis">@Aggregation(聚合): 聚合主要用于数据处理,例如统计平均值、求和等。</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>示例代码</p>
|
||
<h4 id="2-4-1-使用MongoTemplate的方式访问MongoDB"><a href="#2-4-1-使用MongoTemplate的方式访问MongoDB" class="headerlink" title="2.4.1 使用MongoTemplate的方式访问MongoDB"></a>2.4.1 使用MongoTemplate的方式访问MongoDB</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@SpringBootTest</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">DemomogoApplicationTests</span> {</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> MongoTemplate mongoTemplate;</span><br><span class="line"></span><br><span class="line"> <span class="comment">//添加</span></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">createUser</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">User</span> <span class="variable">user</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">User</span>();</span><br><span class="line"> user.setAge(<span class="number">20</span>);</span><br><span class="line"> user.setName(<span class="string">"test"</span>);</span><br><span class="line"> user.setEmail(<span class="string">"4932200@qq.com"</span>);</span><br><span class="line"> <span class="type">User</span> <span class="variable">user1</span> <span class="operator">=</span> mongoTemplate.insert(user);</span><br><span class="line"> System.out.println(user1);</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">findUser</span><span class="params">()</span> {</span><br><span class="line"> List<User> userList = mongoTemplate.findAll(User.class);</span><br><span class="line"> System.out.println(userList);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//根据id查询</span></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">getById</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">User</span> <span class="variable">user</span> <span class="operator">=</span> </span><br><span class="line">mongoTemplate.findById(<span class="string">"5ffbfa2ac290f356edf9b5aa"</span>, User.class);</span><br><span class="line"> System.out.println(user);</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">findUserList</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">Query</span> <span class="variable">query</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Query</span>(Criteria</span><br><span class="line"> .where(<span class="string">"name"</span>).is(<span class="string">"test"</span>)</span><br><span class="line"> .and(<span class="string">"age"</span>).is(<span class="number">20</span>));</span><br><span class="line"> List<User> userList = mongoTemplate.find(query, User.class);</span><br><span class="line"> System.out.println(userList);</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">findUsersLikeName</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">String</span> <span class="variable">name</span> <span class="operator">=</span> <span class="string">"est"</span>;</span><br><span class="line"> <span class="type">String</span> <span class="variable">regex</span> <span class="operator">=</span> String.format(<span class="string">"%s%s%s"</span>, <span class="string">"^.*"</span>, name, <span class="string">".*$"</span>);</span><br><span class="line"> <span class="type">Pattern</span> <span class="variable">pattern</span> <span class="operator">=</span> Pattern.compile(regex, Pattern.CASE_INSENSITIVE);</span><br><span class="line"> <span class="type">Query</span> <span class="variable">query</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Query</span>(Criteria.where(<span class="string">"name"</span>).regex(pattern));</span><br><span class="line"> List<User> userList = mongoTemplate.find(query, User.class);</span><br><span class="line"> System.out.println(userList);</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">findUsersPage</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">String</span> <span class="variable">name</span> <span class="operator">=</span> <span class="string">"est"</span>;</span><br><span class="line"> <span class="type">int</span> <span class="variable">pageNo</span> <span class="operator">=</span> <span class="number">1</span>;</span><br><span class="line"> <span class="type">int</span> <span class="variable">pageSize</span> <span class="operator">=</span> <span class="number">10</span>;</span><br><span class="line"></span><br><span class="line"> <span class="comment">//分页查询的条件</span></span><br><span class="line"> <span class="type">Query</span> <span class="variable">query</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Query</span>();</span><br><span class="line"> <span class="type">String</span> <span class="variable">regex</span> <span class="operator">=</span> String.format(<span class="string">"%s%s%s"</span>, <span class="string">"^.*"</span>, name, <span class="string">".*$"</span>);</span><br><span class="line"> <span class="type">Pattern</span> <span class="variable">pattern</span> <span class="operator">=</span> Pattern.compile(regex, Pattern.CASE_INSENSITIVE);</span><br><span class="line"> query.addCriteria(Criteria.where(<span class="string">"name"</span>).regex(pattern));</span><br><span class="line"> <span class="comment">//总记录数</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">totalCount</span> <span class="operator">=</span> (<span class="type">int</span>) mongoTemplate.count(query, User.class);</span><br><span class="line"> <span class="comment">//分页查询</span></span><br><span class="line"> List<User> userList = mongoTemplate.find(query.skip((pageNo - <span class="number">1</span>) * pageSize).limit(pageSize), User.class);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//将分页的总记录数和分页数据封装在一个map集合中</span></span><br><span class="line"> Map<String, Object> pageMap = <span class="keyword">new</span> <span class="title class_">HashMap</span><>();</span><br><span class="line"> pageMap.put(<span class="string">"list"</span>, userList);</span><br><span class="line"> pageMap.put(<span class="string">"totalCount"</span>,totalCount);</span><br><span class="line"> System.out.println(pageMap);</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">updateUser</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">User</span> <span class="variable">user</span> <span class="operator">=</span> mongoTemplate.findById(<span class="string">"5ffbfa2ac290f356edf9b5aa"</span>, User.class);</span><br><span class="line"> user.setName(<span class="string">"test_1"</span>);</span><br><span class="line"> user.setAge(<span class="number">25</span>);</span><br><span class="line"> user.setEmail(<span class="string">"493220990@qq.com"</span>);</span><br><span class="line"> <span class="type">Query</span> <span class="variable">query</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Query</span>(Criteria.where(<span class="string">"_id"</span>).is(user.getId()));</span><br><span class="line"> <span class="type">Update</span> <span class="variable">update</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Update</span>();</span><br><span class="line"> update.set(<span class="string">"name"</span>, user.getName());</span><br><span class="line"> update.set(<span class="string">"age"</span>, user.getAge());</span><br><span class="line"> update.set(<span class="string">"email"</span>, user.getEmail());</span><br><span class="line"> <span class="type">UpdateResult</span> <span class="variable">result</span> <span class="operator">=</span> mongoTemplate.upsert(query, update, User.class);</span><br><span class="line"> <span class="comment">//影响的行数</span></span><br><span class="line"> <span class="type">long</span> <span class="variable">count</span> <span class="operator">=</span> result.getModifiedCount();</span><br><span class="line"> System.out.println(count);</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">delete</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">Query</span> <span class="variable">query</span> <span class="operator">=</span> </span><br><span class="line"><span class="keyword">new</span> <span class="title class_">Query</span>(Criteria.where(<span class="string">"_id"</span>).is(<span class="string">"5ffbfa2ac290f356edf9b5aa"</span>));</span><br><span class="line"> <span class="type">DeleteResult</span> <span class="variable">result</span> <span class="operator">=</span> mongoTemplate.remove(query, User.class);</span><br><span class="line"> <span class="type">long</span> <span class="variable">count</span> <span class="operator">=</span> result.getDeletedCount();</span><br><span class="line"> System.out.println(count);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="2-4-2-使用MongoRepository的方式访问MongoDB"><a href="#2-4-2-使用MongoRepository的方式访问MongoDB" class="headerlink" title="2.4.2 使用MongoRepository的方式访问MongoDB"></a>2.4.2 使用MongoRepository的方式访问MongoDB</h4><h5 id="a-创建UserRepository类"><a href="#a-创建UserRepository类" class="headerlink" title="a.创建UserRepository类"></a>a.创建UserRepository类</h5><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.mongodb.repository;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.atguigu.mongodb.entity.User;</span><br><span class="line"><span class="keyword">import</span> org.springframework.data.mongodb.repository.MongoRepository;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Repository;</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="meta">@Repository</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">interface</span> <span class="title class_">UserRepository</span> <span class="keyword">extends</span> <span class="title class_">MongoRepository</span><User, String> {</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="b-测试使用"><a href="#b-测试使用" class="headerlink" title="b.测试使用"></a>b.测试使用</h5><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@SpringBootTest</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">DemomogoApplicationTests1</span> {</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> UserRepository userRepository;</span><br><span class="line"></span><br><span class="line"> <span class="comment">//添加</span></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">createUser</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">User</span> <span class="variable">user</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">User</span>();</span><br><span class="line"> user.setAge(<span class="number">20</span>);</span><br><span class="line"> user.setName(<span class="string">"张三"</span>);</span><br><span class="line"> user.setEmail(<span class="string">"3332200@qq.com"</span>);</span><br><span class="line"> <span class="type">User</span> <span class="variable">user1</span> <span class="operator">=</span> userRepository.save(user);</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">findUser</span><span class="params">()</span> {</span><br><span class="line"> List<User> userList = userRepository.findAll();</span><br><span class="line"> System.out.println(userList);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//id查询</span></span><br><span class="line"> <span class="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">getById</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">User</span> <span class="variable">user</span> <span class="operator">=</span> userRepository.findById(<span class="string">"5ffbfe8197f24a07007bd6ce"</span>).get();</span><br><span class="line"> System.out.println(user);</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">findUserList</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//查询条件 名字是张三 年龄是20</span></span><br><span class="line"> <span class="type">User</span> <span class="variable">user</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">User</span>();</span><br><span class="line"> user.setName(<span class="string">"张三"</span>);</span><br><span class="line"> user.setAge(<span class="number">20</span>);</span><br><span class="line"> Example<User> userExample = Example.of(user);</span><br><span class="line"> List<User> userList = userRepository.findAll(userExample);</span><br><span class="line"> System.out.println(userList);</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">findUsersLikeName</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//创建匹配器,即如何使用查询条件</span></span><br><span class="line"> <span class="type">ExampleMatcher</span> <span class="variable">matcher</span> <span class="operator">=</span> ExampleMatcher.matching() <span class="comment">//构建对象</span></span><br><span class="line"> .withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING) <span class="comment">//改变默认字符串匹配方式:模糊查询</span></span><br><span class="line"> .withIgnoreCase(<span class="literal">true</span>); <span class="comment">//改变默认大小写忽略方式:忽略大小写</span></span><br><span class="line"> <span class="type">User</span> <span class="variable">user</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">User</span>();</span><br><span class="line"> user.setName(<span class="string">"三"</span>);</span><br><span class="line"> Example<User> userExample = Example.of(user, matcher);</span><br><span class="line"> List<User> userList = userRepository.findAll(userExample);</span><br><span class="line"> System.out.println(userList);</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">findUsersPage</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//根据年龄降序</span></span><br><span class="line"> <span class="type">Sort</span> <span class="variable">sort</span> <span class="operator">=</span> Sort.by(Sort.Direction.DESC, <span class="string">"age"</span>);</span><br><span class="line"> <span class="comment">//0为第一页</span></span><br><span class="line"> <span class="type">Pageable</span> <span class="variable">pageable</span> <span class="operator">=</span> PageRequest.of(<span class="number">0</span>, <span class="number">10</span>, sort);</span><br><span class="line"> <span class="comment">//创建匹配器,即如何使用查询条件</span></span><br><span class="line"> <span class="type">ExampleMatcher</span> <span class="variable">matcher</span> <span class="operator">=</span> ExampleMatcher.matching() <span class="comment">//构建对象</span></span><br><span class="line"> .withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING) <span class="comment">//改变默认字符串匹配方式:模糊查询</span></span><br><span class="line"> .withIgnoreCase(<span class="literal">true</span>); <span class="comment">//改变默认大小写忽略方式:忽略大小写</span></span><br><span class="line"> <span class="type">User</span> <span class="variable">user</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">User</span>();</span><br><span class="line"> user.setName(<span class="string">"三"</span>);<span class="comment">//查询名字中包含 '三' 的数据</span></span><br><span class="line"> Example<User> userExample = Example.of(user, matcher);</span><br><span class="line"> <span class="comment">//创建实例</span></span><br><span class="line"> Example<User> example = Example.of(user, matcher);</span><br><span class="line"> Page<User> pages = userRepository.findAll(example, pageable);</span><br><span class="line"> System.out.println(pages);</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">updateUser</span><span class="params">()</span> {</span><br><span class="line"> <span class="type">User</span> <span class="variable">user</span> <span class="operator">=</span> userRepository.findById(<span class="string">"5ffbfe8197f24a07007bd6ce"</span>).get();</span><br><span class="line"> user.setName(<span class="string">"张三_1"</span>);</span><br><span class="line"> user.setAge(<span class="number">25</span>);</span><br><span class="line"> user.setEmail(<span class="string">"883220990@qq.com"</span>);</span><br><span class="line"> <span class="type">User</span> <span class="variable">save</span> <span class="operator">=</span> userRepository.save(user);<span class="comment">//有id值就是修改 m</span></span><br><span class="line"> System.out.println(save);</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="meta">@Test</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">delete</span><span class="params">()</span> {</span><br><span class="line"> userRepository.deleteById(<span class="string">"5ffbfe8197f24a07007bd6ce"</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>SpringBoot</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>SpringBoot整合Redis</title>
|
||
<url>/posts/13813.html</url>
|
||
<content><![CDATA[<h2 id="1-Redis的介绍"><a href="#1-Redis的介绍" class="headerlink" title="1.Redis的介绍"></a>1.Redis的介绍</h2><p> Redis是一个开源(BSD许可),内存存储的数据结构服务器,可用作数据库,高速缓存和消息队列代理。它支持字符串、哈希表、列表、集合、有序集合,位图,hyperloglogs等数据类型。内置复制、Lua脚本、LRU收回、事务以及不同级别磁盘持久化功能,同时通过Redis Sentinel提供高可用,通过Redis Cluster提供自动分区。</p>
|
||
<p>中文文档:<a href="https://www.redis.net.cn/">https://www.redis.net.cn/</a></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><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!-- redis --></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.springframework.boot<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>spring-boot-starter-data-redis<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"></span><br><span class="line"><span class="comment"><!-- spring2.X集成redis所需common-pool2--></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>org.apache.commons<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>commons-pool2<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.6.0<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span> </span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
<h3 id="2-2-添加配置类"><a href="#2-2-添加配置类" class="headerlink" title="2.2 添加配置类"></a>2.2 添加配置类</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.yygh.common.config;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.fasterxml.jackson.annotation.JsonAutoDetect;</span><br><span class="line"><span class="keyword">import</span> com.fasterxml.jackson.annotation.PropertyAccessor;</span><br><span class="line"><span class="keyword">import</span> com.fasterxml.jackson.databind.ObjectMapper;</span><br><span class="line"><span class="keyword">import</span> org.springframework.cache.CacheManager;</span><br><span class="line"><span class="keyword">import</span> org.springframework.cache.annotation.EnableCaching;</span><br><span class="line"><span class="keyword">import</span> org.springframework.cache.interceptor.KeyGenerator;</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.cache.RedisCacheManager;</span><br><span class="line"><span class="keyword">import</span> org.springframework.data.redis.connection.RedisConnectionFactory;</span><br><span class="line"><span class="keyword">import</span> org.springframework.data.redis.core.RedisTemplate;</span><br><span class="line"><span class="keyword">import</span> org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;</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.RedisSerializer;</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="keyword">import</span> java.lang.reflect.Method;</span><br><span class="line"><span class="keyword">import</span> java.time.Duration;</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/4/14</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="meta">@EnableCaching</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">RedisConfig</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 自定义key规则</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Bean</span></span><br><span class="line"> <span class="keyword">public</span> KeyGenerator <span class="title function_">keyGenerator</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">KeyGenerator</span>() {</span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> Object <span class="title function_">generate</span><span class="params">(Object target, Method method, Object... params)</span> {</span><br><span class="line"> <span class="type">StringBuilder</span> <span class="variable">sb</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">StringBuilder</span>();</span><br><span class="line"> sb.append(target.getClass().getName());</span><br><span class="line"> sb.append(method.getName());</span><br><span class="line"> <span class="keyword">for</span> (Object obj : params) {</span><br><span class="line"> sb.append(obj.toString());</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> sb.toString();</span><br><span class="line"> }</span><br><span class="line"> };</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"> * 设置RedisTemplate规则</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">@Bean</span></span><br><span class="line"> <span class="keyword">public</span> RedisTemplate<Object, Object> <span class="title function_">redisTemplate</span><span class="params">(RedisConnectionFactory redisConnectionFactory)</span> {</span><br><span class="line"> RedisTemplate<Object, Object> redisTemplate = <span class="keyword">new</span> <span class="title class_">RedisTemplate</span><>();</span><br><span class="line"> redisTemplate.setConnectionFactory(redisConnectionFactory);</span><br><span class="line"> <span class="type">Jackson2JsonRedisSerializer</span> <span class="variable">jackson2JsonRedisSerializer</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Jackson2JsonRedisSerializer</span>(Object.class);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//解决查询缓存转换异常的问题</span></span><br><span class="line"> <span class="type">ObjectMapper</span> <span class="variable">om</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ObjectMapper</span>();</span><br><span class="line"> <span class="comment">// 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public</span></span><br><span class="line"> om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);</span><br><span class="line"> <span class="comment">// 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常</span></span><br><span class="line"> om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);</span><br><span class="line"> jackson2JsonRedisSerializer.setObjectMapper(om);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//序列号key value</span></span><br><span class="line"> redisTemplate.setKeySerializer(<span class="keyword">new</span> <span class="title class_">StringRedisSerializer</span>());</span><br><span class="line"> redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);</span><br><span class="line"> redisTemplate.setHashKeySerializer(<span class="keyword">new</span> <span class="title class_">StringRedisSerializer</span>());</span><br><span class="line"> redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);</span><br><span class="line"></span><br><span class="line"> redisTemplate.afterPropertiesSet();</span><br><span class="line"> <span class="keyword">return</span> redisTemplate;</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"> * 设置CacheManager缓存规则</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">@Bean</span></span><br><span class="line"> <span class="keyword">public</span> CacheManager <span class="title function_">cacheManager</span><span class="params">(RedisConnectionFactory factory)</span> {</span><br><span class="line"> RedisSerializer<String> redisSerializer = <span class="keyword">new</span> <span class="title class_">StringRedisSerializer</span>();</span><br><span class="line"> <span class="type">Jackson2JsonRedisSerializer</span> <span class="variable">jackson2JsonRedisSerializer</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Jackson2JsonRedisSerializer</span>(Object.class);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//解决查询缓存转换异常的问题</span></span><br><span class="line"> <span class="type">ObjectMapper</span> <span class="variable">om</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ObjectMapper</span>();</span><br><span class="line"> om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);</span><br><span class="line"> om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);</span><br><span class="line"> jackson2JsonRedisSerializer.setObjectMapper(om);</span><br><span class="line"></span><br><span class="line"> <span class="comment">// 配置序列化(解决乱码的问题),过期时间600秒</span></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"> .entryTtl(Duration.ofSeconds(<span class="number">600</span>))</span><br><span class="line"> .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(redisSerializer))</span><br><span class="line"> .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(jackson2JsonRedisSerializer))</span><br><span class="line"> .disableCachingNullValues();</span><br><span class="line"></span><br><span class="line"> <span class="type">RedisCacheManager</span> <span class="variable">cacheManager</span> <span class="operator">=</span> RedisCacheManager.builder(factory)</span><br><span class="line"> .cacheDefaults(config)</span><br><span class="line"> .build();</span><br><span class="line"> <span class="keyword">return</span> cacheManager;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>说明:<br> @EnableCaching:标记注解 @EnableCaching,开启缓存,并配置Redis缓存管理器。@EnableCaching 注释触发后置处理器, 检查每一个Spring bean 的 public 方法是否存在缓存注解。如果找到这样的一个注释, 自动创建一个代理拦截方法调用和处理相应的缓存行为。</p>
|
||
<h3 id="2-3-配置文件中加入redis的配置"><a href="#2-3-配置文件中加入redis的配置" class="headerlink" title="2.3 配置文件中加入redis的配置"></a>2.3 配置文件中加入redis的配置</h3><p>application.properties</p>
|
||
<figure class="highlight properties"><table><tr><td class="code"><pre><span class="line"><span class="attr">spring.redis.host</span>=<span class="string">localhost</span></span><br><span class="line"><span class="attr">spring.redis.port</span>=<span class="string">6379</span></span><br><span class="line"><span class="attr">spring.redis.database</span>= <span class="string">0</span></span><br><span class="line"><span class="attr">spring.redis.timeout</span>=<span class="string">1800000</span></span><br><span class="line"></span><br><span class="line"><span class="attr">spring.redis.lettuce.pool.max-active</span>=<span class="string">20</span></span><br><span class="line"><span class="attr">spring.redis.lettuce.pool.max-wait</span>=<span class="string">-1</span></span><br><span class="line"><span class="comment">#最大阻塞等待时间(负数表示没限制)</span></span><br><span class="line"><span class="attr">spring.redis.lettuce.pool.max-idle</span>=<span class="string">5</span></span><br><span class="line"><span class="attr">spring.redis.lettuce.pool.min-idle</span>=<span class="string">0</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-4-使用Spring-Cache-Redis执行缓存操作"><a href="#2-4-使用Spring-Cache-Redis执行缓存操作" class="headerlink" title="2.4 使用Spring Cache + Redis执行缓存操作"></a>2.4 使用Spring Cache + Redis执行缓存操作</h3><h4 id="2-1-2-Cacheable"><a href="#2-1-2-Cacheable" class="headerlink" title="2.1.2 @Cacheable"></a>2.1.2 @Cacheable</h4><p> 根据方法对其返回结果进行缓存,下次请求时,如果缓存存在,则直接读取缓存数据返回;如果缓存不存在,则执行方法,并把返回的结果存入缓存中。一般用在查询方法上。</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>属性/方法名</th>
|
||
<th>解释</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>value</td>
|
||
<td>缓存名,必填,它指定了你的缓存存放在哪块命名空间</td>
|
||
</tr>
|
||
<tr>
|
||
<td>cacheNames</td>
|
||
<td>与 value 差不多,二选一即可</td>
|
||
</tr>
|
||
<tr>
|
||
<td>key</td>
|
||
<td>可选属性,可以使用 SpEL 标签自定义缓存的key</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<h4 id="2-1-2-CachePut"><a href="#2-1-2-CachePut" class="headerlink" title="2.1.2 @CachePut"></a>2.1.2 @CachePut</h4><p> 使用该注解标志的方法,每次都会执行,并将结果存入指定的缓存中。其他方法可以直接从响应的缓存中读取缓存数据,而不需要再去查询数据库。一般用在新增方法上。</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>属性/方法名</th>
|
||
<th>解释</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>value</td>
|
||
<td>缓存名,必填,它指定了你的缓存存放在哪块命名空间</td>
|
||
</tr>
|
||
<tr>
|
||
<td>cacheNames</td>
|
||
<td>与 value 差不多,二选一即可</td>
|
||
</tr>
|
||
<tr>
|
||
<td>key</td>
|
||
<td>可选属性,可以使用 SpEL 标签自定义缓存的key</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<h4 id="2-1-3-CacheEvict"><a href="#2-1-3-CacheEvict" class="headerlink" title="2.1.3 @CacheEvict"></a>2.1.3 @CacheEvict</h4><p> 使用该注解标志的方法,会清空指定的缓存。一般用在更新或者删除方法上</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>属性/方法名</th>
|
||
<th>解释</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr>
|
||
<td>value</td>
|
||
<td>缓存名,必填,它指定了你的缓存存放在哪块命名空间</td>
|
||
</tr>
|
||
<tr>
|
||
<td>cacheNames</td>
|
||
<td>与 value 差不多,二选一即可</td>
|
||
</tr>
|
||
<tr>
|
||
<td>key</td>
|
||
<td>可选属性,可以使用 SpEL 标签自定义缓存的key</td>
|
||
</tr>
|
||
<tr>
|
||
<td>allEntries</td>
|
||
<td>是否清空所有缓存,默认为 false。如果指定为 true,则方法调用后将立即清空所有的缓存</td>
|
||
</tr>
|
||
<tr>
|
||
<td>beforeInvocation</td>
|
||
<td>是否在方法执行前就清空,默认为 false。如果指定为 true,则在方法执行前就会清空缓存</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<h2 id="3-示例"><a href="#3-示例" class="headerlink" title="3.示例"></a>3.示例</h2><p>下面的第一个方法是查询数据位list集合</p>
|
||
<p> @Cacheable(value = “dict”,keyGenerator = “keyGenerator”) 对方法的结果进行缓存</p>
|
||
<p> value属性表示key的前缀 </p>
|
||
<p> keyGenerator表示key的生成规则,生成规则在配置文件中配置,这里我们使用的是方法的全类名作为key的后缀</p>
|
||
<p>第二个方法是添加数据 添加数据会造成数据库中数据的变化 我们要清除缓存</p>
|
||
<p> @CacheEvict(value = “dict”,allEntries = true) 清空指定的缓存</p>
|
||
<p> value属性表示清空以dict为前缀的所有缓存</p>
|
||
<p> allEntries 属性表示是否清空所有缓存,默认为 false。如果指定为 true,则方法调用后将立即清空所有的缓存 </p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Override</span></span><br><span class="line"><span class="meta">@Cacheable(value = "dict",keyGenerator = "keyGenerator")</span></span><br><span class="line"><span class="keyword">public</span> List<Dict> <span class="title function_">findByParentId</span><span class="params">(Long parentId)</span> {</span><br><span class="line"> LambdaQueryWrapper<Dict> queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span><>();</span><br><span class="line"> queryWrapper.eq(Dict::getParentId, parentId);</span><br><span class="line"> List<Dict> dictList = dictMapper.selectList(queryWrapper);</span><br><span class="line"> <span class="keyword">for</span> (Dict dict : dictList) {</span><br><span class="line"> dict.setHasChildren(<span class="built_in">this</span>.isHasChildren(dict.getId()));</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> dictList;</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="meta">@CacheEvict(value = "dict",allEntries = true)</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">importDictData</span><span class="params">(MultipartFile file)</span> {</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> EasyExcel.read(file.getInputStream(),DictEeVo.class,<span class="keyword">new</span> <span class="title class_">DictListener</span>(dictMapper)).sheet().doRead();</span><br><span class="line"> } <span class="keyword">catch</span> (IOException e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>key的生成规则如下图:</p>
|
||
<p><img src="/pictures/image-20230414152035347.png" alt="image-20230414152035347"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>SpringBoot</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>SpringBoot整合EasyExcel</title>
|
||
<url>/posts/38823.html</url>
|
||
<content><![CDATA[<h2 id="1-EasyExcel介绍"><a href="#1-EasyExcel介绍" class="headerlink" title="1.EasyExcel介绍"></a>1.EasyExcel介绍</h2><p> Java解析、生成Excel比较有名的框架有Apache poi、jxl。但他们都存在一个严重的问题就是非常的耗内存,poi有一套SAX模式的API可以一定程度的解决一些内存溢出的问题,但POI还是有一些缺陷,比如07版Excel解压缩以及解压后存储都是在内存中完成的,内存消耗依然很大。easyexcel重写了poi对07版Excel的解析,一个3M的excel用POI sax解析依然需要100M左右内存,改用easyexcel可以降低到几M,并且再大的excel也不会出现内存溢出;03版依赖POI的sax模式,在上层做了模型转换的封装,让使用者更加简单方便</p>
|
||
<p>官网地址:<a href="https://easyexcel.opensource.alibaba.com/">https://easyexcel.opensource.alibaba.com/</a></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><figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!-- https://mvnrepository.com/artifact/com.alibaba/easyexcel --></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.alibaba<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>easyexcel<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.1.1<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-2-创建与Excel表格对应的实体类,并在属性上加上注解"><a href="#2-2-创建与Excel表格对应的实体类,并在属性上加上注解" class="headerlink" title="2.2 创建与Excel表格对应的实体类,并在属性上加上注解"></a>2.2 创建与Excel表格对应的实体类,并在属性上加上注解</h3><p>不用自己设置excel表中的表头信息,easyexcel会帮我们设置</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> test;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.alibaba.excel.annotation.ExcelProperty;</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="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/4/14</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 与Excel表格对应的实体类</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_">UserData</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 注解中value 设置的是表头的信息</span></span><br><span class="line"><span class="comment"> * index 设置的是这个属性在excel表格中的索引位置 列索引</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"></span><br><span class="line"> <span class="meta">@ExcelProperty(value = "用户编号", index = 0)</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span> uid;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@ExcelProperty(value = "用户名称", index = 1)</span></span><br><span class="line"> <span class="keyword">private</span> String username;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-3-读写操作"><a href="#2-3-读写操作" class="headerlink" title="2.3 读写操作"></a>2.3 读写操作</h3><h4 id="1-写操作"><a href="#1-写操作" class="headerlink" title="1.写操作"></a>1.写操作</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> test;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.alibaba.excel.EasyExcel;</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> 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/4/14</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 测试对excel的操作</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">TestEasyExcel</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="comment">//设置excel文件的路径和名称</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">filename</span> <span class="operator">=</span> <span class="string">"C:\\AlYun\\user.xlsx"</span>;</span><br><span class="line"></span><br><span class="line"> <span class="comment">//构建一个数据的list集合,存放要保存在excel表中的数据</span></span><br><span class="line"> List<UserData> userDataList = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> userDataList.add(<span class="keyword">new</span> <span class="title class_">UserData</span>(<span class="number">1</span>,<span class="string">"张三"</span>));</span><br><span class="line"> userDataList.add(<span class="keyword">new</span> <span class="title class_">UserData</span>(<span class="number">2</span>,<span class="string">"李四"</span>));</span><br><span class="line"> userDataList.add(<span class="keyword">new</span> <span class="title class_">UserData</span>(<span class="number">3</span>,<span class="string">"王五"</span>));</span><br><span class="line"> userDataList.add(<span class="keyword">new</span> <span class="title class_">UserData</span>(<span class="number">4</span>,<span class="string">"赵六"</span>));</span><br><span class="line"></span><br><span class="line"> <span class="comment">//调用方法实现写的操作</span></span><br><span class="line"> EasyExcel.write(filename,UserData.class)</span><br><span class="line"> .sheet(<span class="string">"用户信息"</span>)</span><br><span class="line"> .doWrite(userDataList);</span><br><span class="line"> </span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<p>执行之后,空的excel表中会添加如下的数据</p>
|
||
<p><img src="/pictures/image-20230414131020923.png" alt="image-20230414131020923"></p>
|
||
<h4 id="2-读操作"><a href="#2-读操作" class="headerlink" title="2.读操作"></a>2.读操作</h4><h5 id="1-创建一个读操作的监听器"><a href="#1-创建一个读操作的监听器" class="headerlink" title="1 .创建一个读操作的监听器"></a>1 .创建一个读操作的监听器</h5><p>继承AnalysisEventListener<T> T表示实体类</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> test;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.alibaba.excel.context.AnalysisContext;</span><br><span class="line"><span class="keyword">import</span> com.alibaba.excel.event.AnalysisEventListener;</span><br><span class="line"></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> 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/4/14</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">class</span> <span class="title class_">ExcelLister</span> <span class="keyword">extends</span> <span class="title class_">AnalysisEventListener</span><UserData> {</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> <span class="keyword">void</span> <span class="title function_">invoke</span><span class="params">(UserData data, AnalysisContext context)</span> {</span><br><span class="line"> <span class="comment">//打印输出读取到的数据</span></span><br><span class="line"> System.out.println(data);</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="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">doAfterAllAnalysed</span><span class="params">(AnalysisContext context)</span> {</span><br><span class="line"></span><br><span class="line"> }</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">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">invokeHeadMap</span><span class="params">(Map<Integer, String> headMap, AnalysisContext context)</span> {</span><br><span class="line"> <span class="comment">//打印读取到的表头信息</span></span><br><span class="line"> System.out.println(<span class="string">"表头信息:"</span>+headMap);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="5-编写方法测试"><a href="#5-编写方法测试" class="headerlink" title="5.编写方法测试"></a>5.编写方法测试</h5><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> test;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.alibaba.excel.EasyExcel;</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/4/14</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">class</span> <span class="title class_">TestReadExcel</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="comment">//设置excel文件的路径和名称</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">filename</span> <span class="operator">=</span> <span class="string">"C:\\AlYun\\user.xlsx"</span>;</span><br><span class="line"> <span class="comment">//调用方法实现读取操作</span></span><br><span class="line"> <span class="comment">//new ExcelLister()自己创建的监听器</span></span><br><span class="line"> EasyExcel.read(filename,UserData.class,<span class="keyword">new</span> <span class="title class_">ExcelLister</span>())</span><br><span class="line"> .sheet()</span><br><span class="line"> .doRead();</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="3-监听器中实现对数据库的操作"><a href="#3-监听器中实现对数据库的操作" class="headerlink" title="3.监听器中实现对数据库的操作"></a>3.监听器中实现对数据库的操作</h2><p>解决listener中无法操作数据库的问题</p>
|
||
<h3 id="3-1-通过构造器注入的方式"><a href="#3-1-通过构造器注入的方式" class="headerlink" title="3.1 通过构造器注入的方式"></a>3.1 通过构造器注入的方式</h3><p>在进行读操作创建Listener的时候,注入mapper</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.yygh.cmn.listener;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.alibaba.excel.context.AnalysisContext;</span><br><span class="line"><span class="keyword">import</span> com.alibaba.excel.event.AnalysisEventListener;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.yygh.cmn.mapper.DictMapper;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.yygh.model.cmn.Dict;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.yygh.vo.cmn.DictEeVo;</span><br><span class="line"><span class="keyword">import</span> org.springframework.beans.BeanUtils;</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 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/4/14</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">class</span> <span class="title class_">DictListener</span> <span class="keyword">extends</span> <span class="title class_">AnalysisEventListener</span><DictEeVo> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> DictMapper dictMapper;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="title function_">DictListener</span><span class="params">(DictMapper dictMapper)</span> {</span><br><span class="line"> <span class="built_in">this</span>.dictMapper = dictMapper;</span><br><span class="line"> }</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> <span class="keyword">void</span> <span class="title function_">invoke</span><span class="params">(DictEeVo data, AnalysisContext context)</span> {</span><br><span class="line"> <span class="comment">//调用mapper 添加数据</span></span><br><span class="line"> <span class="type">Dict</span> <span class="variable">dict</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Dict</span>();</span><br><span class="line"> BeanUtils.copyProperties(data,dict);</span><br><span class="line"> dictMapper.insert(dict);</span><br><span class="line"></span><br><span class="line"> }</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> <span class="keyword">void</span> <span class="title function_">doAfterAllAnalysed</span><span class="params">(AnalysisContext context)</span> {</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-2-使用注解加属性注入的方式"><a href="#3-2-使用注解加属性注入的方式" class="headerlink" title="3.2 使用注解加属性注入的方式"></a>3.2 使用注解加属性注入的方式</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Component</span></span><br><span class="line"> +</span><br><span class="line"><span class="meta">@Autowired</span></span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>SpringBoot</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>SpringBoot整合Logback日志</title>
|
||
<url>/posts/64205.html</url>
|
||
<content><![CDATA[<h2 id="1-创建一个SpringBoot的工程"><a href="#1-创建一个SpringBoot的工程" class="headerlink" title="1.创建一个SpringBoot的工程"></a>1.创建一个SpringBoot的工程</h2><h2 id="2-在resources目录下创建logback-spring-xml的配置文件"><a href="#2-在resources目录下创建logback-spring-xml的配置文件" class="headerlink" title="2.在resources目录下创建logback-spring.xml的配置文件"></a>2.在resources目录下创建logback-spring.xml的配置文件</h2><p>创建的时候要修改日志输出的路径</p>
|
||
<p>日志的级别根据需要自己修改</p>
|
||
<p>级别:OFF、FATAL、ERROR、WARN、INFO、DEBUG、ALL</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="meta"><?xml version=<span class="string">"1.0"</span> encoding=<span class="string">"UTF-8"</span>?></span></span><br><span class="line"><span class="tag"><<span class="name">configuration</span> <span class="attr">scan</span>=<span class="string">"true"</span> <span class="attr">scanPeriod</span>=<span class="string">"10 seconds"</span>></span></span><br><span class="line"> <span class="comment"><!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 --></span></span><br><span class="line"> <span class="comment"><!-- scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true --></span></span><br><span class="line"> <span class="comment"><!-- scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 --></span></span><br><span class="line"> <span class="comment"><!-- de<span class="doctag">bug:</span>当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 --></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">contextName</span>></span>logback<span class="tag"></<span class="name">contextName</span>></span></span><br><span class="line"> <span class="comment"><!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 --></span></span><br><span class="line"> <span class="tag"><<span class="name">property</span> <span class="attr">name</span>=<span class="string">"log.path"</span> <span class="attr">value</span>=<span class="string">"C:/AlYun/log"</span> /></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- 彩色日志 --></span></span><br><span class="line"> <span class="comment"><!-- 配置格式变量:CONSOLE_LOG_PATTERN 彩色日志格式 --></span></span><br><span class="line"> <span class="comment"><!-- magenta:洋红 --></span></span><br><span class="line"> <span class="comment"><!-- boldMagenta:粗红--></span></span><br><span class="line"> <span class="comment"><!-- cyan:青色 --></span></span><br><span class="line"> <span class="comment"><!-- white:白色 --></span></span><br><span class="line"> <span class="comment"><!-- magenta:洋红 --></span></span><br><span class="line"> <span class="tag"><<span class="name">property</span> <span class="attr">name</span>=<span class="string">"CONSOLE_LOG_PATTERN"</span></span></span><br><span class="line"><span class="tag"> <span class="attr">value</span>=<span class="string">"%yellow(%date{yyyy-MM-dd HH:mm:ss}) |%highlight(%-5level) |%blue(%thread) |%blue(%file:%line) |%green(%logger) |%cyan(%msg%n)"</span>/></span></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="tag"><<span class="name">appender</span> <span class="attr">name</span>=<span class="string">"CONSOLE"</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.ConsoleAppender"</span>></span></span><br><span class="line"> <span class="comment"><!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--></span></span><br><span class="line"> <span class="comment"><!-- 例如:如果此处配置了INFO级别,则后面其他位置即使配置了DEBUG级别的日志,也不会被输出 --></span></span><br><span class="line"> <span class="tag"><<span class="name">filter</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.classic.filter.ThresholdFilter"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">level</span>></span>INFO<span class="tag"></<span class="name">level</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">filter</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">encoder</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">Pattern</span>></span>${CONSOLE_LOG_PATTERN}<span class="tag"></<span class="name">Pattern</span>></span></span><br><span class="line"> <span class="comment"><!-- 设置字符集 --></span></span><br><span class="line"> <span class="tag"><<span class="name">charset</span>></span>UTF-8<span class="tag"></<span class="name">charset</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">encoder</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">appender</span>></span></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><br><span class="line"> <span class="comment"><!-- 时间滚动输出 level为 INFO 日志 --></span></span><br><span class="line"> <span class="tag"><<span class="name">appender</span> <span class="attr">name</span>=<span class="string">"INFO_FILE"</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.RollingFileAppender"</span>></span></span><br><span class="line"> <span class="comment"><!-- 正在记录的日志文件的路径及文件名 --></span></span><br><span class="line"> <span class="tag"><<span class="name">file</span>></span>${log.path}/log_info.log<span class="tag"></<span class="name">file</span>></span></span><br><span class="line"> <span class="comment"><!--日志文件输出格式--></span></span><br><span class="line"> <span class="tag"><<span class="name">encoder</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">pattern</span>></span>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n<span class="tag"></<span class="name">pattern</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">charset</span>></span>UTF-8<span class="tag"></<span class="name">charset</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">encoder</span>></span></span><br><span class="line"> <span class="comment"><!-- 日志记录器的滚动策略,按日期,按大小记录 --></span></span><br><span class="line"> <span class="tag"><<span class="name">rollingPolicy</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"</span>></span></span><br><span class="line"> <span class="comment"><!-- 每天日志归档路径以及格式 --></span></span><br><span class="line"> <span class="tag"><<span class="name">fileNamePattern</span>></span>${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log<span class="tag"></<span class="name">fileNamePattern</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">timeBasedFileNamingAndTriggeringPolicy</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">maxFileSize</span>></span>100MB<span class="tag"></<span class="name">maxFileSize</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">timeBasedFileNamingAndTriggeringPolicy</span>></span></span><br><span class="line"> <span class="comment"><!--日志文件保留天数--></span></span><br><span class="line"> <span class="tag"><<span class="name">maxHistory</span>></span>15<span class="tag"></<span class="name">maxHistory</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">rollingPolicy</span>></span></span><br><span class="line"> <span class="comment"><!-- 此日志文件只记录info级别的 --></span></span><br><span class="line"> <span class="tag"><<span class="name">filter</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.classic.filter.LevelFilter"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">level</span>></span>INFO<span class="tag"></<span class="name">level</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">onMatch</span>></span>ACCEPT<span class="tag"></<span class="name">onMatch</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">onMismatch</span>></span>DENY<span class="tag"></<span class="name">onMismatch</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">filter</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">appender</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- 时间滚动输出 level为 WARN 日志 --></span></span><br><span class="line"> <span class="tag"><<span class="name">appender</span> <span class="attr">name</span>=<span class="string">"WARN_FILE"</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.RollingFileAppender"</span>></span></span><br><span class="line"> <span class="comment"><!-- 正在记录的日志文件的路径及文件名 --></span></span><br><span class="line"> <span class="tag"><<span class="name">file</span>></span>${log.path}/log_warn.log<span class="tag"></<span class="name">file</span>></span></span><br><span class="line"> <span class="comment"><!--日志文件输出格式--></span></span><br><span class="line"> <span class="tag"><<span class="name">encoder</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">pattern</span>></span>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n<span class="tag"></<span class="name">pattern</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">charset</span>></span>UTF-8<span class="tag"></<span class="name">charset</span>></span> <span class="comment"><!-- 此处设置字符集 --></span></span><br><span class="line"> <span class="tag"></<span class="name">encoder</span>></span></span><br><span class="line"> <span class="comment"><!-- 日志记录器的滚动策略,按日期,按大小记录 --></span></span><br><span class="line"> <span class="tag"><<span class="name">rollingPolicy</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">fileNamePattern</span>></span>${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log<span class="tag"></<span class="name">fileNamePattern</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">timeBasedFileNamingAndTriggeringPolicy</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">maxFileSize</span>></span>100MB<span class="tag"></<span class="name">maxFileSize</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">timeBasedFileNamingAndTriggeringPolicy</span>></span></span><br><span class="line"> <span class="comment"><!--日志文件保留天数--></span></span><br><span class="line"> <span class="tag"><<span class="name">maxHistory</span>></span>15<span class="tag"></<span class="name">maxHistory</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">rollingPolicy</span>></span></span><br><span class="line"> <span class="comment"><!-- 此日志文件只记录warn级别的 --></span></span><br><span class="line"> <span class="tag"><<span class="name">filter</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.classic.filter.LevelFilter"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">level</span>></span>warn<span class="tag"></<span class="name">level</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">onMatch</span>></span>ACCEPT<span class="tag"></<span class="name">onMatch</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">onMismatch</span>></span>DENY<span class="tag"></<span class="name">onMismatch</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">filter</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">appender</span>></span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!-- 时间滚动输出 level为 ERROR 日志 --></span></span><br><span class="line"> <span class="tag"><<span class="name">appender</span> <span class="attr">name</span>=<span class="string">"ERROR_FILE"</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.RollingFileAppender"</span>></span></span><br><span class="line"> <span class="comment"><!-- 正在记录的日志文件的路径及文件名 --></span></span><br><span class="line"> <span class="tag"><<span class="name">file</span>></span>${log.path}/log_error.log<span class="tag"></<span class="name">file</span>></span></span><br><span class="line"> <span class="comment"><!--日志文件输出格式--></span></span><br><span class="line"> <span class="tag"><<span class="name">encoder</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">pattern</span>></span>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n<span class="tag"></<span class="name">pattern</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">charset</span>></span>UTF-8<span class="tag"></<span class="name">charset</span>></span> <span class="comment"><!-- 此处设置字符集 --></span></span><br><span class="line"> <span class="tag"></<span class="name">encoder</span>></span></span><br><span class="line"> <span class="comment"><!-- 日志记录器的滚动策略,按日期,按大小记录 --></span></span><br><span class="line"> <span class="tag"><<span class="name">rollingPolicy</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">fileNamePattern</span>></span>${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log<span class="tag"></<span class="name">fileNamePattern</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">timeBasedFileNamingAndTriggeringPolicy</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">maxFileSize</span>></span>100MB<span class="tag"></<span class="name">maxFileSize</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">timeBasedFileNamingAndTriggeringPolicy</span>></span></span><br><span class="line"> <span class="comment"><!--日志文件保留天数--></span></span><br><span class="line"> <span class="tag"><<span class="name">maxHistory</span>></span>15<span class="tag"></<span class="name">maxHistory</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">rollingPolicy</span>></span></span><br><span class="line"> <span class="comment"><!-- 此日志文件只记录ERROR级别的 --></span></span><br><span class="line"> <span class="tag"><<span class="name">filter</span> <span class="attr">class</span>=<span class="string">"ch.qos.logback.classic.filter.LevelFilter"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">level</span>></span>ERROR<span class="tag"></<span class="name">level</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">onMatch</span>></span>ACCEPT<span class="tag"></<span class="name">onMatch</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">onMismatch</span>></span>DENY<span class="tag"></<span class="name">onMismatch</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">filter</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">appender</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!--</span></span><br><span class="line"><span class="comment"> <logger>用来设置某一个包或者具体的某一个类的日志打印级别、以及指定<appender>。</span></span><br><span class="line"><span class="comment"> <logger>仅有一个name属性,</span></span><br><span class="line"><span class="comment"> 一个可选的level和一个可选的addtivity属性。</span></span><br><span class="line"><span class="comment"> name:用来指定受此logger约束的某一个包或者具体的某一个类。</span></span><br><span class="line"><span class="comment"> level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,</span></span><br><span class="line"><span class="comment"> 如果未设置此属性,那么当前logger将会继承上级的级别。</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"> 使用mybatis的时候,sql语句是debug下才会打印,而这里我们只配置了info,所以想要查看sql语句的话,有以下两种操作:</span></span><br><span class="line"><span class="comment"> 第一种把<root level="INFO">改成<root level="DEBUG">这样就会打印sql,不过这样日志那边会出现很多其他消息</span></span><br><span class="line"><span class="comment"> 第二种就是单独给mapper下目录配置DEBUG模式,代码如下,这样配置sql语句会打印,其他还是正常DEBUG级别:</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="tag"><<span class="name">springProfile</span> <span class="attr">name</span>=<span class="string">"dev"</span>></span></span><br><span class="line"> <span class="comment"><!--可以输出项目中的debug日志,包括mybatis的sql日志--></span></span><br><span class="line"> <span class="tag"><<span class="name">logger</span> <span class="attr">name</span>=<span class="string">"com.guli"</span> <span class="attr">level</span>=<span class="string">"INFO"</span> /></span></span><br><span class="line"></span><br><span class="line"> <span class="comment"><!--</span></span><br><span class="line"><span class="comment"> root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性</span></span><br><span class="line"><span class="comment"> level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,默认是DEBUG</span></span><br><span class="line"><span class="comment"> 可以包含零个或多个appender元素。</span></span><br><span class="line"><span class="comment"> --></span></span><br><span class="line"> <span class="tag"><<span class="name">root</span> <span class="attr">level</span>=<span class="string">"INFO"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"CONSOLE"</span> /></span></span><br><span class="line"> <span class="tag"><<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"INFO_FILE"</span> /></span></span><br><span class="line"> <span class="tag"><<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"WARN_FILE"</span> /></span></span><br><span class="line"> <span class="tag"><<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"ERROR_FILE"</span> /></span></span><br><span class="line"> <span class="tag"></<span class="name">root</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">springProfile</span>></span></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="tag"><<span class="name">springProfile</span> <span class="attr">name</span>=<span class="string">"pro"</span>></span></span><br><span class="line"></span><br><span class="line"> <span class="tag"><<span class="name">root</span> <span class="attr">level</span>=<span class="string">"INFO"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"CONSOLE"</span> /></span></span><br><span class="line"> <span class="tag"><<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"DEBUG_FILE"</span> /></span></span><br><span class="line"> <span class="tag"><<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"INFO_FILE"</span> /></span></span><br><span class="line"> <span class="tag"><<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"ERROR_FILE"</span> /></span></span><br><span class="line"> <span class="tag"><<span class="name">appender-ref</span> <span class="attr">ref</span>=<span class="string">"WARN_FILE"</span> /></span></span><br><span class="line"> <span class="tag"></<span class="name">root</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">springProfile</span>></span></span><br><span class="line"></span><br><span class="line"><span class="tag"></<span class="name">configuration</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="3-日志的样式如下图所示"><a href="#3-日志的样式如下图所示" class="headerlink" title="3.日志的样式如下图所示"></a>3.日志的样式如下图所示</h2><p><img src="/pictures/image-20230412171350769.png" alt="image-20230412171350769"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>SpringBoot</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>SpringBoot中整合Swagger2</title>
|
||
<url>/posts/32246.html</url>
|
||
<content><![CDATA[<h2 id="1-Swagger2的介绍"><a href="#1-Swagger2的介绍" class="headerlink" title="1.Swagger2的介绍"></a>1.Swagger2的介绍</h2><p>什么是swagger2</p>
|
||
<p>编写和维护接口文档是每个程序员的职责,根据Swagger2可以快速帮助我们编写最新的API接口文档,再也不用担心开会前仍忙于整理各种资料了,间接提升了团队开发的沟通效率。</p>
|
||
<p>常用注解</p>
|
||
<p>swagger通过注解表明该接口会生成文档,包括接口名、请求方法、参数、返回信息等等</p>
|
||
<p> @Api:修饰整个类,描述Controller的作用</p>
|
||
<p> @ApiOperation:描述一个类的一个方法,或者说一个接口</p>
|
||
<p> @ApiParam:单个参数描述</p>
|
||
<p> @ApiModel:用对象来接收参数</p>
|
||
<p> @ApiModelProperty:用对象接收参数时,描述对象的一个字段</p>
|
||
<p> @ApiImplicitParam:一个请求参数</p>
|
||
<p> @ApiImplicitParams:多个请求参数</p>
|
||
<h2 id="2-SpringBoot中使用Swagger"><a href="#2-SpringBoot中使用Swagger" class="headerlink" title="2.SpringBoot中使用Swagger"></a>2.SpringBoot中使用Swagger</h2><h3 id="2-1导入相关的依赖"><a href="#2-1导入相关的依赖" class="headerlink" title="2.1导入相关的依赖"></a>2.1导入相关的依赖</h3><p>注意:Swagger2和SpringBoot存在版本兼容的问题,选择的时候要根据SpringBoot的版本进行选择</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>io.springfox<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>springfox-swagger2<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.7.0<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"><span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>io.springfox<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>springfox-swagger-ui<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>2.7.0<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependency</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-2创建配置类"><a href="#2-2创建配置类" class="headerlink" title="2.2创建配置类"></a>2.2创建配置类</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@Configuration</span></span><br><span class="line"><span class="meta">@EnableSwagger2</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Swagger2</span> {</span><br><span class="line"> <span class="meta">@Bean</span></span><br><span class="line"> <span class="keyword">public</span> Docket <span class="title function_">adminApiConfig</span><span class="params">()</span>{</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">Docket</span>(DocumentationType.SWAGGER_2)</span><br><span class="line"> .groupName(<span class="string">"adminApi"</span>)</span><br><span class="line"> .apiInfo(apiInfo())</span><br><span class="line"> .select()</span><br><span class="line"> <span class="comment">//只显示admin路径下的页面</span></span><br><span class="line"> .paths(Predicates.and(PathSelectors.regex(<span class="string">"/admin/.*"</span>)))<span class="comment">// .paths(PathSelectors.any())表示所有</span></span><br><span class="line"> .build();</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> ApiInfo <span class="title function_">apiInfo</span><span class="params">()</span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">ApiInfoBuilder</span>()</span><br><span class="line"> .title(<span class="string">"后台管理系统-API文档"</span>)</span><br><span class="line"> .description(<span class="string">"本文档描述了后台管理系统微服务接口定义"</span>)</span><br><span class="line"> .version(<span class="string">"1.0"</span>)</span><br><span class="line"> .contact(<span class="keyword">new</span> <span class="title class_">Contact</span>(<span class="string">"GongChangjiang"</span>, <span class="string">""</span>, <span class="string">"2602183349@qq.com"</span>))</span><br><span class="line"> .build();</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-3配置包扫描的规则"><a href="#2-3配置包扫描的规则" class="headerlink" title="2.3配置包扫描的规则"></a>2.3配置包扫描的规则</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">//在项目的启动类加上该注解,swagger就会扫描如下包下的controller方法,生成接口文档</span></span><br><span class="line"><span class="meta">@ComponentScan(basePackages = "com.xxxx")</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-4使用接口文档"><a href="#2-4使用接口文档" class="headerlink" title="2.4使用接口文档"></a>2.4使用接口文档</h3><figure class="highlight tex"><table><tr><td class="code"><pre><span class="line">//浏览器访问该网址</span><br><span class="line">//这里的端口号是要生成接口文档端口的端口号</span><br><span class="line">http://localhost:8080/swagger-ui.html</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230412141010237.png" alt="image-20230412141010237"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>SpringBoot</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>内网穿透</title>
|
||
<url>/posts/6932.html</url>
|
||
<content><![CDATA[<h2 id="第一步-官网下载"><a href="#第一步-官网下载" class="headerlink" title="第一步 官网下载"></a>第一步 官网下载</h2><p>客户端下载 –> windows 64位 –>解压后得到.exe文件</p>
|
||
<p><img src="/pictures/image-20230409221503708.png" alt="image-20230409221503708"></p>
|
||
<h2 id="第二步-官网注册并登录进入后台"><a href="#第二步-官网注册并登录进入后台" class="headerlink" title="第二步 官网注册并登录进入后台"></a>第二步 官网注册并登录进入后台</h2><p>官网注册登录 –> 购买免费隧道 –>获取authtoken</p>
|
||
<p><img src="/pictures/image-20230409221827414.png" alt="image-20230409221827414"></p>
|
||
<p><img src="/pictures/image-20230409221954792.png" alt="image-20230409221954792"></p>
|
||
<h2 id="第三步-双击下载的-exe文件进入命令行页面输入命令"><a href="#第三步-双击下载的-exe文件进入命令行页面输入命令" class="headerlink" title="第三步 双击下载的.exe文件进入命令行页面输入命令"></a>第三步 双击下载的.exe文件进入命令行页面输入命令</h2><figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">natapp -authtoken=刚刚你申请的authtoken</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230409222457135.png" alt="image-20230409222457135"></p>
|
||
<p><img src="/pictures/image-20230409222628425.png" alt="image-20230409222628425"></p>
|
||
<h2 id="第四步-根据生成的域名访问服务"><a href="#第四步-根据生成的域名访问服务" class="headerlink" title="第四步 根据生成的域名访问服务"></a>第四步 根据生成的域名访问服务</h2><p><img src="/pictures/image-20230409222923480.png" alt="image-20230409222923480"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>网络</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>SSM框架基础知识及整合</title>
|
||
<url>/posts/56742.html</url>
|
||
<content><![CDATA[<p>PDF版本的笔记</p>
|
||
<p>Mybatis</p>
|
||
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/MyBatis.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<p>Spring SpringMVC MyBatis</p>
|
||
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/SSM整合.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>SSM</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>SpringBoot中使用定时任务</title>
|
||
<url>/posts/73.html</url>
|
||
<content><![CDATA[<h2 id="1-在启动类上添加-EnableScheduling注解"><a href="#1-在启动类上添加-EnableScheduling注解" class="headerlink" title="1.在启动类上添加@EnableScheduling注解"></a>1.在启动类上添加@EnableScheduling注解</h2><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="meta">@EnableScheduling</span></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="2-创建定时任务类,设置cron表达式"><a href="#2-创建定时任务类,设置cron表达式" class="headerlink" title="2.创建定时任务类,设置cron表达式"></a>2.创建定时任务类,设置cron表达式</h2><p>定时任务可以单独建立一个包 package com.atguigu.schedule</p>
|
||
<p>加上@Component注解,交给spring管理,启动这个模块,定时任务就开启了</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.schedule;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.scheduling.annotation.Scheduled;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Component;</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/3/29</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">@Component</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ScheduledTask</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">//每隔五秒执行这个方法</span></span><br><span class="line"> <span class="comment">//"0/5 * * * * ?" 是corn表达式</span></span><br><span class="line"> <span class="meta">@Scheduled(cron = "0/5 * * * * ?")</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">tesSchedule</span><span class="params">()</span>{</span><br><span class="line"> System.out.println(<span class="string">"定时任务执行了...."</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230329184540977.png" alt="image-20230329184540977"></p>
|
||
<h2 id="3-Corn表达式-七子-七域-表达式-生成工具"><a href="#3-Corn表达式-七子-七域-表达式-生成工具" class="headerlink" title="3.Corn表达式(七子[七域]表达式)生成工具"></a>3.Corn表达式(七子[七域]表达式)生成工具</h2><p>网址: <a href="https://cron.qqe2.com/">https://cron.qqe2.com/</a></p>
|
||
<p><img src="/pictures/image-20230329184618098.png" alt="image-20230329184618098"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>SpringBoot</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>验证码服务</title>
|
||
<url>/posts/11844.html</url>
|
||
<content><![CDATA[<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><p>坑点:有时候遇到验证码发不出去的情况,要调整依赖的版本,更新为高版本的依赖</p>
|
||
<figure class="highlight xml"><table><tr><td class="code"><pre><span class="line"><span class="comment"><!--javaMail--></span></span><br><span class="line"><span class="tag"><<span class="name">dependencies</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>javax.mail<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>javax.mail-api<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>1.5.6<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">dependency</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">groupId</span>></span>com.sun.mail<span class="tag"></<span class="name">groupId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">artifactId</span>></span>javax.mail<span class="tag"></<span class="name">artifactId</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">version</span>></span>1.5.3<span class="tag"></<span class="name">version</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">dependency</span>></span></span><br><span class="line"><span class="tag"></<span class="name">dependencies</span>></span></span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
<h3 id="1-2-导入发送验证码的工具类"><a href="#1-2-导入发送验证码的工具类" class="headerlink" title="1.2 导入发送验证码的工具类"></a>1.2 导入发送验证码的工具类</h3><figure class="highlight java"><table><tr><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">//还要其他的方法 比如使用@Value注解 </span></span><br><span class="line"><span class="keyword">static</span> { <span class="comment">//读取配置文件中的关于邮件的配置</span></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">FileInputStream</span> <span class="variable">fileInputStream</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">FileInputStream</span>(<span class="string">"src/main/resources/application.properties"</span>);</span><br><span class="line"> <span class="type">Properties</span> <span class="variable">properties</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Properties</span>();</span><br><span class="line"> properties.load(fileInputStream);</span><br><span class="line"> user = properties.getProperty(<span class="string">"guli.user"</span>);</span><br><span class="line"> password = properties.getProperty(<span class="string">"guli.password"</span>);</span><br><span class="line"> } <span class="keyword">catch</span> (IOException e) {</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"> }</span><br><span class="line"></span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"></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.stereotype.Component;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.annotation.PostConstruct;</span><br><span class="line"><span class="keyword">import</span> javax.mail.*;</span><br><span class="line"><span class="keyword">import</span> javax.mail.internet.InternetAddress;</span><br><span class="line"><span class="keyword">import</span> javax.mail.internet.MimeMessage;</span><br><span class="line"><span class="keyword">import</span> java.util.Properties;</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">public</span> <span class="keyword">class</span> <span class="title class_">MailUtils</span> {</span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">static</span> <span class="type">String</span> <span class="variable">USER</span> <span class="operator">=</span> <span class="string">"xxxxxxxx"</span>; <span class="comment">// 发件人称号,同邮箱地址</span></span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">static</span> <span class="type">String</span> <span class="variable">PASSWORD</span> <span class="operator">=</span> <span class="string">"xxxxxxxx"</span>; <span class="comment">// 授权码,开启SMTP时显示</span></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">@param</span> to 收件人邮箱</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> text 邮件正文</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> title 标题</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">public</span> <span class="keyword">static</span> <span class="type">boolean</span> <span class="title function_">sendMail</span><span class="params">(String to, String text, String title)</span> {</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="keyword">final</span> <span class="type">Properties</span> <span class="variable">props</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Properties</span>();</span><br><span class="line"> props.put(<span class="string">"mail.smtp.auth"</span>, <span class="string">"true"</span>);</span><br><span class="line"> <span class="comment">//注意发送邮件的方法中,发送给谁的,发送给对应的app,※</span></span><br><span class="line"> <span class="comment">//要改成对应的app。扣扣的改成qq的,网易的要改成网易的。※</span></span><br><span class="line"> <span class="comment">//props.put("mail.smtp.host", "smtp.qq.com");</span></span><br><span class="line"> props.put(<span class="string">"mail.smtp.host"</span>, <span class="string">"smtp.qq.com"</span>);</span><br><span class="line"></span><br><span class="line"> <span class="comment">// 发件人的账号</span></span><br><span class="line"> props.put(<span class="string">"mail.user"</span>, USER);</span><br><span class="line"> <span class="comment">//发件人的密码</span></span><br><span class="line"> props.put(<span class="string">"mail.password"</span>, PASSWORD);</span><br><span class="line"></span><br><span class="line"> <span class="comment">// 构建授权信息,用于进行SMTP进行身份验证</span></span><br><span class="line"> <span class="type">Authenticator</span> <span class="variable">authenticator</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Authenticator</span>() {</span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">protected</span> PasswordAuthentication <span class="title function_">getPasswordAuthentication</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">// 用户名、密码</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">userName</span> <span class="operator">=</span> props.getProperty(<span class="string">"mail.user"</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">password</span> <span class="operator">=</span> props.getProperty(<span class="string">"mail.password"</span>);</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">PasswordAuthentication</span>(userName, password);</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="type">Session</span> <span class="variable">mailSession</span> <span class="operator">=</span> Session.getInstance(props, authenticator);</span><br><span class="line"> <span class="comment">// 创建邮件消息</span></span><br><span class="line"> <span class="type">MimeMessage</span> <span class="variable">message</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">MimeMessage</span>(mailSession);</span><br><span class="line"> <span class="comment">// 设置发件人</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">username</span> <span class="operator">=</span> props.getProperty(<span class="string">"mail.user"</span>);</span><br><span class="line"> <span class="type">InternetAddress</span> <span class="variable">form</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">InternetAddress</span>(username);</span><br><span class="line"> message.setFrom(form);</span><br><span class="line"></span><br><span class="line"> <span class="comment">// 设置收件人</span></span><br><span class="line"> <span class="type">InternetAddress</span> <span class="variable">toAddress</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">InternetAddress</span>(to);</span><br><span class="line"> message.setRecipient(Message.RecipientType.TO, toAddress);</span><br><span class="line"></span><br><span class="line"> <span class="comment">// 设置邮件标题</span></span><br><span class="line"> message.setSubject(title);</span><br><span class="line"></span><br><span class="line"> <span class="comment">// 设置邮件的内容体</span></span><br><span class="line"> message.setContent(text, <span class="string">"text/html;charset=UTF-8"</span>);</span><br><span class="line"> <span class="comment">// 发送邮件</span></span><br><span class="line"> Transport.send(message);</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="1-3-导入随机生成验证码的工具类"><a href="#1-3-导入随机生成验证码的工具类" class="headerlink" title="1.3 导入随机生成验证码的工具类"></a>1.3 导入随机生成验证码的工具类</h3><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> java.util.Random;</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">public</span> <span class="keyword">class</span> <span class="title class_">ValidateCodeUtils</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 class="doctag">@param</span> length 长度为4位或者6位</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">public</span> <span class="keyword">static</span> Integer <span class="title function_">generateValidateCode</span><span class="params">(<span class="type">int</span> length)</span> {</span><br><span class="line"> <span class="type">Integer</span> <span class="variable">code</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> <span class="keyword">if</span> (length == <span class="number">4</span>) {</span><br><span class="line"> code = <span class="keyword">new</span> <span class="title class_">Random</span>().nextInt(<span class="number">9999</span>);<span class="comment">//生成随机数,最大为9999</span></span><br><span class="line"> <span class="keyword">if</span> (code < <span class="number">1000</span>) {</span><br><span class="line"> code = code + <span class="number">1000</span>;<span class="comment">//保证随机数为4位数字</span></span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (length == <span class="number">6</span>) {</span><br><span class="line"> code = <span class="keyword">new</span> <span class="title class_">Random</span>().nextInt(<span class="number">999999</span>);<span class="comment">//生成随机数,最大为999999</span></span><br><span class="line"> <span class="keyword">if</span> (code < <span class="number">100000</span>) {</span><br><span class="line"> code = code + <span class="number">100000</span>;<span class="comment">//保证随机数为6位数字</span></span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"只能生成4位或6位数字验证码"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> code;</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 class="doctag">@param</span> length 长度</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">public</span> <span class="keyword">static</span> String <span class="title function_">generateValidateCode4String</span><span class="params">(<span class="type">int</span> length)</span> {</span><br><span class="line"> <span class="type">Random</span> <span class="variable">rdm</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Random</span>();</span><br><span class="line"> <span class="type">String</span> <span class="variable">hash1</span> <span class="operator">=</span> Integer.toHexString(rdm.nextInt());</span><br><span class="line"> <span class="type">String</span> <span class="variable">capstr</span> <span class="operator">=</span> hash1.substring(<span class="number">0</span>, length);</span><br><span class="line"> <span class="keyword">return</span> capstr;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="1-4-测试使用"><a href="#1-4-测试使用" class="headerlink" title="1.4 测试使用"></a>1.4 测试使用</h3><figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">1.设置发送邮件的账号和授权码信息</span><br><span class="line">2.编写测试类测试邮件是否可以正常的发送</span><br><span class="line">3.添加到业务代码中,实现验证码的发送功能</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
<h2 id="2-使用阿里云的短信服务"><a href="#2-使用阿里云的短信服务" class="headerlink" title="2.使用阿里云的短信服务"></a>2.使用阿里云的短信服务</h2><p>阿里云的短信服务不面向个人用户,无法使用,但是使用的基本逻辑和使用邮箱类似</p>
|
||
<h2 id="3-Token字符串生成的工具类-JWT"><a href="#3-Token字符串生成的工具类-JWT" class="headerlink" title="3.Token字符串生成的工具类(JWT)"></a>3.Token字符串生成的工具类(JWT)</h2><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.commonutils;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> io.jsonwebtoken.Claims;</span><br><span class="line"><span class="keyword">import</span> io.jsonwebtoken.Jws;</span><br><span class="line"><span class="keyword">import</span> io.jsonwebtoken.Jwts;</span><br><span class="line"><span class="keyword">import</span> io.jsonwebtoken.SignatureAlgorithm;</span><br><span class="line"><span class="keyword">import</span> org.springframework.http.server.reactive.ServerHttpRequest;</span><br><span class="line"><span class="keyword">import</span> org.springframework.util.StringUtils;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletRequest;</span><br><span class="line"><span class="keyword">import</span> java.util.Date;</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> helen</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@since</span> 2019/10/16</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">JwtUtils</span> {</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 设置token的过期时间</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">long</span> <span class="variable">EXPIRE</span> <span class="operator">=</span> <span class="number">1000</span> * <span class="number">60</span> * <span class="number">60</span> * <span class="number">24</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="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">String</span> <span class="variable">APP_SECRET</span> <span class="operator">=</span> <span class="string">"ukc8BDbRigUDaY6pZFfWus2jZWLPHO"</span>;</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"> * 生成token字符串</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String <span class="title function_">getJwtToken</span><span class="params">(String id, String nickname)</span>{</span><br><span class="line"></span><br><span class="line"> <span class="type">String</span> <span class="variable">JwtToken</span> <span class="operator">=</span> Jwts.builder()</span><br><span class="line"> .setHeaderParam(<span class="string">"typ"</span>, <span class="string">"JWT"</span>)</span><br><span class="line"> .setHeaderParam(<span class="string">"alg"</span>, <span class="string">"HS256"</span>)</span><br><span class="line"> .setSubject(<span class="string">"guli-user"</span>)</span><br><span class="line"> .setIssuedAt(<span class="keyword">new</span> <span class="title class_">Date</span>())</span><br><span class="line"> .setExpiration(<span class="keyword">new</span> <span class="title class_">Date</span>(System.currentTimeMillis() + EXPIRE))</span><br><span class="line"> .claim(<span class="string">"id"</span>, id)</span><br><span class="line"> .claim(<span class="string">"nickname"</span>, nickname)</span><br><span class="line"> .signWith(SignatureAlgorithm.HS256, APP_SECRET)</span><br><span class="line"> .compact();</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> JwtToken;</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"> * 判断token是否存在与有效</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="type">boolean</span> <span class="title function_">checkToken</span><span class="params">(String jwtToken)</span> {</span><br><span class="line"> <span class="keyword">if</span>(StringUtils.isEmpty(jwtToken)) <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> Jwts.parser().setSigningKey(APP_SECRET).parseClaimsJws(jwtToken);</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</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"> * 判断token是否存在与有效</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="type">boolean</span> <span class="title function_">checkToken</span><span class="params">(HttpServletRequest request)</span> {</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">String</span> <span class="variable">jwtToken</span> <span class="operator">=</span> request.getHeader(<span class="string">"token"</span>);</span><br><span class="line"> <span class="keyword">if</span>(StringUtils.isEmpty(jwtToken)) <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"> Jwts.parser().setSigningKey(APP_SECRET).parseClaimsJws(jwtToken);</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</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"> * 根据token获取会员id</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> String <span class="title function_">getMemberIdByJwtToken</span><span class="params">(HttpServletRequest request)</span> {</span><br><span class="line"> <span class="type">String</span> <span class="variable">jwtToken</span> <span class="operator">=</span> request.getHeader(<span class="string">"token"</span>);</span><br><span class="line"> <span class="keyword">if</span>(StringUtils.isEmpty(jwtToken)) <span class="keyword">return</span> <span class="string">""</span>;</span><br><span class="line"> Jws<Claims> claimsJws = Jwts.parser().setSigningKey(APP_SECRET).parseClaimsJws(jwtToken);</span><br><span class="line"> <span class="type">Claims</span> <span class="variable">claims</span> <span class="operator">=</span> claimsJws.getBody();</span><br><span class="line"> <span class="keyword">return</span> (String)claims.get(<span class="string">"id"</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>Java</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>MybatisX插件的使用</title>
|
||
<url>/posts/24606.html</url>
|
||
<content><![CDATA[<p>代码生成器 根据数据库表生成Mapper接口,Mapper配置文件,service </p>
|
||
<p>注解 mybatisPlus提供的注解</p>
|
||
<p>公共字段的自动填充 逻辑删除 乐观锁 雪花算法生成主键</p>
|
||
<p><img src="/pictures/image-20230321181437910.png" alt="image-20230321181437910"></p>
|
||
<p><img src="/pictures/image-20230321181452909.png" alt="image-20230321181452909"></p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>插件</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>数据结构与算法</title>
|
||
<url>/posts/40445.html</url>
|
||
<content><![CDATA[<p>代码仓库的地址:<a href="https://gitee.com/JasonsGong/DataStructures">https://gitee.com/JasonsGong/DataStructures</a></p>
|
||
<h2 id="一-经典算法问题"><a href="#一-经典算法问题" class="headerlink" title="一.经典算法问题"></a>一.经典算法问题</h2><p>字符串匹配 KMP算法 </p>
|
||
<p>汉诺塔问题 分治算法</p>
|
||
<p>八皇后问题 回溯算法 </p>
|
||
<p>马踏棋盘问题 图的深度优化遍历算法(DFS)和 贪心算法优化</p>
|
||
<h2 id="二-数据结构与算法的概述"><a href="#二-数据结构与算法的概述" class="headerlink" title="二.数据结构与算法的概述"></a>二.数据结构与算法的概述</h2><h3 id="2-1-数据结构与算法的关系"><a href="#2-1-数据结构与算法的关系" class="headerlink" title="2.1 数据结构与算法的关系"></a>2.1 数据结构与算法的关系</h3><p>(1)数据(data)结构(structure)是一门研究组织数据方式的学科,有了编程语言也就有了数据结构,学好了数据结构可以编写出更加漂亮,更加有效率的代码。</p>
|
||
<p>(2)程序=数据结构+算法</p>
|
||
<p>(3)数据结构是算法的基础</p>
|
||
<h3 id="2-2解决实际的问题"><a href="#2-2解决实际的问题" class="headerlink" title="2.2解决实际的问题"></a>2.2解决实际的问题</h3><p>五子棋程序 稀疏数组(压缩存档) 二维数组->转化成稀疏数组->存档 读档反之</p>
|
||
<p>约瑟夫问题(丢手帕问题) 单向环形列表</p>
|
||
<p>修路问题 求最小生成树 + 普利姆算法</p>
|
||
<p>最短路径问题 图+弗洛伊德算法</p>
|
||
<h3 id="2-3-数据结构"><a href="#2-3-数据结构" class="headerlink" title="2.3 数据结构"></a>2.3 数据结构</h3><p>线性结构:</p>
|
||
<p> 线性结构作为最常用的数据结构,其特点是数据元素之间存在一对一的线性关系</p>
|
||
<p> 线性结构有两种不同的存储结构,即顺序存储结构和链式存储结构。顺序存储的线性表称为顺序表,顺序表中的存储元素是连续的</p>
|
||
<p> 链式存储的线性表称为链表,链表中的存储元素不一定是连续的,元素节点中存放数据元素以及相邻元素的地址信息</p>
|
||
<p> 线性结构常见的有:数组、队列、链表和栈</p>
|
||
<p>非线性结构:</p>
|
||
<p> 二维数组,多维数组,广义表,树结构,图结构</p>
|
||
<h2 id="三-稀疏数组和队列"><a href="#三-稀疏数组和队列" class="headerlink" title="三.稀疏数组和队列"></a>三.稀疏数组和队列</h2><h3 id="3-1稀疏数组"><a href="#3-1稀疏数组" class="headerlink" title="3.1稀疏数组"></a>3.1稀疏数组</h3><h4 id="3-1-1-基本的介绍"><a href="#3-1-1-基本的介绍" class="headerlink" title="3.1.1 基本的介绍"></a>3.1.1 基本的介绍</h4><p> 当一个数组中大部分元素为0,或者为同一个值的数组时,可以使用稀疏数组来保存该数组。</p>
|
||
<p>稀疏数组的处理方法是:</p>
|
||
<p> 1)记录数组一共有几行几列,有多少个不同的值</p>
|
||
<p> 2)把具有不同值的元素的行列及值记录在一个小规模的数组中,从而缩小程序的规模</p>
|
||
<h4 id="3-1-2使用的场景"><a href="#3-1-2使用的场景" class="headerlink" title="3.1.2使用的场景"></a>3.1.2使用的场景</h4><p> 五子棋程序的存档和退出功能的实现</p>
|
||
<h4 id="3-1-3图解"><a href="#3-1-3图解" class="headerlink" title="3.1.3图解"></a>3.1.3图解</h4><p>第一行记录的是原始的数组有几行几列有几个非零的值 例如下面的数组是一个6行7列有8个非零值的数组</p>
|
||
<p><img src="/pictures/image-20230313124552408.png" alt="image-20230313124552408"></p>
|
||
<h4 id="3-1-5实现的思路"><a href="#3-1-5实现的思路" class="headerlink" title="3.1.5实现的思路"></a>3.1.5实现的思路</h4><p><img src="/pictures/image-20230318100138197.png" alt="image-20230318100138197"></p>
|
||
<h4 id="3-1-5代码实现"><a href="#3-1-5代码实现" class="headerlink" title="3.1.5代码实现"></a>3.1.5代码实现</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.sparsearray;</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/3/18</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">class</span> <span class="title class_">SparseArray</span> {</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="comment">//创建一个原始的二维数组</span></span><br><span class="line"> <span class="comment">//0:表示没有棋子 1:表示黑子 2:表示白子</span></span><br><span class="line"> <span class="type">int</span>[][] chessArr1 = <span class="keyword">new</span> <span class="title class_">int</span>[<span class="number">11</span>][<span class="number">11</span>];</span><br><span class="line"> chessArr1[<span class="number">1</span>][<span class="number">2</span>] = <span class="number">1</span>;</span><br><span class="line"> chessArr1[<span class="number">2</span>][<span class="number">3</span>] = <span class="number">2</span>;</span><br><span class="line"> chessArr1[<span class="number">4</span>][<span class="number">5</span>] = <span class="number">1</span>;</span><br><span class="line"> <span class="comment">//遍历输出</span></span><br><span class="line"> System.out.println(<span class="string">"原始的二维数组"</span>);</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span>[] row : chessArr1) {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> num : row) {</span><br><span class="line"> System.out.print(num + <span class="string">" "</span>);</span><br><span class="line"> }</span><br><span class="line"> System.out.println();</span><br><span class="line"> }</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="type">int</span> <span class="variable">sum</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span>[] row : chessArr1) {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> num : row) {</span><br><span class="line"> <span class="keyword">if</span> (num != <span class="number">0</span>) {</span><br><span class="line"> sum++;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"非零元素的个数:"</span> + sum);</span><br><span class="line"> <span class="comment">//根据非零的元素的个数创建对应的稀疏数组</span></span><br><span class="line"> <span class="type">int</span>[][] sparseArr2 = <span class="keyword">new</span> <span class="title class_">int</span>[sum + <span class="number">1</span>][<span class="number">3</span>];</span><br><span class="line"> <span class="comment">//给稀疏数组赋值</span></span><br><span class="line"> <span class="comment">//第一行的赋值操作</span></span><br><span class="line"> sparseArr2[<span class="number">0</span>][<span class="number">0</span>] = <span class="number">11</span>;</span><br><span class="line"> sparseArr2[<span class="number">0</span>][<span class="number">1</span>] = <span class="number">11</span>;</span><br><span class="line"> sparseArr2[<span class="number">0</span>][<span class="number">2</span>] = sum;</span><br><span class="line"> <span class="comment">//其余行的赋值操作</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">row</span> <span class="operator">=</span> <span class="number">1</span>; <span class="comment">//充当计数器的作用</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < chessArr1.length; i++) {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">j</span> <span class="operator">=</span> <span class="number">0</span>; j < chessArr1[i].length; j++) {</span><br><span class="line"> <span class="keyword">if</span> (chessArr1[i][j] != <span class="number">0</span>) {</span><br><span class="line"> sparseArr2[row][<span class="number">0</span>] = i;</span><br><span class="line"> sparseArr2[row][<span class="number">1</span>] = j;</span><br><span class="line"> sparseArr2[row][<span class="number">2</span>] = chessArr1[i][j];</span><br><span class="line"> row++;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="comment">//遍历稀疏数组</span></span><br><span class="line"> System.out.println(<span class="string">"得到的稀疏数组如下"</span>);</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span>[] ints : sparseArr2) {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> anInt : ints) {</span><br><span class="line"> System.out.print(anInt + <span class="string">" "</span>);</span><br><span class="line"> }</span><br><span class="line"> System.out.println();</span><br><span class="line"> }</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="type">int</span>[][] sparseArr3 = <span class="keyword">new</span> <span class="title class_">int</span>[sparseArr2[<span class="number">0</span>][<span class="number">0</span>]][sparseArr2[<span class="number">0</span>][<span class="number">1</span>]];</span><br><span class="line"> <span class="comment">//遍历稀疏数组第二行之后的值 赋值给原始的数组 从第二行开始算</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">1</span>; i < sparseArr2.length; i++) {</span><br><span class="line"> sparseArr3[sparseArr2[i][<span class="number">0</span>]][sparseArr2[i][<span class="number">1</span>]] = sparseArr2[i][<span class="number">2</span>];</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//遍历还原之后的二维数组</span></span><br><span class="line"> System.out.println(<span class="string">"稀疏数组还原成二维数组"</span>);</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span>[] ints : sparseArr3) {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> anInt : ints) {</span><br><span class="line"> System.out.print(anInt+<span class="string">" "</span>);</span><br><span class="line"> }</span><br><span class="line"> System.out.println();</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
<h3 id="3-2队列"><a href="#3-2队列" class="headerlink" title="3.2队列"></a>3.2队列</h3><h4 id="3-2-1基本的介绍"><a href="#3-2-1基本的介绍" class="headerlink" title="3.2.1基本的介绍"></a>3.2.1基本的介绍</h4><p>先进先出</p>
|
||
<p> 队列是一个有序列表,可以通过数组或者链表实现。</p>
|
||
<p> 遵循先入先出的原则。即:先存入队列的数据,要先取出。后存入队列的数据要后取出。</p>
|
||
<h4 id="3-2-2代码实现"><a href="#3-2-2代码实现" class="headerlink" title="3.2.2代码实现"></a>3.2.2代码实现</h4><p> 使用数组模拟队列 </p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.queue;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Scanner;</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/3/18</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">class</span> <span class="title class_">ArrayQueueDemo</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</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="type">ArrayQueue</span> <span class="variable">queue</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ArrayQueue</span>(<span class="number">3</span>);</span><br><span class="line"> <span class="type">char</span> <span class="variable">key</span> <span class="operator">=</span> <span class="string">' '</span>; <span class="comment">//接收用户输入</span></span><br><span class="line"> <span class="type">Scanner</span> <span class="variable">scanner</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Scanner</span>(System.in);<span class="comment">//</span></span><br><span class="line"> <span class="type">boolean</span> <span class="variable">loop</span> <span class="operator">=</span> <span class="literal">true</span>;</span><br><span class="line"> <span class="comment">//输出一个菜单</span></span><br><span class="line"> <span class="keyword">while</span> (loop) {</span><br><span class="line"> System.out.println(<span class="string">"s(show): 显示队列"</span>);</span><br><span class="line"> System.out.println(<span class="string">"e(exit): 退出程序"</span>);</span><br><span class="line"> System.out.println(<span class="string">"a(add): 添加数据到队列"</span>);</span><br><span class="line"> System.out.println(<span class="string">"g(get): 从队列取出数据"</span>);</span><br><span class="line"> System.out.println(<span class="string">"h(head): 查看队列头的数据"</span>);</span><br><span class="line"> key = scanner.next().charAt(<span class="number">0</span>);<span class="comment">//接收一个字符</span></span><br><span class="line"> <span class="keyword">switch</span> (key) {</span><br><span class="line"> <span class="keyword">case</span> <span class="string">'s'</span>:</span><br><span class="line"> queue.showQueue();</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="string">'a'</span>:</span><br><span class="line"> System.out.println(<span class="string">"输出一个数"</span>);</span><br><span class="line"> <span class="type">int</span> <span class="variable">value</span> <span class="operator">=</span> scanner.nextInt();</span><br><span class="line"> queue.addQueue(value);</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="string">'g'</span>: <span class="comment">//取出数据</span></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">int</span> <span class="variable">res</span> <span class="operator">=</span> queue.getQueue();</span><br><span class="line"> System.out.printf(<span class="string">"取出的数据是%d\n"</span>, res);</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> <span class="comment">// <span class="doctag">TODO:</span> handle exception</span></span><br><span class="line"> System.out.println(e.getMessage());</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="string">'h'</span>: <span class="comment">//查看队列头的数据</span></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">int</span> <span class="variable">res</span> <span class="operator">=</span> queue.headQueue();</span><br><span class="line"> System.out.printf(<span class="string">"队列头的数据是%d\n"</span>, res);</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> <span class="comment">// <span class="doctag">TODO:</span> handle exception</span></span><br><span class="line"> System.out.println(e.getMessage());</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="string">'e'</span>: <span class="comment">//退出</span></span><br><span class="line"> scanner.close();</span><br><span class="line"> loop = <span class="literal">false</span>;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">default</span>:</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> System.out.println(<span class="string">"程序退出~~"</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment">// 使用数组模拟队列-编写一个ArrayQueue类</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">ArrayQueue</span> {</span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span> maxSize; <span class="comment">// 表示数组的最大容量</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span> front; <span class="comment">// 队列头</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span> rear; <span class="comment">// 队列尾</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span>[] arr; <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="keyword">public</span> <span class="title function_">ArrayQueue</span><span class="params">(<span class="type">int</span> arrMaxSize)</span> {</span><br><span class="line"> maxSize = arrMaxSize;</span><br><span class="line"> arr = <span class="keyword">new</span> <span class="title class_">int</span>[maxSize];</span><br><span class="line"> front = -<span class="number">1</span>; <span class="comment">// 指向队列头部,分析出front是指向队列头的前一个位置.</span></span><br><span class="line"> rear = -<span class="number">1</span>; <span class="comment">// 指向队列尾,指向队列尾的数据(即就是队列最后一个数据)</span></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">public</span> <span class="type">boolean</span> <span class="title function_">isFull</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> rear == maxSize - <span class="number">1</span>;</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">public</span> <span class="type">boolean</span> <span class="title function_">isEmpty</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> rear == front;</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">public</span> <span class="keyword">void</span> <span class="title function_">addQueue</span><span class="params">(<span class="type">int</span> n)</span> {</span><br><span class="line"> <span class="comment">// 判断队列是否满</span></span><br><span class="line"> <span class="keyword">if</span> (isFull()) {</span><br><span class="line"> System.out.println(<span class="string">"队列满,不能加入数据~"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> rear++; <span class="comment">// 让rear 后移</span></span><br><span class="line"> arr[rear] = n;</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">public</span> <span class="type">int</span> <span class="title function_">getQueue</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">// 判断队列是否空</span></span><br><span class="line"> <span class="keyword">if</span> (isEmpty()) {</span><br><span class="line"> <span class="comment">// 通过抛出异常</span></span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"队列空,不能取数据"</span>);</span><br><span class="line"> }</span><br><span class="line"> front++; <span class="comment">// front后移</span></span><br><span class="line"> <span class="keyword">return</span> arr[front];</span><br><span class="line"></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">public</span> <span class="keyword">void</span> <span class="title function_">showQueue</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">// 遍历</span></span><br><span class="line"> <span class="keyword">if</span> (isEmpty()) {</span><br><span class="line"> System.out.println(<span class="string">"队列空的,没有数据~~"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < arr.length; i++) {</span><br><span class="line"> System.out.printf(<span class="string">"arr[%d]=%d\n"</span>, i, arr[i]);</span><br><span class="line"> }</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">public</span> <span class="type">int</span> <span class="title function_">headQueue</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">// 判断</span></span><br><span class="line"> <span class="keyword">if</span> (isEmpty()) {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"队列空的,没有数据~~"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> arr[front + <span class="number">1</span>];</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
<h4 id="3-2-3-数组模拟环形队列"><a href="#3-2-3-数组模拟环形队列" class="headerlink" title="3.2.3 数组模拟环形队列"></a>3.2.3 数组模拟环形队列</h4><p>环形队列的思路分析</p>
|
||
<ul>
|
||
<li>环形队列满的条件:(rear + 1) % maxSize == front</li>
|
||
<li>环形队列空的条件:rear == front</li>
|
||
<li>环形队列中有效数据的个数: (rear + maxSize - front) % maxSize</li>
|
||
</ul>
|
||
<p><img src="/pictures/image-20230428124659873.png" alt="image-20230428124659873"></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.queue;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Scanner;</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/4/28</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 模拟环形队列</span></span><br><span class="line"><span class="comment"> * <p></span></span><br><span class="line"><span class="comment"> * 环形队列满的条件:(rear + 1) % maxSize == front</span></span><br><span class="line"><span class="comment"> * 环形队列空的条件:rear == front</span></span><br><span class="line"><span class="comment"> * 环形队列中有效数据的个数: (rear + maxSize - front) % maxSize</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">CircleArrayQueueDemo</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="comment">//创建一个队列</span></span><br><span class="line"> System.out.println(<span class="string">"测试环形队列"</span>);</span><br><span class="line"> <span class="type">CircleArray</span> <span class="variable">queue</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">CircleArray</span>(<span class="number">3</span>);</span><br><span class="line"> <span class="type">char</span> <span class="variable">key</span> <span class="operator">=</span> <span class="string">' '</span>; <span class="comment">//接收用户输入</span></span><br><span class="line"> <span class="type">Scanner</span> <span class="variable">scanner</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Scanner</span>(System.in);<span class="comment">//</span></span><br><span class="line"> <span class="type">boolean</span> <span class="variable">loop</span> <span class="operator">=</span> <span class="literal">true</span>;</span><br><span class="line"> <span class="comment">//输出一个菜单</span></span><br><span class="line"> <span class="keyword">while</span> (loop) {</span><br><span class="line"> System.out.println(<span class="string">"s(show): 显示队列"</span>);</span><br><span class="line"> System.out.println(<span class="string">"e(exit): 退出程序"</span>);</span><br><span class="line"> System.out.println(<span class="string">"a(add): 添加数据到队列"</span>);</span><br><span class="line"> System.out.println(<span class="string">"g(get): 从队列取出数据"</span>);</span><br><span class="line"> System.out.println(<span class="string">"h(head): 查看队列头的数据"</span>);</span><br><span class="line"> key = scanner.next().charAt(<span class="number">0</span>);<span class="comment">//接收一个字符</span></span><br><span class="line"> <span class="keyword">switch</span> (key) {</span><br><span class="line"> <span class="keyword">case</span> <span class="string">'s'</span>:</span><br><span class="line"> queue.showQueue();</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="string">'a'</span>:<span class="comment">//添加数据</span></span><br><span class="line"> System.out.println(<span class="string">"输出一个数"</span>);</span><br><span class="line"> <span class="type">int</span> <span class="variable">value</span> <span class="operator">=</span> scanner.nextInt();</span><br><span class="line"> queue.addQueue(value);</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="string">'g'</span>: <span class="comment">//取出数据</span></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">int</span> <span class="variable">res</span> <span class="operator">=</span> queue.getQueue();</span><br><span class="line"> System.out.printf(<span class="string">"取出的数据是%d\n"</span>, res);</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> <span class="comment">// <span class="doctag">TODO:</span> handle exception</span></span><br><span class="line"> System.out.println(e.getMessage());</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="string">'h'</span>: <span class="comment">//查看队列头的数据</span></span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> <span class="type">int</span> <span class="variable">res</span> <span class="operator">=</span> queue.headQueue();</span><br><span class="line"> System.out.printf(<span class="string">"队列头的数据是%d\n"</span>, res);</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> <span class="comment">// <span class="doctag">TODO:</span> handle exception</span></span><br><span class="line"> System.out.println(e.getMessage());</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="string">'e'</span>: <span class="comment">//退出</span></span><br><span class="line"> scanner.close();</span><br><span class="line"> loop = <span class="literal">false</span>;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">default</span>:</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> System.out.println(<span class="string">"程序退出~~"</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">CircleArray</span> {</span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span> maxSize; <span class="comment">// 表示数组的最大容量 因为预留了一个空间 实际上maxSize=3 只能存储两个元素</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span> front; <span class="comment">// 队列头 初始值是0</span></span><br><span class="line"> <span class="comment">//rear 变量的含义做一个调整:rear 指向队列的最后一个元素的后一个位置. 因为希望空出一个空间做为约定</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span> rear; <span class="comment">// 队列尾</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span>[] arr; <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="comment"> * 构造方法</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> arrMaxSize 环形队列的最大容量</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="title function_">CircleArray</span><span class="params">(<span class="type">int</span> arrMaxSize)</span> {</span><br><span class="line"> maxSize = arrMaxSize;</span><br><span class="line"> arr = <span class="keyword">new</span> <span class="title class_">int</span>[maxSize];</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">public</span> <span class="type">boolean</span> <span class="title function_">isFull</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//因为是环形队列 如果尾部队列的后一个指向队列的头部 那么我们认为队列是满的</span></span><br><span class="line"> <span class="keyword">return</span> (rear + <span class="number">1</span>) % maxSize == front; <span class="comment">//这里是一个理解点</span></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">public</span> <span class="type">boolean</span> <span class="title function_">isEmpty</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> rear == front;</span><br><span class="line"> }</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">public</span> <span class="keyword">void</span> <span class="title function_">addQueue</span><span class="params">(<span class="type">int</span> n)</span> {</span><br><span class="line"> <span class="comment">//先判断队列是否为满 满了就不添加</span></span><br><span class="line"> <span class="keyword">if</span> (<span class="built_in">this</span>.isFull()) {</span><br><span class="line"> System.out.println(<span class="string">"队列为满,不能添加数据!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//添加数据</span></span><br><span class="line"> arr[rear] = n;</span><br><span class="line"> <span class="comment">//将人rear向后移</span></span><br><span class="line"> rear = (rear + <span class="number">1</span>) % maxSize; <span class="comment">//这里是一个理解点</span></span><br><span class="line"> }</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">public</span> <span class="type">int</span> <span class="title function_">getQueue</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//先判断队列是否为空 空了就无法取出数据</span></span><br><span class="line"> <span class="keyword">if</span> (<span class="built_in">this</span>.isEmpty()) {</span><br><span class="line"> System.out.println(<span class="string">"队列为空,无法取出数据!"</span>);</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"队列空,不能取数据"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//不为空 取出数据</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">result</span> <span class="operator">=</span> arr[front];</span><br><span class="line"> front = (front + <span class="number">1</span>) % maxSize; <span class="comment">//这里是一个理解点</span></span><br><span class="line"> <span class="keyword">return</span> result;</span><br><span class="line"> }</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">public</span> <span class="keyword">void</span> <span class="title function_">showQueue</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//判断队列是否为空 如果队列为空就不遍历</span></span><br><span class="line"> <span class="keyword">if</span> (<span class="built_in">this</span>.isEmpty()) {</span><br><span class="line"> System.out.println(<span class="string">"队列为空!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//遍历的方式 从front开始遍历 遍历多少个元素</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">count</span> <span class="operator">=</span> <span class="built_in">this</span>.size();</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> front; i < front + count; i++) {<span class="comment">//主要作用是遍历多少次</span></span><br><span class="line"> System.out.println(<span class="string">"arr["</span> + i % maxSize + <span class="string">"]="</span> + arr[i % maxSize]);</span><br><span class="line"> }</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">public</span> <span class="type">int</span> <span class="title function_">size</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> (rear + maxSize - front) % maxSize; <span class="comment">//这是一个理解点</span></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">public</span> <span class="type">int</span> <span class="title function_">headQueue</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">// 判断</span></span><br><span class="line"> <span class="keyword">if</span> (isEmpty()) {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"队列空的,没有数据~~"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> arr[front];</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
|
||
|
||
<h2 id="四-链表"><a href="#四-链表" class="headerlink" title="四.链表"></a>四.链表</h2><h3 id="4-1-链表-Linked-List-介绍"><a href="#4-1-链表-Linked-List-介绍" class="headerlink" title="4.1 链表(Linked List)介绍"></a>4.1 链表(Linked List)介绍</h3><p>在内存中不是连续存储的</p>
|
||
<h3 id=""><a href="#" class="headerlink" title=""></a><img src="/pictures/image-20230428134234636.png"></h3><p>链表的逻辑结构</p>
|
||
<p><img src="/pictures/image-20230428135032883.png" alt="image-20230428135032883"></p>
|
||
<h3 id="4-2单链表的应用实例-CRUD"><a href="#4-2单链表的应用实例-CRUD" class="headerlink" title="4.2单链表的应用实例(CRUD)"></a>4.2单链表的应用实例(CRUD)</h3><p>使用带head头的单向链表实现 –水浒英雄排行榜管理 完成对英雄人物的增删改查操作</p>
|
||
<h4 id="4-2-1向单链表中添加数据"><a href="#4-2-1向单链表中添加数据" class="headerlink" title="4.2.1向单链表中添加数据"></a>4.2.1向单链表中添加数据</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.linkedlist;</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/4/28</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 单链表的实现</span></span><br><span class="line"><span class="comment"> * 使用带head头的单向链表实现 –水浒英雄排行榜管理</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">public</span> <span class="keyword">class</span> <span class="title class_">SingleLinkedListDemo</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">SingleLinkedList</span> <span class="variable">singleLinkedList</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SingleLinkedList</span>();</span><br><span class="line"> singleLinkedList.add(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">1</span>, <span class="string">"宋江"</span>, <span class="string">"及时雨"</span>));</span><br><span class="line"> singleLinkedList.add(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">2</span>, <span class="string">"卢俊义"</span>, <span class="string">"玉麒麟"</span>));</span><br><span class="line"> singleLinkedList.add(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">3</span>, <span class="string">"吴用"</span>, <span class="string">"智多星"</span>));</span><br><span class="line"> singleLinkedList.add(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">4</span>, <span class="string">"林冲"</span>, <span class="string">"豹子头"</span>));</span><br><span class="line"> <span class="comment">//显示链表</span></span><br><span class="line"> singleLinkedList.list();</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment">//定义SingleLinkedList来管理我们的英雄任务</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">SingleLinkedList</span> {</span><br><span class="line"> <span class="comment">//初始化一个头节点 不存储具体的数据</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">HeroNode</span> <span class="variable">head</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">0</span>, <span class="string">""</span>, <span class="string">""</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">public</span> <span class="keyword">void</span> <span class="title function_">add</span><span class="params">(HeroNode heroNode)</span> {</span><br><span class="line"> <span class="comment">//找到当前链表的最后一个节点</span></span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">temp</span> <span class="operator">=</span> head;</span><br><span class="line"> <span class="keyword">while</span> (temp.next != <span class="literal">null</span>) {</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> temp.next = heroNode;</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">public</span> <span class="keyword">void</span> <span class="title function_">list</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//先判断链表是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (head.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"链表为空!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">temp</span> <span class="operator">=</span> head;</span><br><span class="line"> <span class="keyword">while</span> (temp.next != <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(temp.next);</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment">//定义一个heroNode,每个heroNode对象都是一个节点</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">HeroNode</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="type">int</span> no;</span><br><span class="line"> <span class="keyword">public</span> String name;</span><br><span class="line"> <span class="keyword">public</span> String nickname;</span><br><span class="line"> <span class="keyword">public</span> HeroNode next; <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="keyword">public</span> <span class="title function_">HeroNode</span><span class="params">(<span class="type">int</span> no, String name, String nickname)</span> {</span><br><span class="line"> <span class="built_in">this</span>.no = no;</span><br><span class="line"> <span class="built_in">this</span>.name = name;</span><br><span class="line"> <span class="built_in">this</span>.nickname = nickname;</span><br><span class="line"> }</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> String <span class="title function_">toString</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"HeroNode{"</span> +</span><br><span class="line"> <span class="string">"no="</span> + no +</span><br><span class="line"> <span class="string">", name='"</span> + name + <span class="string">'\''</span> +</span><br><span class="line"> <span class="string">", nickname='"</span> + nickname + <span class="string">'\''</span> +</span><br><span class="line"> <span class="string">'}'</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="4-2-2修改单链表中节点的方法"><a href="#4-2-2修改单链表中节点的方法" class="headerlink" title="4.2.2修改单链表中节点的方法"></a>4.2.2修改单链表中节点的方法</h4><figure class="highlight java"><table><tr><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="keyword">public</span> <span class="keyword">void</span> <span class="title function_">update</span><span class="params">(HeroNode newHeroNode)</span> {</span><br><span class="line"> <span class="comment">//判断链表是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (head.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"链表为空,无法修改该节点!"</span>);</span><br><span class="line"> <span class="keyword">return</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="type">HeroNode</span> <span class="variable">temp</span> <span class="operator">=</span> head.next;</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">idFind</span> <span class="operator">=</span> <span class="literal">false</span>; <span class="comment">//是否找到节点的信息</span></span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> <span class="keyword">if</span> (temp == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">break</span>;<span class="comment">//已经到了链表的结尾,就退出循环</span></span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (temp.no == newHeroNode.no) {<span class="comment">//找到修改的节点</span></span><br><span class="line"> temp.name = newHeroNode.name;</span><br><span class="line"> temp.nickname = newHeroNode.nickname;</span><br><span class="line"> idFind = <span class="literal">true</span>; <span class="comment">//找到了节点并且修改了节点的信息</span></span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//做出判断,返回结果</span></span><br><span class="line"> System.out.println(idFind ? <span class="string">"修改成功"</span> : <span class="string">"没有找到该节点的信息"</span>);</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="4-2-3删除单链表中节点的方法"><a href="#4-2-3删除单链表中节点的方法" class="headerlink" title="4.2.3删除单链表中节点的方法"></a>4.2.3删除单链表中节点的方法</h4><figure class="highlight java"><table><tr><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="keyword">public</span> <span class="keyword">void</span> <span class="title function_">delete</span><span class="params">(<span class="type">int</span> no)</span> {</span><br><span class="line"> <span class="comment">//判断链表是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (head.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"链表为空,无法删除!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//找到要删除的节点的信息</span></span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">temp</span> <span class="operator">=</span> head;</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isDelete</span> <span class="operator">=</span> <span class="literal">false</span>;<span class="comment">//是否删除</span></span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> <span class="keyword">if</span> (temp.next == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//这里的temp指的是要删除节点的上一个节点 temp.next.next指的是要删除节点的下一个节点</span></span><br><span class="line"> <span class="keyword">if</span> (temp.next.no == no) {</span><br><span class="line"> <span class="comment">//将要删除的节点的上一个节点指向要删除节点的下一个节点 实现删除的操作</span></span><br><span class="line"> <span class="comment">//这样要删除的节点没有引用指向,会被垃圾回收机制回收</span></span><br><span class="line"> temp.next = temp.next.next; </span><br><span class="line"> isDelete = <span class="literal">true</span>;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//做出判断,返回结果</span></span><br><span class="line"> System.out.println(isDelete ? <span class="string">"删除成功"</span> : <span class="string">"没有找到该节点的信息"</span>);</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="4-2-4完整代码"><a href="#4-2-4完整代码" class="headerlink" title="4.2.4完整代码"></a>4.2.4完整代码</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.linkedlist;</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/4/28</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 单链表的实现</span></span><br><span class="line"><span class="comment"> * 使用带head头的单向链表实现 –水浒英雄排行榜管理</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">public</span> <span class="keyword">class</span> <span class="title class_">SingleLinkedListDemo</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">SingleLinkedList</span> <span class="variable">singleLinkedList</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SingleLinkedList</span>();</span><br><span class="line"> singleLinkedList.add(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">1</span>, <span class="string">"宋江"</span>, <span class="string">"及时雨"</span>));</span><br><span class="line"> singleLinkedList.add(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">2</span>, <span class="string">"卢俊义"</span>, <span class="string">"玉麒麟"</span>));</span><br><span class="line"> singleLinkedList.add(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">3</span>, <span class="string">"吴用"</span>, <span class="string">"智多星"</span>));</span><br><span class="line"> singleLinkedList.add(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">4</span>, <span class="string">"林冲"</span>, <span class="string">"豹子头"</span>));</span><br><span class="line"> <span class="comment">//显示链表</span></span><br><span class="line"> singleLinkedList.list();</span><br><span class="line"> <span class="comment">//测试修改节点的功能</span></span><br><span class="line"> singleLinkedList.update(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">2</span>, <span class="string">"卢俊义"</span>, <span class="string">"玉麒麟增强版"</span>));</span><br><span class="line"> <span class="comment">//显示链表的信息</span></span><br><span class="line"> singleLinkedList.list();</span><br><span class="line"> <span class="comment">//测试删除节点</span></span><br><span class="line"> singleLinkedList.delete(<span class="number">2</span>);</span><br><span class="line"> <span class="comment">//显示链表的信息</span></span><br><span class="line"> singleLinkedList.list();</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment">//定义SingleLinkedList来管理我们的英雄任务</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">SingleLinkedList</span> {</span><br><span class="line"> <span class="comment">//初始化一个头节点 不存储具体的数据</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">HeroNode</span> <span class="variable">head</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">0</span>, <span class="string">""</span>, <span class="string">""</span>);</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="keyword">public</span> <span class="keyword">void</span> <span class="title function_">delete</span><span class="params">(<span class="type">int</span> no)</span> {</span><br><span class="line"> <span class="comment">//判断链表是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (head.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"链表为空,无法删除!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//找到要删除的节点的信息</span></span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">temp</span> <span class="operator">=</span> head;</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isDelete</span> <span class="operator">=</span> <span class="literal">false</span>;<span class="comment">//是否删除</span></span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> <span class="keyword">if</span> (temp.next == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (temp.next.no == no) {<span class="comment">//这里的temp指的是要删除节点的上一个节点 temp.next.next指的是要删除节点的下一个节点</span></span><br><span class="line"> <span class="comment">//将当前节点的上一个节点指向当前节点的下一个节点</span></span><br><span class="line"> temp.next = temp.next.next; <span class="comment">//将要删除的节点的上一个节点指向要删除节点的下一个节点 这样要删除的节点没有引用指向 会被垃圾回收机制回收</span></span><br><span class="line"> isDelete = <span class="literal">true</span>;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//做出判断,返回结果</span></span><br><span class="line"> System.out.println(isDelete ? <span class="string">"删除成功"</span> : <span class="string">"没有找到该节点的信息"</span>);</span><br><span class="line"> }</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="keyword">public</span> <span class="keyword">void</span> <span class="title function_">update</span><span class="params">(HeroNode newHeroNode)</span> {</span><br><span class="line"> <span class="comment">//判断链表是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (head.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"链表为空,无法修改该节点!"</span>);</span><br><span class="line"> <span class="keyword">return</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="type">HeroNode</span> <span class="variable">temp</span> <span class="operator">=</span> head.next;</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">idFind</span> <span class="operator">=</span> <span class="literal">false</span>; <span class="comment">//是否找到节点的信息</span></span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> <span class="keyword">if</span> (temp == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">break</span>;<span class="comment">//已经到了链表的结尾,就退出循环</span></span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (temp.no == newHeroNode.no) {<span class="comment">//找到修改的节点</span></span><br><span class="line"> temp.name = newHeroNode.name;</span><br><span class="line"> temp.nickname = newHeroNode.nickname;</span><br><span class="line"> idFind = <span class="literal">true</span>; <span class="comment">//找到了节点并且修改了节点的信息</span></span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//做出判断,返回结果</span></span><br><span class="line"> System.out.println(idFind ? <span class="string">"修改成功"</span> : <span class="string">"没有找到该节点的信息"</span>);</span><br><span class="line"> }</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">public</span> <span class="keyword">void</span> <span class="title function_">add</span><span class="params">(HeroNode heroNode)</span> {</span><br><span class="line"> <span class="comment">//找到当前链表的最后一个节点</span></span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">temp</span> <span class="operator">=</span> head;</span><br><span class="line"> <span class="keyword">while</span> (temp.next != <span class="literal">null</span>) {</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> temp.next = heroNode;</span><br><span class="line"> }</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">public</span> <span class="keyword">void</span> <span class="title function_">list</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//先判断链表是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (head.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"链表为空!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">temp</span> <span class="operator">=</span> head;</span><br><span class="line"> <span class="keyword">while</span> (temp.next != <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(temp.next);</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment">//定义一个heroNode,每个heroNode对象都是一个节点</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">HeroNode</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="type">int</span> no;</span><br><span class="line"> <span class="keyword">public</span> String name;</span><br><span class="line"> <span class="keyword">public</span> String nickname;</span><br><span class="line"> <span class="keyword">public</span> HeroNode next; <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="keyword">public</span> <span class="title function_">HeroNode</span><span class="params">(<span class="type">int</span> no, String name, String nickname)</span> {</span><br><span class="line"> <span class="built_in">this</span>.no = no;</span><br><span class="line"> <span class="built_in">this</span>.name = name;</span><br><span class="line"> <span class="built_in">this</span>.nickname = nickname;</span><br><span class="line"> }</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> String <span class="title function_">toString</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"HeroNode{"</span> +</span><br><span class="line"> <span class="string">"no="</span> + no +</span><br><span class="line"> <span class="string">", name='"</span> + name + <span class="string">'\''</span> +</span><br><span class="line"> <span class="string">", nickname='"</span> + nickname + <span class="string">'\''</span> +</span><br><span class="line"> <span class="string">'}'</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="4-2-5-单链表的面试题(新浪,百度,腾讯)"><a href="#4-2-5-单链表的面试题(新浪,百度,腾讯)" class="headerlink" title="4.2.5 单链表的面试题(新浪,百度,腾讯)"></a>4.2.5 单链表的面试题(新浪,百度,腾讯)</h4><h5 id="1-求单链表中有效节点的个数"><a href="#1-求单链表中有效节点的个数" class="headerlink" title="1.求单链表中有效节点的个数"></a>1.求单链表中有效节点的个数</h5><figure class="highlight java"><table><tr><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> heroNode 头节点</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">public</span> <span class="type">int</span> <span class="title function_">getLength</span><span class="params">(HeroNode heroNode)</span>{</span><br><span class="line"> <span class="comment">//先判断节点是否为空</span></span><br><span class="line"> <span class="keyword">if</span>(heroNode.next == <span class="literal">null</span>){</span><br><span class="line"> <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//遍历节点进行统计</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">length</span> <span class="operator">=</span> <span class="number">0</span>;<span class="comment">//有效节点的个数</span></span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">temp</span> <span class="operator">=</span> heroNode.next;<span class="comment">//这里没有统计头节点</span></span><br><span class="line"> <span class="keyword">while</span> (temp != <span class="literal">null</span>){<span class="comment">//遍历 统计个数</span></span><br><span class="line"> length++;</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> length;</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="2-查找单链表中的倒数第K个节点-新浪面试题"><a href="#2-查找单链表中的倒数第K个节点-新浪面试题" class="headerlink" title="2.查找单链表中的倒数第K个节点(新浪面试题)"></a>2.查找单链表中的倒数第K个节点(新浪面试题)</h5><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 查找单链表中的倒数第K个节点</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> index 倒数第几</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> heroNode 头节点</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 倒数第K个节点的信息</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> HeroNode <span class="title function_">getHeroNodeByLastIndex</span><span class="params">(<span class="type">int</span> index, HeroNode heroNode)</span> {</span><br><span class="line"> <span class="comment">//先判断节点是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (heroNode.next == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//首先获取有效节点的个数</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">length</span> <span class="operator">=</span> <span class="built_in">this</span>.getLength(heroNode);<span class="comment">//使用求节点有效个数的方法</span></span><br><span class="line"> <span class="comment">//求倒数第k个节点就是在求正数第(length - index + 1)节点</span></span><br><span class="line"> index = length - index; <span class="comment">//求出正向的索引位置</span></span><br><span class="line"> <span class="keyword">if</span> (index < <span class="number">0</span> || index > length) {</span><br><span class="line"> System.out.println(<span class="string">"所求的在链表中不存在"</span>);</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="type">int</span> <span class="variable">count</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">temp</span> <span class="operator">=</span> heroNode.next;</span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> <span class="keyword">if</span> (count == index) {</span><br><span class="line"> <span class="keyword">return</span> temp;</span><br><span class="line"> }</span><br><span class="line"> count++;</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="3-单链表的反转-腾讯面试题"><a href="#3-单链表的反转-腾讯面试题" class="headerlink" title="3.单链表的反转(腾讯面试题)"></a>3.单链表的反转(腾讯面试题)</h5><p><img src="/pictures/image-20230506105453269.png" alt="image-20230506105453269"></p>
|
||
<figure class="highlight java"><table><tr><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> heroNode 需要反转单链表的头节点</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">reverseHeroNode</span><span class="params">(HeroNode heroNode)</span> {</span><br><span class="line"> <span class="comment">//先判断当前的链表是否为空 或者当前的链表只有一个节点</span></span><br><span class="line"> <span class="keyword">if</span>(head.next == <span class="literal">null</span> || head.next.next == <span class="literal">null</span>){</span><br><span class="line"> System.out.println(<span class="string">"当前链表为空或者只有一个节点,无需反转"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//定义一个辅助的变量 帮助我们遍历原来的链表</span></span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">cur</span> <span class="operator">=</span> head.next;</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">next</span> <span class="operator">=</span> <span class="literal">null</span>;<span class="comment">//指向当前节点的下一个节点 我们要在挪动当前节点之前帮当前指针 下移</span></span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">reverseHeroNode</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">0</span>, <span class="string">""</span>, <span class="string">""</span>);<span class="comment">//新链表的头节点</span></span><br><span class="line"> <span class="comment">//遍历原先的列表 确定每一个链表的指向关系</span></span><br><span class="line"> <span class="keyword">while</span> (cur != <span class="literal">null</span>){</span><br><span class="line"> next = cur.next;<span class="comment">//保存当前节点的下一个节点</span></span><br><span class="line"> <span class="comment">//reverseHeroNode.next表示头节点的下一个节点 我们让cur的下一个节点(cur.next)指向头节点的下一个节点 //(reverseHeroNode.next) 就把当前的节点(cur)穿插进去了</span></span><br><span class="line"> <span class="comment">//下一句将头节点和当前节点建立关系reverseHeroNode.next = cur 整个节点就连接起来了</span></span><br><span class="line"> cur.next = reverseHeroNode.next;<span class="comment">//将cur的下一个节点指向新的链表的最前端 相当于在头节点和头节点的下一个节点 //之间穿插了一个节点</span></span><br><span class="line"> reverseHeroNode.next = cur;<span class="comment">//将cur连接到新的链表上</span></span><br><span class="line"> cur = next; <span class="comment">//cur像后移动</span></span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//将head.next指向reverseHeroNode.next 实现单链表的反转</span></span><br><span class="line"> head.next = reverseHeroNode.next;</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="4-从尾到头打印单链表(百度面试题)"><a href="#4-从尾到头打印单链表(百度面试题)" class="headerlink" title="4.从尾到头打印单链表(百度面试题)"></a>4.从尾到头打印单链表(百度面试题)</h5><p>不改变链表本身的结构(不是通过链表的反转之后再打印的)</p>
|
||
<figure class="highlight java"><table><tr><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="keyword">public</span> <span class="keyword">void</span> <span class="title function_">reversePrint</span><span class="params">(HeroNode heroNode)</span> {</span><br><span class="line"> <span class="comment">//先判断当前的链表是否为空 或者当前的链表只有一个节点</span></span><br><span class="line"> <span class="keyword">if</span> (head.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"当前链表为空,无法逆序打印!"</span>);</span><br><span class="line"> <span class="keyword">return</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"> Stack<HeroNode> stack = <span class="keyword">new</span> <span class="title class_">Stack</span><>();</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">cur</span> <span class="operator">=</span> heroNode.next;</span><br><span class="line"> <span class="comment">//循环将每一个节点添加进栈中</span></span><br><span class="line"> <span class="keyword">while</span> (cur != <span class="literal">null</span>) {</span><br><span class="line"> stack.push(cur);<span class="comment">//将节点压入栈中</span></span><br><span class="line"> cur = cur.next;<span class="comment">//cur后移 压入下一个节点</span></span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//将栈中节点打印</span></span><br><span class="line"> <span class="keyword">while</span> (stack.size() > <span class="number">0</span>) {</span><br><span class="line"> System.out.println(stack.pop());</span><br><span class="line"> }</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="5-合并两个有序的单链表,合并之后的链表依然有序"><a href="#5-合并两个有序的单链表,合并之后的链表依然有序" class="headerlink" title="5.合并两个有序的单链表,合并之后的链表依然有序"></a>5.合并两个有序的单链表,合并之后的链表依然有序</h5><p>以下代码有一些bug 后期修改</p>
|
||
<figure class="highlight java"><table><tr><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">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">mergeHeroNode</span><span class="params">(HeroNode oneHead, HeroNode twoHead ,HeroNode head)</span> {</span><br><span class="line"> <span class="comment">//先判断两个链表是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (oneHead.next == <span class="literal">null</span> || twoHead.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"其中有一个(两个)链表为空,无法合并"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//合并</span></span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">oneCur</span> <span class="operator">=</span> oneHead.next;</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">twoCur</span> <span class="operator">=</span> twoHead.next;</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">oneNext</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">twoNext</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">finalHeroHead</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">0</span>, <span class="string">""</span>, <span class="string">""</span>);</span><br><span class="line"> <span class="keyword">while</span> (oneCur != <span class="literal">null</span> && twoCur != <span class="literal">null</span>) {</span><br><span class="line"> oneNext = oneCur.next;</span><br><span class="line"> twoNext = twoCur.next;</span><br><span class="line"> <span class="keyword">if</span>(oneCur.no <= twoCur.no) {</span><br><span class="line"> oneCur.next = finalHeroHead.next;</span><br><span class="line"> finalHeroHead.next = oneCur;</span><br><span class="line"> oneCur = oneNext;</span><br><span class="line"> }<span class="keyword">else</span> {</span><br><span class="line"> twoCur.next = finalHeroHead.next;</span><br><span class="line"> finalHeroHead.next = twoCur;</span><br><span class="line"> twoCur = twoNext;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> head.next = finalHeroHead.next;</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<h5 id="全部代码"><a href="#全部代码" class="headerlink" title="全部代码"></a>全部代码</h5><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.linkedlist;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Stack;</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/4/28</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 单链表的实现</span></span><br><span class="line"><span class="comment"> * 使用带head头的单向链表实现 –水浒英雄排行榜管理</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">public</span> <span class="keyword">class</span> <span class="title class_">SingleLinkedListDemo</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">SingleLinkedList</span> <span class="variable">singleLinkedList</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SingleLinkedList</span>();</span><br><span class="line"><span class="comment">// singleLinkedList.add(new HeroNode(1, "宋江", "及时雨"));</span></span><br><span class="line"><span class="comment">// singleLinkedList.add(new HeroNode(2, "卢俊义", "玉麒麟"));</span></span><br><span class="line"><span class="comment">// singleLinkedList.add(new HeroNode(3, "吴用", "智多星"));</span></span><br><span class="line"><span class="comment">// singleLinkedList.add(new HeroNode(4, "林冲", "豹子头"));</span></span><br><span class="line"><span class="comment">// //显示链表</span></span><br><span class="line"><span class="comment">// singleLinkedList.list();</span></span><br><span class="line"><span class="comment">// //测试修改节点的功能</span></span><br><span class="line"><span class="comment">// singleLinkedList.update(new HeroNode(2, "卢俊义", "玉麒麟增强版"));</span></span><br><span class="line"><span class="comment">// //显示链表的信息</span></span><br><span class="line"><span class="comment">// singleLinkedList.list();</span></span><br><span class="line"><span class="comment">// //测试删除节点</span></span><br><span class="line"><span class="comment">// singleLinkedList.delete(2);</span></span><br><span class="line"><span class="comment">// //显示链表的信息</span></span><br><span class="line"><span class="comment">// singleLinkedList.list();</span></span><br><span class="line"><span class="comment">// //统计有效节点的个数</span></span><br><span class="line"><span class="comment">// System.out.println("有效节点的个数" + singleLinkedList.getLength(singleLinkedList.getHead()));</span></span><br><span class="line"><span class="comment">// //查找单链表中的倒数第K个节点</span></span><br><span class="line"><span class="comment">// int index = 2;</span></span><br><span class="line"><span class="comment">// System.out.println("倒数第" + index + "个节点的位置:" + singleLinkedList.getHeroNodeByLastIndex(index, singleLinkedList.getHead()));</span></span><br><span class="line"><span class="comment">// //测试单链表的反转</span></span><br><span class="line"><span class="comment">// singleLinkedList.reverseHeroNode(singleLinkedList.getHead());</span></span><br><span class="line"><span class="comment">// singleLinkedList.list();</span></span><br><span class="line"><span class="comment">// //测试通过栈的方式逆序打印</span></span><br><span class="line"><span class="comment">// System.out.println("测试通过栈的方式逆序打印头节点");</span></span><br><span class="line"><span class="comment">// singleLinkedList.reversePrint(singleLinkedList.getHead());</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">//测试合并两个有序的链表</span></span><br><span class="line"> <span class="type">SingleLinkedList</span> <span class="variable">singleLinkedList1</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SingleLinkedList</span>();</span><br><span class="line"> singleLinkedList1.add(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">1</span>, <span class="string">"宋江"</span>, <span class="string">"及时雨"</span>));</span><br><span class="line"> singleLinkedList1.add(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">3</span>, <span class="string">"卢俊义"</span>, <span class="string">"玉麒麟"</span>));</span><br><span class="line"> singleLinkedList1.add(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">5</span>, <span class="string">"吴用"</span>, <span class="string">"智多星"</span>));</span><br><span class="line"> singleLinkedList1.add(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">7</span>, <span class="string">"林冲"</span>, <span class="string">"豹子头"</span>));</span><br><span class="line"> <span class="type">SingleLinkedList</span> <span class="variable">singleLinkedList2</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SingleLinkedList</span>();</span><br><span class="line"> singleLinkedList2.add(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">2</span>, <span class="string">"宋江"</span>, <span class="string">"及时雨"</span>));</span><br><span class="line"> singleLinkedList2.add(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">4</span>, <span class="string">"卢俊义"</span>, <span class="string">"玉麒麟"</span>));</span><br><span class="line"> singleLinkedList2.add(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">6</span>, <span class="string">"吴用"</span>, <span class="string">"智多星"</span>));</span><br><span class="line"> singleLinkedList2.add(<span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">8</span>, <span class="string">"林冲"</span>, <span class="string">"豹子头"</span>));</span><br><span class="line"> mergeHeroNode(singleLinkedList1.getHead(),singleLinkedList2.getHead(),singleLinkedList.getHead());</span><br><span class="line"> singleLinkedList.list();</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">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">mergeHeroNode</span><span class="params">(HeroNode oneHead, HeroNode twoHead ,HeroNode head)</span> {</span><br><span class="line"> <span class="comment">//先判断两个链表是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (oneHead.next == <span class="literal">null</span> || twoHead.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"其中有一个(两个)链表为空,无法合并"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//合并</span></span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">oneCur</span> <span class="operator">=</span> oneHead.next;</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">twoCur</span> <span class="operator">=</span> twoHead.next;</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">oneNext</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">twoNext</span> <span class="operator">=</span> <span class="literal">null</span>;</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">finalHeroHead</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">0</span>, <span class="string">""</span>, <span class="string">""</span>);</span><br><span class="line"> <span class="keyword">while</span> (oneCur != <span class="literal">null</span> && twoCur != <span class="literal">null</span>) {</span><br><span class="line"> oneNext = oneCur.next;</span><br><span class="line"> twoNext = twoCur.next;</span><br><span class="line"> <span class="keyword">if</span>(oneCur.no <= twoCur.no) {</span><br><span class="line"> oneCur.next = finalHeroHead.next;</span><br><span class="line"> finalHeroHead.next = oneCur;</span><br><span class="line"> oneCur = oneNext;</span><br><span class="line"> }<span class="keyword">else</span> {</span><br><span class="line"> twoCur.next = finalHeroHead.next;</span><br><span class="line"> finalHeroHead.next = twoCur;</span><br><span class="line"> twoCur = twoNext;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> head.next = finalHeroHead.next;</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment">//定义SingleLinkedList来管理我们的英雄任务</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">SingleLinkedList</span> {</span><br><span class="line"> <span class="comment">//初始化一个头节点 不存储具体的数据</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">HeroNode</span> <span class="variable">head</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">0</span>, <span class="string">""</span>, <span class="string">""</span>);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> HeroNode <span class="title function_">getHead</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> head;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></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="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">reversePrint</span><span class="params">(HeroNode heroNode)</span> {</span><br><span class="line"> <span class="comment">//先判断当前的链表是否为空 或者当前的链表只有一个节点</span></span><br><span class="line"> <span class="keyword">if</span> (heroNode.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"当前链表为空,无法逆序打印!"</span>);</span><br><span class="line"> <span class="keyword">return</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"> Stack<HeroNode> stack = <span class="keyword">new</span> <span class="title class_">Stack</span><>();</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">cur</span> <span class="operator">=</span> heroNode.next;</span><br><span class="line"> <span class="comment">//循环将每一个节点添加进栈中</span></span><br><span class="line"> <span class="keyword">while</span> (cur != <span class="literal">null</span>) {</span><br><span class="line"> stack.push(cur);<span class="comment">//将节点压入栈中</span></span><br><span class="line"> cur = cur.next;<span class="comment">//cur后移 压入下一个节点</span></span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//将栈中节点打印</span></span><br><span class="line"> <span class="keyword">while</span> (stack.size() > <span class="number">0</span>) {</span><br><span class="line"> System.out.println(stack.pop());</span><br><span class="line"> }</span><br><span class="line"> }</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 class="doctag">@param</span> heroNode 需要反转单链表的头节点</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">reverseHeroNode</span><span class="params">(HeroNode heroNode)</span> {</span><br><span class="line"> <span class="comment">//先判断当前的链表是否为空 或者当前的链表只有一个节点</span></span><br><span class="line"> <span class="keyword">if</span> (heroNode.next == <span class="literal">null</span> || heroNode.next.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"当前链表为空或者只有一个节点,无需反转"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//定义一个辅助的变量 帮助我们遍历原来的链表</span></span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">cur</span> <span class="operator">=</span> heroNode.next;</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">next</span> <span class="operator">=</span> <span class="literal">null</span>;<span class="comment">//指向当前节点的下一个节点 我们要在挪动当前节点之前帮当前指针 下移</span></span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">reverseHeroNode</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">HeroNode</span>(<span class="number">0</span>, <span class="string">""</span>, <span class="string">""</span>);<span class="comment">//新链表的头节点</span></span><br><span class="line"> <span class="comment">//遍历原先的列表 确定每一个链表的指向关系</span></span><br><span class="line"> <span class="keyword">while</span> (cur != <span class="literal">null</span>) {</span><br><span class="line"> next = cur.next;<span class="comment">//保存当前节点的下一个节点</span></span><br><span class="line"> <span class="comment">//reverseHeroNode.next表示头节点的下一个节点 我们让cur的下一个节点(cur.next)指向头节点的下一个节点(reverseHeroNode.next) 就把当前的节点(cur)穿插进去了</span></span><br><span class="line"> <span class="comment">//下一句将头节点和当前节点建立关系reverseHeroNode.next = cur 整个节点就连接起来了</span></span><br><span class="line"> cur.next = reverseHeroNode.next;<span class="comment">//将cur的下一个节点指向新的链表的最前端 相当于在头节点和头节点的下一个节点之间穿插了一个节点</span></span><br><span class="line"> reverseHeroNode.next = cur;<span class="comment">//将cur连接到新的链表上</span></span><br><span class="line"> cur = next; <span class="comment">//cur像后移动</span></span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//将head.next指向reverseHeroNode.next 实现单链表的反转</span></span><br><span class="line"> heroNode.next = reverseHeroNode.next;</span><br><span class="line"> }</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"> * 查找单链表中的倒数第K个节点</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> index 倒数第几</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> heroNode 头节点</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 倒数第K个节点的信息</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> HeroNode <span class="title function_">getHeroNodeByLastIndex</span><span class="params">(<span class="type">int</span> index, HeroNode heroNode)</span> {</span><br><span class="line"> <span class="comment">//先判断节点是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (heroNode.next == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//首先获取有效节点的个数</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">length</span> <span class="operator">=</span> <span class="built_in">this</span>.getLength(heroNode);<span class="comment">//使用求节点有效个数的方法</span></span><br><span class="line"> <span class="comment">//求倒数第k个节点就是在求正数第(length - index + 1)节点</span></span><br><span class="line"> index = length - index; <span class="comment">//求出正向的索引位置</span></span><br><span class="line"> <span class="keyword">if</span> (index < <span class="number">0</span> || index > length) {</span><br><span class="line"> System.out.println(<span class="string">"所求的在链表中不存在"</span>);</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="type">int</span> <span class="variable">count</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">temp</span> <span class="operator">=</span> heroNode.next;</span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> <span class="keyword">if</span> (count == index) {</span><br><span class="line"> <span class="keyword">return</span> temp;</span><br><span class="line"> }</span><br><span class="line"> count++;</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</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 class="doctag">@param</span> heroNode 头节点</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">public</span> <span class="type">int</span> <span class="title function_">getLength</span><span class="params">(HeroNode heroNode)</span> {</span><br><span class="line"> <span class="comment">//先判断节点是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (heroNode.next == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//遍历节点进行统计</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">length</span> <span class="operator">=</span> <span class="number">0</span>;<span class="comment">//有效节点的个数</span></span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">temp</span> <span class="operator">=</span> heroNode.next;<span class="comment">//这里没有统计头节点</span></span><br><span class="line"> <span class="keyword">while</span> (temp != <span class="literal">null</span>) {<span class="comment">//遍历 统计个数</span></span><br><span class="line"> length++;</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> length;</span><br><span class="line"> }</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="keyword">public</span> <span class="keyword">void</span> <span class="title function_">delete</span><span class="params">(<span class="type">int</span> no)</span> {</span><br><span class="line"> <span class="comment">//判断链表是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (head.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"链表为空,无法删除!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//找到要删除的节点的信息</span></span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">temp</span> <span class="operator">=</span> head;</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isDelete</span> <span class="operator">=</span> <span class="literal">false</span>;<span class="comment">//是否删除</span></span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> <span class="keyword">if</span> (temp.next == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (temp.next.no == no) {<span class="comment">//这里的temp指的是要删除节点的上一个节点 temp.next.next指的是要删除节点的下一个节点</span></span><br><span class="line"> <span class="comment">//将当前节点的上一个节点指向当前节点的下一个节点</span></span><br><span class="line"> temp.next = temp.next.next; <span class="comment">//将要删除的节点的上一个节点指向要删除节点的下一个节点 这样要删除的节点没有引用指向 会被垃圾回收机制回收</span></span><br><span class="line"> isDelete = <span class="literal">true</span>;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//做出判断,返回结果</span></span><br><span class="line"> System.out.println(isDelete ? <span class="string">"删除成功"</span> : <span class="string">"没有找到该节点的信息"</span>);</span><br><span class="line"> }</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="keyword">public</span> <span class="keyword">void</span> <span class="title function_">update</span><span class="params">(HeroNode newHeroNode)</span> {</span><br><span class="line"> <span class="comment">//判断链表是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (head.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"链表为空,无法修改该节点!"</span>);</span><br><span class="line"> <span class="keyword">return</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="type">HeroNode</span> <span class="variable">temp</span> <span class="operator">=</span> head.next;</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">idFind</span> <span class="operator">=</span> <span class="literal">false</span>; <span class="comment">//是否找到节点的信息</span></span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> <span class="keyword">if</span> (temp == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">break</span>;<span class="comment">//已经到了链表的结尾,就退出循环</span></span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (temp.no == newHeroNode.no) {<span class="comment">//找到修改的节点</span></span><br><span class="line"> temp.name = newHeroNode.name;</span><br><span class="line"> temp.nickname = newHeroNode.nickname;</span><br><span class="line"> idFind = <span class="literal">true</span>; <span class="comment">//找到了节点并且修改了节点的信息</span></span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//做出判断,返回结果</span></span><br><span class="line"> System.out.println(idFind ? <span class="string">"修改成功"</span> : <span class="string">"没有找到该节点的信息"</span>);</span><br><span class="line"> }</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">public</span> <span class="keyword">void</span> <span class="title function_">add</span><span class="params">(HeroNode heroNode)</span> {</span><br><span class="line"> <span class="comment">//找到当前链表的最后一个节点</span></span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">temp</span> <span class="operator">=</span> head;</span><br><span class="line"> <span class="keyword">while</span> (temp.next != <span class="literal">null</span>) {</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> temp.next = heroNode;</span><br><span class="line"> }</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">public</span> <span class="keyword">void</span> <span class="title function_">list</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//先判断链表是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (head.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"链表为空!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="type">HeroNode</span> <span class="variable">temp</span> <span class="operator">=</span> head;</span><br><span class="line"> <span class="keyword">while</span> (temp.next != <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(temp.next);</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment">//定义一个heroNode,每个heroNode对象都是一个节点</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">HeroNode</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="type">int</span> no;</span><br><span class="line"> <span class="keyword">public</span> String name;</span><br><span class="line"> <span class="keyword">public</span> String nickname;</span><br><span class="line"> <span class="keyword">public</span> HeroNode next; <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="keyword">public</span> <span class="title function_">HeroNode</span><span class="params">(<span class="type">int</span> no, String name, String nickname)</span> {</span><br><span class="line"> <span class="built_in">this</span>.no = no;</span><br><span class="line"> <span class="built_in">this</span>.name = name;</span><br><span class="line"> <span class="built_in">this</span>.nickname = nickname;</span><br><span class="line"> }</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> String <span class="title function_">toString</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"HeroNode{"</span> +</span><br><span class="line"> <span class="string">"no="</span> + no +</span><br><span class="line"> <span class="string">", name='"</span> + name + <span class="string">'\''</span> +</span><br><span class="line"> <span class="string">", nickname='"</span> + nickname + <span class="string">'\''</span> +</span><br><span class="line"> <span class="string">'}'</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
<h3 id="4-3-双向链表"><a href="#4-3-双向链表" class="headerlink" title="4.3 双向链表"></a>4.3 双向链表</h3><p>双向的链表的CRUD操作于单向链表的CRUD操作类似</p>
|
||
<p><img src="/pictures/image-20230507100730848.png" alt="image-20230507100730848"></p>
|
||
<p>完整的增删改查代码</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.linkedlist;</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/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="keyword">public</span> <span class="keyword">class</span> <span class="title class_">DoubleLinkedListDemo</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">DoubleLinkedList</span> <span class="variable">doubleLinkedList</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">DoubleLinkedList</span>();</span><br><span class="line"> <span class="comment">//测试添加链表的功能</span></span><br><span class="line"> doubleLinkedList.add(<span class="keyword">new</span> <span class="title class_">HeroNode2</span>(<span class="number">1</span>, <span class="string">"宋江"</span>, <span class="string">"及时雨"</span>));</span><br><span class="line"> doubleLinkedList.add(<span class="keyword">new</span> <span class="title class_">HeroNode2</span>(<span class="number">2</span>, <span class="string">"卢俊义"</span>, <span class="string">"玉麒麟"</span>));</span><br><span class="line"> doubleLinkedList.add(<span class="keyword">new</span> <span class="title class_">HeroNode2</span>(<span class="number">3</span>, <span class="string">"吴用"</span>, <span class="string">"智多星"</span>));</span><br><span class="line"> doubleLinkedList.add(<span class="keyword">new</span> <span class="title class_">HeroNode2</span>(<span class="number">4</span>, <span class="string">"林冲"</span>, <span class="string">"豹子头"</span>));</span><br><span class="line"> <span class="comment">//测试显示链表的功能</span></span><br><span class="line"> doubleLinkedList.list();</span><br><span class="line"> <span class="comment">//测试删除双向链表中的节点</span></span><br><span class="line"> doubleLinkedList.delete(<span class="number">2</span>);</span><br><span class="line"> doubleLinkedList.list();</span><br><span class="line"> <span class="comment">//测试修改双向链表中的节点</span></span><br><span class="line"> doubleLinkedList.update(<span class="keyword">new</span> <span class="title class_">HeroNode2</span>(<span class="number">2</span>, <span class="string">"卢俊义修改版"</span>, <span class="string">"玉麒麟"</span>));</span><br><span class="line"> doubleLinkedList.list();</span><br><span class="line"> System.out.println(<span class="string">"--------------"</span>);</span><br><span class="line"> doubleLinkedList.orderAdd(<span class="keyword">new</span> <span class="title class_">HeroNode2</span>(<span class="number">3</span>, <span class="string">"小卢"</span>, <span class="string">"玉麒麟"</span>));</span><br><span class="line"> doubleLinkedList.list();</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">DoubleLinkedList</span> {</span><br><span class="line"> <span class="comment">//初始化一个头节点 不存储具体的数据</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">HeroNode2</span> <span class="variable">head</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">HeroNode2</span>(<span class="number">0</span>, <span class="string">""</span>, <span class="string">""</span>);</span><br><span class="line"></span><br><span class="line"> <span class="comment">//返回头节点的信息</span></span><br><span class="line"> <span class="keyword">public</span> HeroNode2 <span class="title function_">getHead</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> head;</span><br><span class="line"> }</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="keyword">public</span> <span class="keyword">void</span> <span class="title function_">orderAdd</span><span class="params">(HeroNode2 heroNode)</span> {</span><br><span class="line"> <span class="comment">//找到当前链表的最后一个节点</span></span><br><span class="line"> <span class="type">HeroNode2</span> <span class="variable">temp</span> <span class="operator">=</span> head;</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isSuccess</span> <span class="operator">=</span> <span class="literal">false</span>;</span><br><span class="line"> <span class="keyword">while</span> (temp.next != <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">if</span> (temp.next.no >= heroNode.no) {</span><br><span class="line"> heroNode.next = temp.next;</span><br><span class="line"> temp.next.pre = heroNode;</span><br><span class="line"> temp.next = heroNode;</span><br><span class="line"> heroNode.pre = temp;</span><br><span class="line"> isSuccess = <span class="literal">true</span>;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (!isSuccess) {<span class="comment">//没有添加成功 说明当前链表的序号超过了链表里面已有节点序号的最高值 直接添加到最后</span></span><br><span class="line"> <span class="built_in">this</span>.add(heroNode);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> }</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">public</span> <span class="keyword">void</span> <span class="title function_">delete</span><span class="params">(<span class="type">int</span> no)</span> {</span><br><span class="line"> <span class="comment">//判断链表是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (head.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"链表为空,无法删除!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//找到要删除的节点的信息</span></span><br><span class="line"> <span class="type">HeroNode2</span> <span class="variable">temp</span> <span class="operator">=</span> head.next;</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">isDelete</span> <span class="operator">=</span> <span class="literal">false</span>;<span class="comment">//是否删除</span></span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> <span class="keyword">if</span> (temp == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (temp.no == no) {</span><br><span class="line"> temp.pre.next = temp.next;</span><br><span class="line"> <span class="keyword">if</span> (temp.next != <span class="literal">null</span>) {</span><br><span class="line"> temp.next.pre = temp.pre;<span class="comment">//这句话有个条件 temp不能是最后一个节点</span></span><br><span class="line"> }</span><br><span class="line"> isDelete = <span class="literal">true</span>;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> System.out.println(isDelete ? <span class="string">"删除成功"</span> : <span class="string">"没有找到该节点的信息"</span>);</span><br><span class="line"> }</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">public</span> <span class="keyword">void</span> <span class="title function_">update</span><span class="params">(HeroNode2 newHeroNode)</span> {</span><br><span class="line"> <span class="comment">//判断链表是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (head.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"链表为空,无法修改该节点!"</span>);</span><br><span class="line"> <span class="keyword">return</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="type">HeroNode2</span> <span class="variable">temp</span> <span class="operator">=</span> head.next;</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">idFind</span> <span class="operator">=</span> <span class="literal">false</span>; <span class="comment">//是否找到节点的信息</span></span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> <span class="keyword">if</span> (temp == <span class="literal">null</span>) {</span><br><span class="line"> <span class="keyword">break</span>;<span class="comment">//已经到了链表的结尾,就退出循环</span></span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (temp.no == newHeroNode.no) {<span class="comment">//找到修改的节点</span></span><br><span class="line"> temp.name = newHeroNode.name;</span><br><span class="line"> temp.nickname = newHeroNode.nickname;</span><br><span class="line"> idFind = <span class="literal">true</span>; <span class="comment">//找到了节点并且修改了节点的信息</span></span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//做出判断,返回结果</span></span><br><span class="line"> System.out.println(idFind ? <span class="string">"修改成功"</span> : <span class="string">"没有找到该节点的信息"</span>);</span><br><span class="line"> }</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">public</span> <span class="keyword">void</span> <span class="title function_">add</span><span class="params">(HeroNode2 heroNode)</span> {</span><br><span class="line"> <span class="comment">//找到当前链表的最后一个节点</span></span><br><span class="line"> <span class="type">HeroNode2</span> <span class="variable">temp</span> <span class="operator">=</span> head;</span><br><span class="line"> <span class="keyword">while</span> (temp.next != <span class="literal">null</span>) {</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> temp.next = heroNode;</span><br><span class="line"> heroNode.pre = temp;</span><br><span class="line"> }</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">public</span> <span class="keyword">void</span> <span class="title function_">list</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//先判断链表是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (head.next == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"链表为空!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="type">HeroNode2</span> <span class="variable">temp</span> <span class="operator">=</span> head;</span><br><span class="line"> <span class="keyword">while</span> (temp.next != <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(temp.next);</span><br><span class="line"> temp = temp.next;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment">//定义一个heroNode,每个heroNode对象都是一个节点</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">HeroNode2</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="type">int</span> no;</span><br><span class="line"> <span class="keyword">public</span> String name;</span><br><span class="line"> <span class="keyword">public</span> String nickname;</span><br><span class="line"> <span class="keyword">public</span> HeroNode2 next; <span class="comment">//指向下一个节点</span></span><br><span class="line"> <span class="keyword">public</span> HeroNode2 pre;<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="keyword">public</span> <span class="title function_">HeroNode2</span><span class="params">(<span class="type">int</span> no, String name, String nickname)</span> {</span><br><span class="line"> <span class="built_in">this</span>.no = no;</span><br><span class="line"> <span class="built_in">this</span>.name = name;</span><br><span class="line"> <span class="built_in">this</span>.nickname = nickname;</span><br><span class="line"> }</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> String <span class="title function_">toString</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"HeroNode{"</span> +</span><br><span class="line"> <span class="string">"no="</span> + no +</span><br><span class="line"> <span class="string">", name='"</span> + name + <span class="string">'\''</span> +</span><br><span class="line"> <span class="string">", nickname='"</span> + nickname + <span class="string">'\''</span> +</span><br><span class="line"> <span class="string">'}'</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-4-单向环形链表的应用场景-Josephu问题"><a href="#4-4-单向环形链表的应用场景-Josephu问题" class="headerlink" title="4.4 单向环形链表的应用场景(Josephu问题)"></a>4.4 单向环形链表的应用场景(Josephu问题)</h3><p> Josephu 问题为:设编号为1,2,… n的n个人围坐一圈,约定编号为k(1<=k<=n)的人从1开始报数,数到m 的那个人出列,它的下一位又从1开始报数,数到m的那个人又出列,依次类推,直到所有人出列为止,由此产生一个出队编号的序列。</p>
|
||
<p> 解决的方案:用一个不带头结点的循环链表来处理Josephu 问题:先构成一个有n个结点的单循环链表,然后由k结点起从1开始计数,计到m时,对应结点从链表中删除,然后再从被删除结点的下一个结点又从1开始计数,直到最后一个结点从链表中删除算法结束。</p>
|
||
<p><img src="/pictures/image-20230508104207815.png" alt="image-20230508104207815"></p>
|
||
<p><img src="/pictures/image-20230508121934697.png" alt="image-20230508121934697"></p>
|
||
<p>完整的代码</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.linkedlist;</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/8</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">class</span> <span class="title class_">Josephu</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="comment">//测试构建环形链表</span></span><br><span class="line"> <span class="type">CircleSingleLinkedList</span> <span class="variable">circleSingleLinkedList</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">CircleSingleLinkedList</span>();</span><br><span class="line"> circleSingleLinkedList.addBoy(<span class="number">5</span>);</span><br><span class="line"> <span class="comment">//测试遍历环形单向链表</span></span><br><span class="line"> circleSingleLinkedList.showBoy();</span><br><span class="line"> <span class="comment">//测试生成小孩出圈的序列</span></span><br><span class="line"> circleSingleLinkedList.countBoy(<span class="number">1</span>,<span class="number">2</span>,<span class="number">5</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</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">class</span> <span class="title class_">CircleSingleLinkedList</span> {</span><br><span class="line"> <span class="comment">//创建一个first节点,当前没有编号</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">Boy</span> <span class="variable">first</span> <span class="operator">=</span> <span class="literal">null</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="comment"> * <span class="doctag">@param</span> startNo 表示从第几个小孩开始数</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> countNum 表示数几下</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> nums 传入几个小孩</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">countBoy</span><span class="params">(<span class="type">int</span> startNo, <span class="type">int</span> countNum, <span class="type">int</span> nums)</span> {</span><br><span class="line"> <span class="comment">//先对输入的数据进行校验</span></span><br><span class="line"> <span class="keyword">if</span> (first == <span class="literal">null</span> || startNo < <span class="number">0</span> || startNo > nums) {</span><br><span class="line"> System.out.println(<span class="string">"参数输入有误,请重新输入!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//创建一个辅助指针</span></span><br><span class="line"> <span class="type">Boy</span> <span class="variable">helper</span> <span class="operator">=</span> first;</span><br><span class="line"> <span class="comment">//将helper指向环形链表的最后一个节点</span></span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> <span class="keyword">if</span> (helper.getNext() == first) {</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> helper = helper.getNext();</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//将first和helper移动到指定的位置 考虑从第几个小孩开始数</span></span><br><span class="line"> <span class="comment">//小孩报数前,先让 first 和 helper 移动 k - 1次</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < startNo - <span class="number">1</span>; i++) {</span><br><span class="line"> first = first.getNext();</span><br><span class="line"> helper = helper.getNext();</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//让first和helper移动 m-1次,然后出圈</span></span><br><span class="line"> <span class="comment">//循环操作 直到圈中只有一个小孩节点</span></span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>){</span><br><span class="line"> <span class="keyword">if</span>(helper == first){<span class="comment">//说明圈中只有一个节点</span></span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//让first和helper移动 countNum - 1</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < countNum - <span class="number">1</span>; i++) {</span><br><span class="line"> first = first.getNext();</span><br><span class="line"> helper = helper.getNext();</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//这时first指向的节点就是要出圈的小孩</span></span><br><span class="line"> System.out.printf(<span class="string">"小孩%d出圈\n"</span>,first.getNo());</span><br><span class="line"> <span class="comment">//将first指向的小孩出圈</span></span><br><span class="line"> first = first.getNext();</span><br><span class="line"> helper.setNext(first);</span><br><span class="line"> }</span><br><span class="line"> System.out.printf(<span class="string">"最后留在圈中小孩编号是:%d \n"</span>,helper.getNo());</span><br><span class="line"> }</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">public</span> <span class="keyword">void</span> <span class="title function_">showBoy</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//先判断链表是不是为空</span></span><br><span class="line"> <span class="keyword">if</span> (first == <span class="literal">null</span>) {</span><br><span class="line"> System.out.println(<span class="string">"环形链表为空!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//创建一个辅助指针</span></span><br><span class="line"> <span class="type">Boy</span> <span class="variable">curBoy</span> <span class="operator">=</span> first;</span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> System.out.printf(<span class="string">"小孩的编号:%d \n"</span>, curBoy.getNo());</span><br><span class="line"> <span class="keyword">if</span> (curBoy.getNext() == first) {<span class="comment">//说明已经循环一圈了 就不在循环 退出了</span></span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//向后移动</span></span><br><span class="line"> curBoy = curBoy.getNext();</span><br><span class="line"> }</span><br><span class="line"> }</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 class="doctag">@param</span> nums 传入几个小孩</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">addBoy</span><span class="params">(<span class="type">int</span> nums)</span> {</span><br><span class="line"> <span class="comment">//将传入的数据进行一个校验</span></span><br><span class="line"> <span class="keyword">if</span> (nums < <span class="number">1</span>) {<span class="comment">//传入小孩的的数量不能小于一</span></span><br><span class="line"> System.out.println(<span class="string">"输入的值不正确!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="type">Boy</span> <span class="variable">curBoy</span> <span class="operator">=</span> <span class="literal">null</span>;<span class="comment">//辅助指针,帮助构建环形链表</span></span><br><span class="line"> <span class="comment">//使用循环创建我们的环形链表</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">1</span>; i <= nums; i++) { <span class="comment">//要加入几个小孩 就循环几次</span></span><br><span class="line"> <span class="comment">//根据编号创建小孩节点</span></span><br><span class="line"> <span class="type">Boy</span> <span class="variable">boy</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Boy</span>(i);</span><br><span class="line"> <span class="comment">//将小孩加入到环形链表中</span></span><br><span class="line"> <span class="keyword">if</span> (i == <span class="number">1</span>) {<span class="comment">//说明是第一个小孩</span></span><br><span class="line"> first = boy;</span><br><span class="line"> first.setNext(first);<span class="comment">//添加的第一个节点 先自己指向自己 构建成一个环</span></span><br><span class="line"> curBoy = first; <span class="comment">//first节点我们不能动 使用辅助节点</span></span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">//这是在循环里面 每次循环之后 小孩节点都不一样</span></span><br><span class="line"> curBoy.setNext(boy);</span><br><span class="line"> boy.setNext(first); <span class="comment">//形成回路</span></span><br><span class="line"> curBoy = boy;<span class="comment">//curBoy每次指向的都是最后一个小孩节点</span></span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment">//创建一个boy类 表示一个节点</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">Boy</span> {</span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span> no; <span class="comment">//编号</span></span><br><span class="line"> <span class="keyword">private</span> Boy next;<span class="comment">//指向下一个节点 默认是null</span></span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="title function_">Boy</span><span class="params">(<span class="type">int</span> no)</span> {</span><br><span class="line"> <span class="built_in">this</span>.no = no;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="type">int</span> <span class="title function_">getNo</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> no;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">setNo</span><span class="params">(<span class="type">int</span> no)</span> {</span><br><span class="line"> <span class="built_in">this</span>.no = no;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> Boy <span class="title function_">getNext</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> next;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">setNext</span><span class="params">(Boy next)</span> {</span><br><span class="line"> <span class="built_in">this</span>.next = next;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
|
||
|
||
<h2 id="五-栈"><a href="#五-栈" class="headerlink" title="五.栈"></a>五.栈</h2><h3 id="1-介绍"><a href="#1-介绍" class="headerlink" title="1.介绍"></a>1.介绍</h3><p>1)栈的英文为(stack)</p>
|
||
<p>2)栈是一个<strong>先入后出</strong>(FILO-First In Last Out)的有序列表。</p>
|
||
<p>3)栈(stack)是限制线性表中元素的插入和删除<strong>只能在线性表的同一端</strong>进行的一种特殊线性表。允许插入和删除的一端,为变化的一端,称为<strong>栈顶</strong>(Top),另一端为固定的一端,称为<strong>栈底</strong>(Bottom)。</p>
|
||
<p>4)根据栈的定义可知,最先放入栈中元素在栈底,最后放入的元素在栈顶,而删除元素刚好相反,最后放入的元素最先删除,最先放入的元素最后删除</p>
|
||
<h3 id="2-应用场景"><a href="#2-应用场景" class="headerlink" title="2.应用场景"></a>2.应用场景</h3><p>1)子程序的调用:在跳往子程序前,会先将下个指令的地址存到堆栈中,直到子程序执行完后再将地址取出,以回到原来的程序中。 </p>
|
||
<p>2)处理递归调用:和子程序的调用类似,只是除了储存下一个指令的地址外,也将参数、区域变量等数据存入堆栈中。</p>
|
||
<p>3)表达式的转换[中缀表达式转后缀表达式]与求值(实际解决)。</p>
|
||
<p>4)二叉树的遍历。</p>
|
||
<p>5)图形的深度优先(depth一first)搜索法。</p>
|
||
<h3 id="3-图解"><a href="#3-图解" class="headerlink" title="3.图解"></a>3.图解</h3><p><img src="/pictures/image-20230510101713914.png" alt="image-20230510101713914"></p>
|
||
<p><img src="/pictures/image-20230510101722707.png" alt="image-20230510101722707"></p>
|
||
<h3 id="4-使用数组模拟栈"><a href="#4-使用数组模拟栈" class="headerlink" title="4.使用数组模拟栈"></a>4.使用数组模拟栈</h3><p><img src="/pictures/image-20230510101916230.png" alt="image-20230510101916230"></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.stack;</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/10</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">class</span> <span class="title class_">ArrayStackDemo</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">ArrayStack</span> <span class="variable">stack</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ArrayStack</span>(<span class="number">5</span>);</span><br><span class="line"> <span class="comment">//入栈</span></span><br><span class="line"> stack.push(<span class="number">1</span>);</span><br><span class="line"> stack.push(<span class="number">2</span>);</span><br><span class="line"> stack.push(<span class="number">3</span>);</span><br><span class="line"> <span class="comment">//出栈</span></span><br><span class="line"> System.out.println(<span class="string">"出栈的数是:"</span>+stack.pop());</span><br><span class="line"> <span class="comment">//显示栈中所有的数据</span></span><br><span class="line"> stack.list();</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment">//定义一个ArrayStack表示栈</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">ArrayStack</span> {</span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span> maxSize;<span class="comment">//栈的大小</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span>[] stack;<span class="comment">//数组 数组模拟栈 数据放在数组中</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span> <span class="variable">top</span> <span class="operator">=</span> -<span class="number">1</span>; <span class="comment">//top表示栈顶 初始化为1</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">//构造器</span></span><br><span class="line"> <span class="keyword">public</span> <span class="title function_">ArrayStack</span><span class="params">(<span class="type">int</span> maxSize)</span> {</span><br><span class="line"> <span class="built_in">this</span>.maxSize = maxSize;</span><br><span class="line"> <span class="comment">//完成数组的初始化</span></span><br><span class="line"> stack = <span class="keyword">new</span> <span class="title class_">int</span>[maxSize];</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">public</span> <span class="type">boolean</span> <span class="title function_">isFull</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> top == maxSize - <span class="number">1</span>;</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">public</span> <span class="type">boolean</span> <span class="title function_">isEmpty</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> top == -<span class="number">1</span>;</span><br><span class="line"> }</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">public</span> <span class="keyword">void</span> <span class="title function_">push</span><span class="params">(<span class="type">int</span> value)</span> {</span><br><span class="line"> <span class="comment">//先判断栈是否为满</span></span><br><span class="line"> <span class="keyword">if</span> (isFull()) {</span><br><span class="line"> System.out.println(<span class="string">"栈满,无法添加数据!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> top++;</span><br><span class="line"> stack[top] = value;</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="keyword">public</span> <span class="type">int</span> <span class="title function_">pop</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//先判断栈是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (isEmpty()) {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"栈空,无法取出数据!"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//取出数据</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">value</span> <span class="operator">=</span> stack[top];</span><br><span class="line"> top--;</span><br><span class="line"> <span class="keyword">return</span> value;</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">public</span> <span class="keyword">void</span> <span class="title function_">list</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//先判断栈是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (isEmpty()) {</span><br><span class="line"> System.out.println(<span class="string">"栈空,无法取出数据!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> top; i >= <span class="number">0</span>; i--) {</span><br><span class="line"> System.out.printf(<span class="string">"stack[%d] = %d \n"</span>, i, stack[i]);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="5-栈实现综合计算器"><a href="#5-栈实现综合计算器" class="headerlink" title="5.栈实现综合计算器"></a>5.栈实现综合计算器</h3><p>中缀表达式</p>
|
||
<p><img src="/pictures/image-20230510105251076.png" alt="image-20230510105251076"></p>
|
||
<p><img src="/pictures/image-20230510110403055.png" alt="image-20230510110403055"></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.stack;</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/10</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">class</span> <span class="title class_">Calculator</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 1. 通过一个 index 值(索引),来遍历我们的表达式</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"> * 3.1 如果发现当前的符号栈为 空,就直接入栈</span></span><br><span class="line"><span class="comment"> * 3.2 如果符号栈有操作符,就进行比较,如果当前的操作符的优先级小于或者等于栈中的操作符, 就需要从数栈中pop出两个数,在从符号栈中pop出一个符号,进行运算,将得到结果,入数栈,然后将当前的操作符入符号栈, 如果当前的操作符的优先级大于栈中的操作符, 就直接入符号栈.</span></span><br><span class="line"><span class="comment"> * 4. 当表达式扫描完毕,就顺序的从 数栈和符号栈中pop出相应的数和符号,并运行.</span></span><br><span class="line"><span class="comment"> * 5. 最后在数栈只有一个数字,就是表达式的结果</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">expression</span> <span class="operator">=</span> <span class="string">"30+2*6-2"</span>;</span><br><span class="line"> <span class="comment">//创建两个栈 一个是数栈 一个是符号栈</span></span><br><span class="line"> <span class="type">ArrayStack2</span> <span class="variable">numStack</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ArrayStack2</span>(<span class="number">10</span>);</span><br><span class="line"> <span class="type">ArrayStack2</span> <span class="variable">operStack</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ArrayStack2</span>(<span class="number">10</span>);</span><br><span class="line"> <span class="comment">//定义需要的相关变量</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">index</span> <span class="operator">=</span> <span class="number">0</span>;<span class="comment">//用于扫描</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">num1</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="type">int</span> <span class="variable">num2</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="type">int</span> <span class="variable">oper</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="type">int</span> <span class="variable">result</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="type">char</span> <span class="variable">ch</span> <span class="operator">=</span> <span class="string">' '</span>; <span class="comment">//将每次扫描得到的char保存在ch中</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">keepNum</span> <span class="operator">=</span> <span class="string">""</span>;<span class="comment">//用于拼接多位数的</span></span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> <span class="comment">//得到expression的每一个字符</span></span><br><span class="line"> ch = expression.substring(index, index + <span class="number">1</span>).charAt(<span class="number">0</span>);</span><br><span class="line"> <span class="comment">//判断ch是什么 做相应的处理</span></span><br><span class="line"> <span class="keyword">if</span> (operStack.isOper(ch)) {</span><br><span class="line"> <span class="comment">//先符号栈判断是不是为空</span></span><br><span class="line"> <span class="keyword">if</span> (!operStack.isEmpty()) { <span class="comment">//判断符号栈是否为空</span></span><br><span class="line"> <span class="comment">//不为空的情况</span></span><br><span class="line"> <span class="keyword">if</span> (operStack.priority(ch) <= operStack.priority(operStack.peek())) {</span><br><span class="line"> <span class="comment">//如果当前的操作符的优先级小于或者等于栈中的操作符, 就需要从数栈中pop出两个数,</span></span><br><span class="line"> <span class="comment">// 在从符号栈中pop出一个符号,进行运算,将得到结果,入数栈</span></span><br><span class="line"> num1 = numStack.pop();</span><br><span class="line"> num2 = numStack.pop();</span><br><span class="line"> oper = operStack.pop();</span><br><span class="line"> result = numStack.cal(num1, num2, oper);</span><br><span class="line"> <span class="comment">//将运算的结果入数栈</span></span><br><span class="line"> numStack.push(result);</span><br><span class="line"> <span class="comment">//将当前的操作符入符号栈</span></span><br><span class="line"> operStack.push(ch);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">//如果当前的操作符的优先级大于栈中的操作符, 就直接入符号栈.</span></span><br><span class="line"> operStack.push(ch);</span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">//如果为空 直接入栈</span></span><br><span class="line"> operStack.push(ch);</span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">//如果是数字 就直接入数栈</span></span><br><span class="line"> <span class="comment">//要考虑是多位数的情况</span></span><br><span class="line"> keepNum += ch;</span><br><span class="line"> <span class="comment">//如果ch是表达式的最后一位 就直接入栈</span></span><br><span class="line"> <span class="keyword">if</span> (index == expression.length() - <span class="number">1</span>) {</span><br><span class="line"> numStack.push(Integer.parseInt(keepNum));</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">//判断下一个字符是不是数字 如果是数字 就继续扫描 如果是运算符 则入栈</span></span><br><span class="line"> <span class="keyword">if</span> (operStack.isOper(expression.substring(index + <span class="number">1</span>, index + <span class="number">2</span>).charAt(<span class="number">0</span>))) {<span class="comment">//下一位是操作符</span></span><br><span class="line"> <span class="comment">//直接将当前为添加到数栈</span></span><br><span class="line"> numStack.push(Integer.parseInt(keepNum));</span><br><span class="line"> <span class="comment">//清空keepNum</span></span><br><span class="line"> keepNum = <span class="string">""</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//让index + 1 ,并判断是否扫描到表达式的最后</span></span><br><span class="line"> index++;</span><br><span class="line"> <span class="keyword">if</span> (index >= expression.length()) {</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//当表达式扫描完毕,就顺序的从 数栈和符号栈中pop出相应的数和符号,并运行.</span></span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) {</span><br><span class="line"> <span class="comment">//如果符号栈为空 则计算结束 数栈中只有 一个数字</span></span><br><span class="line"> <span class="keyword">if</span> (operStack.isEmpty()) {</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> num1 = numStack.pop();</span><br><span class="line"> num2 = numStack.pop();</span><br><span class="line"> oper = operStack.pop();</span><br><span class="line"> result = numStack.cal(num1, num2, oper);</span><br><span class="line"> numStack.push(result);</span><br><span class="line"> }</span><br><span class="line"> System.out.printf(<span class="string">"表达式:%s = %d"</span>, expression, numStack.pop());</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment">//定义一个ArrayStack表示栈</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">ArrayStack2</span> {</span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span> maxSize;<span class="comment">//栈的大小</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span>[] stack;<span class="comment">//数组 数组模拟栈 数据放在数组中</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">int</span> <span class="variable">top</span> <span class="operator">=</span> -<span class="number">1</span>; <span class="comment">//top表示栈顶 初始化为1</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">//构造器</span></span><br><span class="line"> <span class="keyword">public</span> <span class="title function_">ArrayStack2</span><span class="params">(<span class="type">int</span> maxSize)</span> {</span><br><span class="line"> <span class="built_in">this</span>.maxSize = maxSize;</span><br><span class="line"> <span class="comment">//完成数组的初始化</span></span><br><span class="line"> stack = <span class="keyword">new</span> <span class="title class_">int</span>[maxSize];</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">public</span> <span class="type">boolean</span> <span class="title function_">isFull</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> top == maxSize - <span class="number">1</span>;</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">public</span> <span class="type">boolean</span> <span class="title function_">isEmpty</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> top == -<span class="number">1</span>;</span><br><span class="line"> }</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">public</span> <span class="keyword">void</span> <span class="title function_">push</span><span class="params">(<span class="type">int</span> value)</span> {</span><br><span class="line"> <span class="comment">//先判断栈是否为满</span></span><br><span class="line"> <span class="keyword">if</span> (isFull()) {</span><br><span class="line"> System.out.println(<span class="string">"栈满,无法添加数据!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> top++;</span><br><span class="line"> stack[top] = value;</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="keyword">public</span> <span class="type">int</span> <span class="title function_">pop</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//先判断栈是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (isEmpty()) {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"栈空,无法取出数据!"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//取出数据</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">value</span> <span class="operator">=</span> stack[top];</span><br><span class="line"> top--;</span><br><span class="line"> <span class="keyword">return</span> value;</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">public</span> <span class="keyword">void</span> <span class="title function_">list</span><span class="params">()</span> {</span><br><span class="line"> <span class="comment">//先判断栈是否为空</span></span><br><span class="line"> <span class="keyword">if</span> (isEmpty()) {</span><br><span class="line"> System.out.println(<span class="string">"栈空,无法取出数据!"</span>);</span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> top; i >= <span class="number">0</span>; i--) {</span><br><span class="line"> System.out.printf(<span class="string">"stack[%d] = %d \n"</span>, i, stack[i]);</span><br><span class="line"> }</span><br><span class="line"> }</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="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="type">int</span> <span class="title function_">priority</span><span class="params">(<span class="type">int</span> oper)</span> {</span><br><span class="line"> <span class="keyword">if</span> (oper == <span class="string">'*'</span> || oper == <span class="string">'/'</span>) {</span><br><span class="line"> <span class="keyword">return</span> <span class="number">1</span>;</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (oper == <span class="string">'+'</span> || oper == <span class="string">'-'</span>) {</span><br><span class="line"> <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="keyword">return</span> -<span class="number">1</span>;</span><br><span class="line"> }</span><br><span class="line"> }</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">public</span> <span class="type">boolean</span> <span class="title function_">isOper</span><span class="params">(<span class="type">char</span> val)</span> {</span><br><span class="line"> <span class="keyword">return</span> val == <span class="string">'+'</span> || val == <span class="string">'-'</span> || val == <span class="string">'*'</span> || val == <span class="string">'/'</span>;</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">public</span> <span class="type">int</span> <span class="title function_">cal</span><span class="params">(<span class="type">int</span> num1, <span class="type">int</span> num2, <span class="type">int</span> oper)</span> {</span><br><span class="line"> <span class="type">int</span> <span class="variable">result</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">switch</span> (oper) {</span><br><span class="line"> <span class="keyword">case</span> <span class="string">'+'</span>:</span><br><span class="line"> result = num1 + num2;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="string">'-'</span>:</span><br><span class="line"> result = num2 - num1; <span class="comment">//注意顺序</span></span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="string">'*'</span>:</span><br><span class="line"> result = num1 * num2;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="string">'/'</span>:</span><br><span class="line"> result = num2 / num1;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> result;</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"> * 返回栈顶的值 不是pop出来</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="type">int</span> <span class="title function_">peek</span><span class="params">()</span> {</span><br><span class="line"> <span class="keyword">return</span> stack[top];</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="6-逆波兰计算器的设计与实现"><a href="#6-逆波兰计算器的设计与实现" class="headerlink" title="6.逆波兰计算器的设计与实现"></a>6.逆波兰计算器的设计与实现</h3><p><strong>逆波兰表达式(后缀表达式)</strong></p>
|
||
<p>1)<strong>输入一个逆波兰表达式(后缀表达式),使用栈(Stack),计算其结果</strong></p>
|
||
<p>2)<strong>支持小括号和多位数整数,因为这里我们主要讲的是数据结构,因此计算器进行简化,只支持对整数的计算。</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.stack;</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 class="keyword">import</span> java.util.Stack;</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/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 class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">PolandNotation</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="comment">//先定义一个逆波兰表达式</span></span><br><span class="line"> <span class="comment">//(3+4)×5-6 的逆波兰表达式是 3 4 + 5 × 6 -</span></span><br><span class="line"> <span class="comment">//为了方便 逆波兰表达式的数字和符号有空格隔开</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">suffixExpression</span> <span class="operator">=</span> <span class="string">"3 4 + 5 * 6 -"</span>;<span class="comment">//中间有空格隔开</span></span><br><span class="line"> <span class="comment">//1.先将suffixExpression放入到List集合中</span></span><br><span class="line"> <span class="comment">//2.将List集合传递给一个方法 配合栈 完成计算</span></span><br><span class="line"> List<String> rpnList = getListString(suffixExpression);</span><br><span class="line"> System.out.println(<span class="string">"计算的结果是:"</span>+calculate(rpnList));</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//将一个逆波兰表达式依次将数据和运算符放入到List集合中</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> List<String> <span class="title function_">getListString</span><span class="params">(String suffixExpression)</span> {</span><br><span class="line"> <span class="comment">//将suffixExpression按照空格分割</span></span><br><span class="line"> String[] strings = suffixExpression.split(<span class="string">" "</span>);</span><br><span class="line"> List<String> list = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> <span class="keyword">for</span> (String string : strings) {</span><br><span class="line"> list.add(string);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> list;</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"> * 从左至右扫描,将3和4压入堆栈;</span></span><br><span class="line"><span class="comment"> * 遇到+运算符,因此弹出4和3(4为栈顶元素,3为次顶元素),计算出3+4的值,得7,再将7入栈;</span></span><br><span class="line"><span class="comment"> * 将5入栈;</span></span><br><span class="line"><span class="comment"> * 接下来是×运算符,因此弹出5和7,计算出7×5=35,将35入栈;</span></span><br><span class="line"><span class="comment"> * 将6入栈;</span></span><br><span class="line"><span class="comment"> * 最后是-运算符,计算出35-6的值,即29,由此得出最终结果</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="type">int</span> <span class="title function_">calculate</span><span class="params">(List<String> list)</span> {</span><br><span class="line"> <span class="comment">//创建一个栈</span></span><br><span class="line"> Stack<String> stack = <span class="keyword">new</span> <span class="title class_">Stack</span><>();</span><br><span class="line"> <span class="comment">//遍历list</span></span><br><span class="line"> <span class="keyword">for</span> (String item : list) {</span><br><span class="line"> <span class="comment">//使用正则表达式取出数字</span></span><br><span class="line"> <span class="keyword">if</span> (item.matches(<span class="string">"\\d+"</span>)) { <span class="comment">//匹配的是多位数</span></span><br><span class="line"> <span class="comment">//入栈</span></span><br><span class="line"> stack.push(item);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">//弹出两个数 并运算 再入栈</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">num2</span> <span class="operator">=</span> Integer.parseInt(stack.pop());</span><br><span class="line"> <span class="type">int</span> <span class="variable">num1</span> <span class="operator">=</span> Integer.parseInt(stack.pop());</span><br><span class="line"> <span class="comment">//运算</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">res</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">if</span> (item.equals(<span class="string">"+"</span>)) {</span><br><span class="line"> res = num1 + num2;</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (item.equals(<span class="string">"-"</span>)) {</span><br><span class="line"> res = num1 - num2;</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (item.equals(<span class="string">"*"</span>)) {</span><br><span class="line"> res = num1 * num2;</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (item.equals(<span class="string">"/"</span>)) {</span><br><span class="line"> res = num1 / num2;</span><br><span class="line"> }<span class="keyword">else</span> {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"运算符有误!"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//把结果入栈</span></span><br><span class="line"> stack.push(res + <span class="string">""</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//最后留在stack中的数就是运算结果</span></span><br><span class="line"> <span class="keyword">return</span> Integer.parseInt(stack.pop());</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>将中缀表达式转化为后缀表达式(逆波兰表达式)</strong></p>
|
||
<p>解题的步骤:</p>
|
||
<p>1)初始化两个栈:运算符栈s1和储存中间结果的栈s2;</p>
|
||
<p>2)从左至右扫描中缀表达式;</p>
|
||
<p>3)遇到操作数时,将其压s2;</p>
|
||
<p>4)遇到运算符时,比较其与s1栈顶运算符的优先级:</p>
|
||
<p> (1)如果s1为空,或栈顶运算符为左括号“(”,则直接将此运算符入栈;</p>
|
||
<p> (2)否则,若优先级比栈顶运算符的高,也将运算符压入s1;</p>
|
||
<p> (3)否则,将s1栈顶的运算符弹出并压入到s2中,再次转到(4-1)与s1中新的栈顶运算符相比较</p>
|
||
<p>5)遇到括号时:<br> (1) 如果是左括号“(”,则直接压入s1<br> (2) 如果是右括号“)”,则依次弹出s1栈顶的运算符,并压入s2,直到遇到左括号为止,此时将这一对括号丢弃</p>
|
||
<p>6)重复步骤2至5,直到表达式的最右边</p>
|
||
<p>7)将s1中剩余的运算符依次弹出并压入s2</p>
|
||
<p>8)依次弹出s2中的元素并输出,<strong>结果的逆序即为中缀表达式对应的后缀表达式</strong></p>
|
||
<p><img src="/pictures/image-20230511094011546.png" alt="image-20230511094011546"></p>
|
||
<p>先将中缀表达式转化成list集合</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 将中缀表达式转化成对应的list</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> expression 中缀表达式</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 中缀表达式转化成的一个list集合</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> List<String> <span class="title function_">toInfixExpressionList</span><span class="params">(String expression)</span> {</span><br><span class="line"> <span class="comment">//定义一个集合,存储中缀表达式对应的list集合</span></span><br><span class="line"> List<String> list = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> <span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>;<span class="comment">//这个是一个指针 用于遍历中缀表达式的字符串</span></span><br><span class="line"> String str;<span class="comment">//做多位数的拼接工作 ,因为我们要考虑多位数的情况</span></span><br><span class="line"> <span class="type">char</span> c;<span class="comment">//每遍历一个字符就放入到c中</span></span><br><span class="line"> <span class="keyword">do</span> {</span><br><span class="line"> <span class="keyword">if</span> ((c = expression.charAt(i)) < <span class="number">48</span> || (c = expression.charAt(i)) > <span class="number">57</span>) { <span class="comment">//如果c是一个非数字的字符需要加入到ls中</span></span><br><span class="line"> list.add(c + <span class="string">""</span>); <span class="comment">//直接将这个字符添加到list集合中</span></span><br><span class="line"> i++;</span><br><span class="line"> } <span class="keyword">else</span> {<span class="comment">//如果是一个数 要考虑多位数的问题</span></span><br><span class="line"> str = <span class="string">""</span>;<span class="comment">//先将str置空</span></span><br><span class="line"> <span class="keyword">while</span> (i < expression.length() && (c = expression.charAt(i)) >= <span class="number">48</span> && (c = expression.charAt(i)) <= <span class="number">57</span>) {</span><br><span class="line"> str += c;</span><br><span class="line"> i++;</span><br><span class="line"> }</span><br><span class="line"> list.add(str);</span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">while</span> (i < expression.length());</span><br><span class="line"> <span class="keyword">return</span> list;</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>将中缀表达式的集合转化成逆波兰表达式(后缀表达式)的集合</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 将中缀表达式对应的List转化成后缀表达式对应的list</span></span><br><span class="line"><span class="comment"> * tips:</span></span><br><span class="line"><span class="comment"> * 1)初始化两个栈:运算符栈s1和储存中间结果的栈s2;</span></span><br><span class="line"><span class="comment"> * 2)从左至右扫描中缀表达式;</span></span><br><span class="line"><span class="comment"> * 3)遇到操作数时,将其压s2;</span></span><br><span class="line"><span class="comment"> * 4)遇到运算符时,比较其与s1栈顶运算符的优先级:</span></span><br><span class="line"><span class="comment"> * (1)如果s1为空,或栈顶运算符为左括号“(”,则直接将此运算符入栈;</span></span><br><span class="line"><span class="comment"> * (2)否则,若优先级比栈顶运算符的高,也将运算符压入s1;</span></span><br><span class="line"><span class="comment"> * (3)否则,将s1栈顶的运算符弹出并压入到s2中,再次转到(4-1)与s1中新的栈顶运算符相比较</span></span><br><span class="line"><span class="comment"> * 5)遇到括号时:</span></span><br><span class="line"><span class="comment"> * (1) 如果是左括号“(”,则直接压入s1</span></span><br><span class="line"><span class="comment"> * (2) 如果是右括号“)”,则依次弹出s1栈顶的运算符,并压入s2,直到遇到左括号为止,此时将这一对括号丢弃</span></span><br><span class="line"><span class="comment"> * 6)重复步骤2至5,直到表达式的最右边</span></span><br><span class="line"><span class="comment"> * 7)将s1中剩余的运算符依次弹出并压入s2</span></span><br><span class="line"><span class="comment"> * 8)依次弹出s2中的元素并输出,**结果的逆序即为中缀表达式对应的后缀表达式**</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> ls 中缀表达式对应的list</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 后缀表达式对应的list</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> List<String> <span class="title function_">parseSuffixExpressionList</span><span class="params">(List<String> ls)</span> {</span><br><span class="line"> <span class="comment">//定义栈</span></span><br><span class="line"> Stack<String> s1 = <span class="keyword">new</span> <span class="title class_">Stack</span><>();<span class="comment">//符号栈 s1栈</span></span><br><span class="line"> <span class="comment">//说明:因为思路分析中使用的s2的栈在整个的运算的过程中没有进行pop的操作 我们直接使用list集合代替s2栈 (同时也为了方便后面逆序的输出)</span></span><br><span class="line"> ArrayList<String> s2 = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();<span class="comment">//用于存储中间结果的list</span></span><br><span class="line"> <span class="comment">//遍历ls</span></span><br><span class="line"> <span class="keyword">for</span> (String item : ls) {</span><br><span class="line"> <span class="comment">//如果是一个数 就加入到s2栈</span></span><br><span class="line"> <span class="keyword">if</span> (item.matches(<span class="string">"\\d+"</span>)) {<span class="comment">//正则匹配</span></span><br><span class="line"> s2.add(item);</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (item.equals(<span class="string">"("</span>)) { <span class="comment">//如果是s1的话就直接入符号栈</span></span><br><span class="line"> s1.push(item);</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (item.equals(<span class="string">")"</span>)) {</span><br><span class="line"> <span class="comment">//如果是右括号“)”,则依次弹出s1栈顶的运算符,并压入s2,直到遇到左括号为止,此时将这一对括号丢弃</span></span><br><span class="line"> <span class="keyword">while</span> (!s1.peek().equals(<span class="string">"("</span>)) {</span><br><span class="line"> s2.add(s1.pop());</span><br><span class="line"> }</span><br><span class="line"> s1.pop();<span class="comment">//将(弹出s1栈,这里的操作就是消除括号</span></span><br><span class="line"> } <span class="keyword">else</span> {<span class="comment">//加减乘除的操作</span></span><br><span class="line"> <span class="comment">//当item的优先级小于栈顶的优先级,</span></span><br><span class="line"> <span class="comment">// 将s1栈顶的运算符弹出并加入到s2中,再次转到(4.1)与s1中新的栈顶运算符相比较</span></span><br><span class="line"> <span class="keyword">while</span> (s1.size() != <span class="number">0</span> && getVal(s1.peek()) >= getVal(item)) {</span><br><span class="line"> s2.add(s1.pop());</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//还需要将item压入栈中</span></span><br><span class="line"> s1.push(item);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//将s1中剩余的运算符依次弹出并加入s2</span></span><br><span class="line"> <span class="keyword">while</span> (s1.size() != <span class="number">0</span>) {</span><br><span class="line"> s2.add(s1.pop());</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> s2;</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>通过逆波兰表达式(后缀表达式)的集合得到最终的计算结果</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 通过一个后缀表达式的list集合得到表达式最终的计算结果</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> list 后缀表达式的list集合</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">public</span> <span class="keyword">static</span> <span class="type">int</span> <span class="title function_">calculate</span><span class="params">(List<String> list)</span> {</span><br><span class="line"> <span class="comment">//创建一个栈</span></span><br><span class="line"> Stack<String> stack = <span class="keyword">new</span> <span class="title class_">Stack</span><>();</span><br><span class="line"> <span class="comment">//遍历list</span></span><br><span class="line"> <span class="keyword">for</span> (String item : list) {</span><br><span class="line"> <span class="comment">//使用正则表达式取出数字</span></span><br><span class="line"> <span class="keyword">if</span> (item.matches(<span class="string">"\\d+"</span>)) { <span class="comment">//匹配的是多位数</span></span><br><span class="line"> <span class="comment">//入栈</span></span><br><span class="line"> stack.push(item);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">//弹出两个数 并运算 再入栈</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">num2</span> <span class="operator">=</span> Integer.parseInt(stack.pop());</span><br><span class="line"> <span class="type">int</span> <span class="variable">num1</span> <span class="operator">=</span> Integer.parseInt(stack.pop());</span><br><span class="line"> <span class="comment">//运算</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">res</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">if</span> (item.equals(<span class="string">"+"</span>)) {</span><br><span class="line"> res = num1 + num2;</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (item.equals(<span class="string">"-"</span>)) {</span><br><span class="line"> res = num1 - num2;</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (item.equals(<span class="string">"*"</span>)) {</span><br><span class="line"> res = num1 * num2;</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (item.equals(<span class="string">"/"</span>)) {</span><br><span class="line"> res = num1 / num2;</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"运算符有误!"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//把结果入栈</span></span><br><span class="line"> stack.push(res + <span class="string">""</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//最后留在stack中的数就是运算结果</span></span><br><span class="line"> <span class="keyword">return</span> Integer.parseInt(stack.pop());</span><br><span class="line"> }</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>完整的代码</strong></p>
|
||
<p>(不支持小数)</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.stack;</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 class="keyword">import</span> java.util.Stack;</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/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 class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">PolandNotation</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="comment">//先定义一个逆波兰表达式</span></span><br><span class="line"> <span class="comment">//(3+4)×5-6 的逆波兰表达式是 3 4 + 5 × 6 -</span></span><br><span class="line"> <span class="comment">//为了方便 逆波兰表达式的数字和符号有空格隔开</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">suffixExpression</span> <span class="operator">=</span> <span class="string">"3 4 + 5 * 6 -"</span>;<span class="comment">//中间有空格隔开</span></span><br><span class="line"> <span class="comment">//1.先将suffixExpression放入到List集合中</span></span><br><span class="line"> <span class="comment">//2.将List集合传递给一个方法 配合栈 完成计算</span></span><br><span class="line"> List<String> rpnList = getListString(suffixExpression);</span><br><span class="line"> System.out.println(<span class="string">"计算的结果是:"</span> + calculate(rpnList));</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">//1. 1+((2+3)×4)-5(中缀表达式) -> 1 2 3 + 4 × + 5 –(后缀表达式)</span></span><br><span class="line"> <span class="comment">//2. 将中缀表达式转化成List集合</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">expression</span> <span class="operator">=</span> <span class="string">"1+((2+3)*4)-5"</span>;</span><br><span class="line"> List<String> list = toInfixExpressionList(expression);</span><br><span class="line"> System.out.println(<span class="string">"中缀表达式对应的List:"</span> + list);</span><br><span class="line"> <span class="comment">//3.将得到的中缀表达式对应的List 转换成一个逆波兰表达式(后缀表达式)对应的List</span></span><br><span class="line"> List<String> stringList = parseSuffixExpressionList(list);</span><br><span class="line"> System.out.println(<span class="string">"中缀表达式对应的List:"</span> + stringList);</span><br><span class="line"> System.out.println(<span class="string">"计算的结果:"</span> + calculate(stringList));</span><br><span class="line"></span><br><span class="line"></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">public</span> <span class="keyword">static</span> <span class="type">int</span> <span class="title function_">getVal</span><span class="params">(String operation)</span> {</span><br><span class="line"> <span class="type">int</span> <span class="variable">res</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">switch</span> (operation) {</span><br><span class="line"> <span class="keyword">case</span> <span class="string">"+"</span>:</span><br><span class="line"> <span class="keyword">case</span> <span class="string">"-"</span>:</span><br><span class="line"> res = <span class="number">1</span>;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="string">"/"</span>:</span><br><span class="line"> <span class="keyword">case</span> <span class="string">"*"</span>:</span><br><span class="line"> res = <span class="number">2</span>;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">default</span>:</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> res;</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"> * 将中缀表达式对应的List转化成后缀表达式对应的list</span></span><br><span class="line"><span class="comment"> * tips:</span></span><br><span class="line"><span class="comment"> * 1)初始化两个栈:运算符栈s1和储存中间结果的栈s2;</span></span><br><span class="line"><span class="comment"> * 2)从左至右扫描中缀表达式;</span></span><br><span class="line"><span class="comment"> * 3)遇到操作数时,将其压s2;</span></span><br><span class="line"><span class="comment"> * 4)遇到运算符时,比较其与s1栈顶运算符的优先级:</span></span><br><span class="line"><span class="comment"> * (1)如果s1为空,或栈顶运算符为左括号“(”,则直接将此运算符入栈;</span></span><br><span class="line"><span class="comment"> * (2)否则,若优先级比栈顶运算符的高,也将运算符压入s1;</span></span><br><span class="line"><span class="comment"> * (3)否则,将s1栈顶的运算符弹出并压入到s2中,再次转到(4-1)与s1中新的栈顶运算符相比较</span></span><br><span class="line"><span class="comment"> * 5)遇到括号时:</span></span><br><span class="line"><span class="comment"> * (1) 如果是左括号“(”,则直接压入s1</span></span><br><span class="line"><span class="comment"> * (2) 如果是右括号“)”,则依次弹出s1栈顶的运算符,并压入s2,直到遇到左括号为止,此时将这一对括号丢弃</span></span><br><span class="line"><span class="comment"> * 6)重复步骤2至5,直到表达式的最右边</span></span><br><span class="line"><span class="comment"> * 7)将s1中剩余的运算符依次弹出并压入s2</span></span><br><span class="line"><span class="comment"> * 8)依次弹出s2中的元素并输出,**结果的逆序即为中缀表达式对应的后缀表达式**</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> ls 中缀表达式对应的list</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 后缀表达式对应的list</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> List<String> <span class="title function_">parseSuffixExpressionList</span><span class="params">(List<String> ls)</span> {</span><br><span class="line"> <span class="comment">//定义栈</span></span><br><span class="line"> Stack<String> s1 = <span class="keyword">new</span> <span class="title class_">Stack</span><>();<span class="comment">//符号栈 s1栈</span></span><br><span class="line"> <span class="comment">//说明:因为思路分析中使用的s2的栈在整个的运算的过程中没有进行pop的操作 我们直接使用list集合代替s2栈 (同时也为了方便后面逆序的输出)</span></span><br><span class="line"> ArrayList<String> s2 = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();<span class="comment">//用于存储中间结果的list</span></span><br><span class="line"> <span class="comment">//遍历ls</span></span><br><span class="line"> <span class="keyword">for</span> (String item : ls) {</span><br><span class="line"> <span class="comment">//如果是一个数 就加入到s2栈</span></span><br><span class="line"> <span class="keyword">if</span> (item.matches(<span class="string">"\\d+"</span>)) {<span class="comment">//正则匹配</span></span><br><span class="line"> s2.add(item);</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (item.equals(<span class="string">"("</span>)) { <span class="comment">//如果是s1的话就直接入符号栈</span></span><br><span class="line"> s1.push(item);</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (item.equals(<span class="string">")"</span>)) {</span><br><span class="line"> <span class="comment">//如果是右括号“)”,则依次弹出s1栈顶的运算符,并压入s2,直到遇到左括号为止,此时将这一对括号丢弃</span></span><br><span class="line"> <span class="keyword">while</span> (!s1.peek().equals(<span class="string">"("</span>)) {</span><br><span class="line"> s2.add(s1.pop());</span><br><span class="line"> }</span><br><span class="line"> s1.pop();<span class="comment">//将(弹出s1栈,这里的操作就是消除括号</span></span><br><span class="line"> } <span class="keyword">else</span> {<span class="comment">//加减乘除的操作</span></span><br><span class="line"> <span class="comment">//当item的优先级小于栈顶的优先级,</span></span><br><span class="line"> <span class="comment">// 将s1栈顶的运算符弹出并加入到s2中,再次转到(4.1)与s1中新的栈顶运算符相比较</span></span><br><span class="line"> <span class="keyword">while</span> (s1.size() != <span class="number">0</span> && getVal(s1.peek()) >= getVal(item)) {</span><br><span class="line"> s2.add(s1.pop());</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//还需要将item压入栈中</span></span><br><span class="line"> s1.push(item);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//将s1中剩余的运算符依次弹出并加入s2</span></span><br><span class="line"> <span class="keyword">while</span> (s1.size() != <span class="number">0</span>) {</span><br><span class="line"> s2.add(s1.pop());</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> s2;</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"> * 将中缀表达式转化成对应的list</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> expression 中缀表达式</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 中缀表达式转化成的一个list集合</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> List<String> <span class="title function_">toInfixExpressionList</span><span class="params">(String expression)</span> {</span><br><span class="line"> <span class="comment">//定义一个集合,存储中缀表达式对应的list集合</span></span><br><span class="line"> List<String> list = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> <span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>;<span class="comment">//这个是一个指针 用于遍历中缀表达式的字符串</span></span><br><span class="line"> String str;<span class="comment">//做多位数的拼接工作 ,因为我们要考虑多位数的情况</span></span><br><span class="line"> <span class="type">char</span> c;<span class="comment">//每遍历一个字符就放入到c中</span></span><br><span class="line"> <span class="keyword">do</span> {</span><br><span class="line"> <span class="keyword">if</span> ((c = expression.charAt(i)) < <span class="number">48</span> || (c = expression.charAt(i)) > <span class="number">57</span>) { <span class="comment">//如果c是一个非数字的字符需要加入到ls中</span></span><br><span class="line"> list.add(c + <span class="string">""</span>); <span class="comment">//直接将这个字符添加到list集合中</span></span><br><span class="line"> i++;</span><br><span class="line"> } <span class="keyword">else</span> {<span class="comment">//如果是一个数 要考虑多位数的问题</span></span><br><span class="line"> str = <span class="string">""</span>;<span class="comment">//先将str置空</span></span><br><span class="line"> <span class="comment">//这个只要遍历的有一个字符不是数字 就会退出while循环</span></span><br><span class="line"> <span class="keyword">while</span> (i < expression.length() && (c = expression.charAt(i)) >= <span class="number">48</span> && (c = expression.charAt(i)) <= <span class="number">57</span>) {</span><br><span class="line"> str += c;</span><br><span class="line"> i++;</span><br><span class="line"> }</span><br><span class="line"> list.add(str);</span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">while</span> (i < expression.length());</span><br><span class="line"> <span class="keyword">return</span> list;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="comment">//将一个逆波兰表达式依次将数据和运算符放入到List集合中</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> List<String> <span class="title function_">getListString</span><span class="params">(String suffixExpression)</span> {</span><br><span class="line"> <span class="comment">//将suffixExpression按照空格分割</span></span><br><span class="line"> String[] strings = suffixExpression.split(<span class="string">" "</span>);</span><br><span class="line"> List<String> list = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> <span class="keyword">for</span> (String string : strings) {</span><br><span class="line"> list.add(string);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> list;</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"> * 通过一个后缀表达式的list集合得到表达式最终的计算结果</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> list 后缀表达式的list集合</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">public</span> <span class="keyword">static</span> <span class="type">int</span> <span class="title function_">calculate</span><span class="params">(List<String> list)</span> {</span><br><span class="line"> <span class="comment">//创建一个栈</span></span><br><span class="line"> Stack<String> stack = <span class="keyword">new</span> <span class="title class_">Stack</span><>();</span><br><span class="line"> <span class="comment">//遍历list</span></span><br><span class="line"> <span class="keyword">for</span> (String item : list) {</span><br><span class="line"> <span class="comment">//使用正则表达式取出数字</span></span><br><span class="line"> <span class="keyword">if</span> (item.matches(<span class="string">"\\d+"</span>)) { <span class="comment">//匹配的是多位数</span></span><br><span class="line"> <span class="comment">//入栈</span></span><br><span class="line"> stack.push(item);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="comment">//弹出两个数 并运算 再入栈</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">num2</span> <span class="operator">=</span> Integer.parseInt(stack.pop());</span><br><span class="line"> <span class="type">int</span> <span class="variable">num1</span> <span class="operator">=</span> Integer.parseInt(stack.pop());</span><br><span class="line"> <span class="comment">//运算</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">res</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">if</span> (item.equals(<span class="string">"+"</span>)) {</span><br><span class="line"> res = num1 + num2;</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (item.equals(<span class="string">"-"</span>)) {</span><br><span class="line"> res = num1 - num2;</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (item.equals(<span class="string">"*"</span>)) {</span><br><span class="line"> res = num1 * num2;</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (item.equals(<span class="string">"/"</span>)) {</span><br><span class="line"> res = num1 / num2;</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"运算符有误!"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//把结果入栈</span></span><br><span class="line"> stack.push(res + <span class="string">""</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//最后留在stack中的数就是运算结果</span></span><br><span class="line"> <span class="keyword">return</span> Integer.parseInt(stack.pop());</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>完整的逆波兰计算器,含小数点的计算</strong></p>
|
||
<p>(老师的代码)</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.stack;</span><br><span class="line"></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.Collections;</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.Stack;</span><br><span class="line"><span class="keyword">import</span> java.util.regex.Pattern;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ReversePolishMultiCalc</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">static</span> <span class="keyword">final</span> <span class="type">String</span> <span class="variable">SYMBOL</span> <span class="operator">=</span> <span class="string">"\\+|-|\\*|/|\\(|\\)"</span>;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">String</span> <span class="variable">LEFT</span> <span class="operator">=</span> <span class="string">"("</span>;</span><br><span class="line"> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">String</span> <span class="variable">RIGHT</span> <span class="operator">=</span> <span class="string">")"</span>;</span><br><span class="line"> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">String</span> <span class="variable">ADD</span> <span class="operator">=</span> <span class="string">"+"</span>;</span><br><span class="line"> <span class="keyword">static</span> <span class="keyword">final</span> String MINUS= <span class="string">"-"</span>;</span><br><span class="line"> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">String</span> <span class="variable">TIMES</span> <span class="operator">=</span> <span class="string">"*"</span>;</span><br><span class="line"> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">String</span> <span class="variable">DIVISION</span> <span class="operator">=</span> <span class="string">"/"</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">static</span> <span class="keyword">final</span> <span class="type">int</span> <span class="variable">LEVEL_01</span> <span class="operator">=</span> <span class="number">1</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="keyword">static</span> <span class="keyword">final</span> <span class="type">int</span> <span class="variable">LEVEL_02</span> <span class="operator">=</span> <span class="number">2</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">static</span> <span class="keyword">final</span> <span class="type">int</span> <span class="variable">LEVEL_HIGH</span> <span class="operator">=</span> Integer.MAX_VALUE;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="keyword">static</span> Stack<String> stack = <span class="keyword">new</span> <span class="title class_">Stack</span><>();</span><br><span class="line"> <span class="keyword">static</span> List<String> data = Collections.synchronizedList(<span class="keyword">new</span> <span class="title class_">ArrayList</span><String>());</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> s</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">public</span> <span class="keyword">static</span> String <span class="title function_">replaceAllBlank</span><span class="params">(String s )</span>{</span><br><span class="line"> <span class="comment">// \\s+ 匹配任何空白字符,包括空格、制表符、换页符等等, 等价于[ \f\n\r\t\v]</span></span><br><span class="line"> <span class="keyword">return</span> s.replaceAll(<span class="string">"\\s+"</span>,<span class="string">""</span>);</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"> * 判断是不是数字 int double long float</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> s</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">public</span> <span class="keyword">static</span> <span class="type">boolean</span> <span class="title function_">isNumber</span><span class="params">(String s)</span>{</span><br><span class="line"> <span class="type">Pattern</span> <span class="variable">pattern</span> <span class="operator">=</span> Pattern.compile(<span class="string">"^[-\\+]?[.\\d]*$"</span>);</span><br><span class="line"> <span class="keyword">return</span> pattern.matcher(s).matches();</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 class="doctag">@param</span> s</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">public</span> <span class="keyword">static</span> <span class="type">boolean</span> <span class="title function_">isSymbol</span><span class="params">(String s)</span>{</span><br><span class="line"> <span class="keyword">return</span> s.matches(SYMBOL);</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 class="doctag">@param</span> s</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">public</span> <span class="keyword">static</span> <span class="type">int</span> <span class="title function_">calcLevel</span><span class="params">(String s)</span>{</span><br><span class="line"> <span class="keyword">if</span>(<span class="string">"+"</span>.equals(s) || <span class="string">"-"</span>.equals(s)){</span><br><span class="line"> <span class="keyword">return</span> LEVEL_01;</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span>(<span class="string">"*"</span>.equals(s) || <span class="string">"/"</span>.equals(s)){</span><br><span class="line"> <span class="keyword">return</span> LEVEL_02;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> LEVEL_HIGH;</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 class="doctag">@param</span> s</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@throws</span> Exception</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> List<String> <span class="title function_">doMatch</span> <span class="params">(String s)</span> <span class="keyword">throws</span> Exception{</span><br><span class="line"> <span class="keyword">if</span>(s == <span class="literal">null</span> || <span class="string">""</span>.equals(s.trim())) <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"data is empty"</span>);</span><br><span class="line"> <span class="keyword">if</span>(!isNumber(s.charAt(<span class="number">0</span>)+<span class="string">""</span>)) <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"data illeagle,start not with a number"</span>);</span><br><span class="line"></span><br><span class="line"> s = replaceAllBlank(s);</span><br><span class="line"></span><br><span class="line"> String each;</span><br><span class="line"> <span class="type">int</span> <span class="variable">start</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < s.length(); i++) {</span><br><span class="line"> <span class="keyword">if</span>(isSymbol(s.charAt(i)+<span class="string">""</span>)){</span><br><span class="line"> each = s.charAt(i)+<span class="string">""</span>;</span><br><span class="line"> <span class="comment">//栈为空,(操作符,或者 操作符优先级大于栈顶优先级 && 操作符优先级不是( )的优先级 及是 ) 不能直接入栈</span></span><br><span class="line"> <span class="keyword">if</span>(stack.isEmpty() || LEFT.equals(each)</span><br><span class="line"> || ((calcLevel(each) > calcLevel(stack.peek())) && calcLevel(each) < LEVEL_HIGH)){</span><br><span class="line"> stack.push(each);</span><br><span class="line"> }<span class="keyword">else</span> <span class="keyword">if</span>( !stack.isEmpty() && calcLevel(each) <= calcLevel(stack.peek())){</span><br><span class="line"> <span class="comment">//栈非空,操作符优先级小于等于栈顶优先级时出栈入列,直到栈为空,或者遇到了(,最后操作符入栈</span></span><br><span class="line"> <span class="keyword">while</span> (!stack.isEmpty() && calcLevel(each) <= calcLevel(stack.peek()) ){</span><br><span class="line"> <span class="keyword">if</span>(calcLevel(stack.peek()) == LEVEL_HIGH){</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> data.add(stack.pop());</span><br><span class="line"> }</span><br><span class="line"> stack.push(each);</span><br><span class="line"> }<span class="keyword">else</span> <span class="keyword">if</span>(RIGHT.equals(each)){</span><br><span class="line"> <span class="comment">// ) 操作符,依次出栈入列直到空栈或者遇到了第一个)操作符,此时)出栈</span></span><br><span class="line"> <span class="keyword">while</span> (!stack.isEmpty() && LEVEL_HIGH >= calcLevel(stack.peek())){</span><br><span class="line"> <span class="keyword">if</span>(LEVEL_HIGH == calcLevel(stack.peek())){</span><br><span class="line"> stack.pop();</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> data.add(stack.pop());</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> start = i ; <span class="comment">//前一个运算符的位置</span></span><br><span class="line"> }<span class="keyword">else</span> <span class="keyword">if</span>( i == s.length()-<span class="number">1</span> || isSymbol(s.charAt(i+<span class="number">1</span>)+<span class="string">""</span>) ){</span><br><span class="line"> each = start == <span class="number">0</span> ? s.substring(start,i+<span class="number">1</span>) : s.substring(start+<span class="number">1</span>,i+<span class="number">1</span>);</span><br><span class="line"> <span class="keyword">if</span>(isNumber(each)) {</span><br><span class="line"> data.add(each);</span><br><span class="line"> <span class="keyword">continue</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(<span class="string">"data not match number"</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//如果栈里还有元素,此时元素需要依次出栈入列,可以想象栈里剩下栈顶为/,栈底为+,应该依次出栈入列,可以直接翻转整个stack 添加到队列</span></span><br><span class="line"> Collections.reverse(stack);</span><br><span class="line"> data.addAll(<span class="keyword">new</span> <span class="title class_">ArrayList</span><>(stack));</span><br><span class="line"></span><br><span class="line"> System.out.println(data);</span><br><span class="line"> <span class="keyword">return</span> data;</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 class="doctag">@param</span> list</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">public</span> <span class="keyword">static</span> Double <span class="title function_">doCalc</span><span class="params">(List<String> list)</span>{</span><br><span class="line"> <span class="type">Double</span> <span class="variable">d</span> <span class="operator">=</span> <span class="number">0d</span>;</span><br><span class="line"> <span class="keyword">if</span>(list == <span class="literal">null</span> || list.isEmpty()){</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (list.size() == <span class="number">1</span>){</span><br><span class="line"> System.out.println(list);</span><br><span class="line"> d = Double.valueOf(list.get(<span class="number">0</span>));</span><br><span class="line"> <span class="keyword">return</span> d;</span><br><span class="line"> }</span><br><span class="line"> ArrayList<String> list1 = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < list.size(); i++) {</span><br><span class="line"> list1.add(list.get(i));</span><br><span class="line"> <span class="keyword">if</span>(isSymbol(list.get(i))){</span><br><span class="line"> <span class="type">Double</span> <span class="variable">d1</span> <span class="operator">=</span> doTheMath(list.get(i - <span class="number">2</span>), list.get(i - <span class="number">1</span>), list.get(i));</span><br><span class="line"> list1.remove(i);</span><br><span class="line"> list1.remove(i-<span class="number">1</span>);</span><br><span class="line"> list1.set(i-<span class="number">2</span>,d1+<span class="string">""</span>);</span><br><span class="line"> list1.addAll(list.subList(i+<span class="number">1</span>,list.size()));</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> doCalc(list1);</span><br><span class="line"> <span class="keyword">return</span> d;</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 class="doctag">@param</span> s1</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> s2</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> symbol</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">public</span> <span class="keyword">static</span> Double <span class="title function_">doTheMath</span><span class="params">(String s1,String s2,String symbol)</span>{</span><br><span class="line"> Double result ;</span><br><span class="line"> <span class="keyword">switch</span> (symbol){</span><br><span class="line"> <span class="keyword">case</span> ADD : result = Double.valueOf(s1) + Double.valueOf(s2); <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> MINUS : result = Double.valueOf(s1) - Double.valueOf(s2); <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> TIMES : result = Double.valueOf(s1) * Double.valueOf(s2); <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> DIVISION : result = Double.valueOf(s1) / Double.valueOf(s2); <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">default</span> : result = <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> result;</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="comment">//String math = "9+(3-1)*3+10/2";</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">math</span> <span class="operator">=</span> <span class="string">"12.8 + (2 - 3.55)*4+10/5.0"</span>;</span><br><span class="line"> <span class="keyword">try</span> {</span><br><span class="line"> doCalc(doMatch(math));</span><br><span class="line"> } <span class="keyword">catch</span> (Exception e) {</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="六-递归"><a href="#六-递归" class="headerlink" title="六.递归"></a>六.递归</h2><h3 id="1-简单介绍"><a href="#1-简单介绍" class="headerlink" title="1.简单介绍"></a>1.简单介绍</h3><p>递归就是方法自己调用自己,每次调用时传入不同的变量,<strong>递归有助于编程者解决复杂的问题</strong>,同时可以让代码变得简洁</p>
|
||
<p><img src="/pictures/image-20230511123527496.png" alt="image-20230511123527496"></p>
|
||
<h3 id="2-入门案例"><a href="#2-入门案例" class="headerlink" title="2.入门案例"></a>2.入门案例</h3><p><img src="/pictures/image-20230511123245408.png" alt="image-20230511123245408"></p>
|
||
<h3 id="3-递归解决的问题"><a href="#3-递归解决的问题" class="headerlink" title="3.递归解决的问题"></a>3.递归解决的问题</h3><p>1)各种数学问题如: 8皇后问题 , 汉诺塔, 阶乘问题, 迷宫问题, 球和篮子的问题(google编程大赛)</p>
|
||
<p>2)各种算法中也会使用到递归,比如快排,归并排序,二分查找,分治算法等.</p>
|
||
<p>3)将用栈解决的问题–>第归代码比较简洁</p>
|
||
<h3 id="4-递归遵循的规则"><a href="#4-递归遵循的规则" class="headerlink" title="4.递归遵循的规则"></a>4.递归遵循的规则</h3><p>1)执行一个方法时,就创建一个新的受保护的独立空间(栈空间)</p>
|
||
<p>2)方法的局部变量是独立的,不会相互影响, 比如n变量</p>
|
||
<p>3)如果方法中使用的是引用类型变量(比如数组),就会共享该引用类型的数据.</p>
|
||
<p>4)递归必须向退出递归的条件逼近,否则就是无限递归,出现StackOverflowError,死龟了:)</p>
|
||
<p>5)当一个方法执行完毕,或者遇到return,就会返回,遵守谁调用,就将结果返回给谁,同时当方法执行完毕或者返回时,该方法也就执行完毕。</p>
|
||
<h3 id="5-递归的实际应用"><a href="#5-递归的实际应用" class="headerlink" title="5.递归的实际应用"></a>5.递归的实际应用</h3><h4 id="5-1递归解决迷宫问题"><a href="#5-1递归解决迷宫问题" class="headerlink" title="5.1递归解决迷宫问题"></a>5.1递归解决迷宫问题</h4><p><img src="/pictures/image-20230512092144712.png" alt="image-20230512092144712"></p>
|
||
<p><strong>代码实现</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.recursion;</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/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">class</span> <span class="title class_">MiGong</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</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="type">int</span>[][] map = <span class="keyword">new</span> <span class="title class_">int</span>[<span class="number">8</span>][<span class="number">7</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"> <span class="comment">//将上下变成墙</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < <span class="number">7</span>; i++) {</span><br><span class="line"> map[<span class="number">0</span>][i] = <span class="number">1</span>;</span><br><span class="line"> map[<span class="number">7</span>][i] = <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="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < <span class="number">8</span>; i++) {</span><br><span class="line"> map[i][<span class="number">0</span>] = <span class="number">1</span>;</span><br><span class="line"> map[i][<span class="number">6</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"> map[<span class="number">3</span>][<span class="number">1</span>] = <span class="number">1</span>;</span><br><span class="line"> map[<span class="number">3</span>][<span class="number">2</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"> showMap(map);</span><br><span class="line"> <span class="comment">//使用递归回溯给小球找路</span></span><br><span class="line"> getWay(map, <span class="number">1</span>, <span class="number">1</span>);</span><br><span class="line"> System.out.println(<span class="string">"标识过的路"</span>);</span><br><span class="line"> showMap(map);</span><br><span class="line"></span><br><span class="line"></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 class="doctag">@param</span> map 地图组成的二维数组</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">showMap</span><span class="params">(<span class="type">int</span>[][] map)</span> {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < map.length; i++) {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">j</span> <span class="operator">=</span> <span class="number">0</span>; j < map[i].length; j++) {</span><br><span class="line"> System.out.print(map[i][j] + <span class="string">" "</span>);</span><br><span class="line"> }</span><br><span class="line"> System.out.println();</span><br><span class="line"> }</span><br><span class="line"> }</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"> * 1.表示墙 2.表示通路 可以走 3.表示该位置已经走过 但是走不通</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 class="doctag">@param</span> map 传进来的地图信息</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> i 从哪个位置开始找</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> j 从哪个位置开始找</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">public</span> <span class="keyword">static</span> <span class="type">boolean</span> <span class="title function_">getWay</span><span class="params">(<span class="type">int</span>[][] map, <span class="type">int</span> i, <span class="type">int</span> j)</span> {</span><br><span class="line"> <span class="keyword">if</span> (map[<span class="number">6</span>][<span class="number">5</span>] == <span class="number">2</span>) { <span class="comment">//说明通路已经找到了 就直接退出</span></span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="keyword">if</span> (map[i][j] == <span class="number">0</span>) {<span class="comment">//如果当前这个点还没有走过</span></span><br><span class="line"> <span class="comment">//按照策略走 下->右->上->左</span></span><br><span class="line"> map[i][j] = <span class="number">2</span>;<span class="comment">//先假定这个点可以走通</span></span><br><span class="line"> <span class="keyword">if</span> (getWay(map, i + <span class="number">1</span>, j)) { <span class="comment">//向下走</span></span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (getWay(map, i, j + <span class="number">1</span>)) {<span class="comment">//向右走</span></span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (getWay(map, i - <span class="number">1</span>, j)) {<span class="comment">//向上走</span></span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (getWay(map, i, j - <span class="number">1</span>)) {<span class="comment">//向左走</span></span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line"> } <span class="keyword">else</span> {<span class="comment">//四个方向都走不通的话说明不是一个通路 设置成false</span></span><br><span class="line"> map[i][j] = <span class="number">3</span>;</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"> }</span><br><span class="line"> } <span class="keyword">else</span> {<span class="comment">//不为0 可以是1,2,3</span></span><br><span class="line"> <span class="comment">//可以理解为只走没有走过的</span></span><br><span class="line"> <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
<h4 id="5-2-递归解决八皇后问题"><a href="#5-2-递归解决八皇后问题" class="headerlink" title="5.2 递归解决八皇后问题"></a>5.2 递归解决八皇后问题</h4><p>使用回溯算法解决 类似于穷举法 后期使用别的算法优化</p>
|
||
<p><strong>问题介绍</strong></p>
|
||
<p><img src="/pictures/image-20230512112050729.png" alt="image-20230512112050729"></p>
|
||
<p><strong>思路分析</strong></p>
|
||
<p><img src="/pictures/image-20230512112456731.png" alt="image-20230512112456731"></p>
|
||
<p><strong>代码实现</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.recursion;</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/13</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">class</span> <span class="title class_">Queue8</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">Queue8</span> <span class="variable">queue8</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Queue8</span>();</span><br><span class="line"> queue8.check(<span class="number">0</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//定义一个max表示共有多少个皇后</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">max</span> <span class="operator">=</span> <span class="number">8</span>;</span><br><span class="line"> <span class="comment">//定义一个一维数组 记录皇后在列上的位置 arr[8] = {0 , 4, 7, 5, 2, 6, 1, 3}</span></span><br><span class="line"> <span class="type">int</span>[] array = <span class="keyword">new</span> <span class="title class_">int</span>[max];</span><br><span class="line"> <span class="comment">//记录摆法的次数</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">count</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 编写一个方法 放置n个皇后</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">public</span> <span class="keyword">void</span> <span class="title function_">check</span><span class="params">(<span class="type">int</span> n)</span> {</span><br><span class="line"> <span class="keyword">if</span> (n == max) { <span class="comment">//说明已经放到了第九个皇后了</span></span><br><span class="line"> print(); <span class="comment">//打印</span></span><br><span class="line"> <span class="keyword">return</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//依次放入皇后 判断是否冲突</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < max; i++) {</span><br><span class="line"> <span class="comment">//先把当前的这个皇后n,放到该行的第i列</span></span><br><span class="line"> array[n] = i;</span><br><span class="line"> <span class="comment">//判断当前放置第n个皇后到i列时,与前面放置的皇后是否冲突</span></span><br><span class="line"> <span class="keyword">if</span> (judge(n)) { <span class="comment">//不冲突</span></span><br><span class="line"> <span class="comment">//接着放n+1个皇后</span></span><br><span class="line"> check(n + <span class="number">1</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//如果冲突 就继续执行 array[n] = i 就皇后在本行后移一个位置</span></span><br><span class="line"> <span class="comment">//因为在循环里面 i++会自增 n会后移</span></span><br><span class="line"> }</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"> * 当我们放置了n个皇后之后 就去检测</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> n 表示第n个皇后</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="type">boolean</span> <span class="title function_">judge</span><span class="params">(<span class="type">int</span> n)</span> {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < n; i++) {</span><br><span class="line"> <span class="comment">// array[8] = {0 , 4, 7, 5, 2, 6, 1, 3} 再次注意这里数组记录的是每个皇后在列上的值</span></span><br><span class="line"> <span class="comment">//array[i] == array[i] 判断是不是在同一列</span></span><br><span class="line"> <span class="comment">//Math.abs(n - i) == Math.abs(array[n] - array[i]) 判断是不是在同一斜线上</span></span><br><span class="line"> <span class="comment">//自己的理解:(n -i) 相当于在行上的距离 array[n] - array[i]相当于在列上的距离 行距离等于列距离 说明二者在同一斜线上</span></span><br><span class="line"> <span class="keyword">if</span> (array[i] == array[n] || Math.abs(n - i) == Math.abs(array[n] - array[i])) {<span class="comment">//与前面放置的位置是否冲突</span></span><br><span class="line"> <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</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">public</span> <span class="keyword">void</span> <span class="title function_">print</span><span class="params">()</span> {</span><br><span class="line"> System.out.println(<span class="string">"第"</span> + (++count) + <span class="string">"中摆法"</span>);</span><br><span class="line"> <span class="type">int</span>[][] arr = <span class="keyword">new</span> <span class="title class_">int</span>[max][max];</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < array.length; i++) {</span><br><span class="line"> arr[i][array[i]] = <span class="number">1</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span>[] ints : arr) {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> i : ints) {</span><br><span class="line"> System.out.print(i + <span class="string">" "</span>);</span><br><span class="line"> }</span><br><span class="line"> System.out.println();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
<h2 id="七-排序算法"><a href="#七-排序算法" class="headerlink" title="七.排序算法"></a>七.排序算法</h2><p><strong>十大经典的排序算法:</strong><a href="https://www.runoob.com/w3cnote/ten-sorting-algorithm.html">菜鸟教程排序算法</a></p>
|
||
<h3 id="1-介绍-1"><a href="#1-介绍-1" class="headerlink" title="1.介绍"></a>1.介绍</h3><p><img src="/pictures/image-20230513115319799.png" alt="image-20230513115319799"></p>
|
||
<h3 id="2-时间复杂度"><a href="#2-时间复杂度" class="headerlink" title="2.时间复杂度"></a>2.时间复杂度</h3><p><strong>度量时间复杂度的两种方法</strong></p>
|
||
<p>事后统计法的不足:</p>
|
||
<ul>
|
||
<li>需要实际的运行程序 比较耗时</li>
|
||
<li>受计算机硬件和软件的影响</li>
|
||
</ul>
|
||
<p><img src="/pictures/image-20230513115606521.png" alt="image-20230513115606521"></p>
|
||
<p><strong>时间频度</strong></p>
|
||
<p> 基本的介绍:一个算法花费的时间与算法中语句的执行次数成正比例,哪个算法中语句执行次数多,它花费时间就多。<strong>一个算法中的语句执行次数称为语句频度或时间频度</strong>。记为T(n)</p>
|
||
<p><strong>时间复杂度介绍</strong></p>
|
||
<p><img src="/pictures/image-20230515093520587.png" alt="image-20230515093520587"></p>
|
||
<p><strong>常见的时间复杂度</strong></p>
|
||
<p><img src="/pictures/image-20230515093753893.png" alt="image-20230515093753893"></p>
|
||
<h3 id="3-空间复杂度"><a href="#3-空间复杂度" class="headerlink" title="3.空间复杂度"></a>3.空间复杂度</h3><p><img src="/pictures/image-20230515095247319.png" alt="image-20230515095247319"></p>
|
||
<p><strong>排序算法的时间和空间复杂度</strong></p>
|
||
<p><img src="/pictures/image-20230516083738747.png" alt="image-20230516083738747"></p>
|
||
<h3 id="4-冒泡排序"><a href="#4-冒泡排序" class="headerlink" title="4.冒泡排序"></a>4.冒泡排序</h3><p>冒泡排序的时间复杂度:o(n^2)</p>
|
||
<p>同一台电脑 8万个数据 十几秒左右</p>
|
||
<h4 id="4-1-基本介绍"><a href="#4-1-基本介绍" class="headerlink" title="4.1 基本介绍"></a>4.1 基本介绍</h4><p><img src="/pictures/image-20230515100345339.png" alt="image-20230515100345339"></p>
|
||
<h4 id="4-2-图解"><a href="#4-2-图解" class="headerlink" title="4.2 图解"></a>4.2 图解</h4><p><img src="/pictures/image-20230515100754827.png" alt="image-20230515100754827"></p>
|
||
<h4 id="4-3-代码实现"><a href="#4-3-代码实现" class="headerlink" title="4.3 代码实现"></a>4.3 代码实现</h4><p>优化之前的代码 </p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.sort;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Arrays;</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/15</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">class</span> <span class="title class_">BubbleSort</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">int</span> arr[] = {<span class="number">3</span>, <span class="number">9</span>, -<span class="number">1</span>, <span class="number">10</span>, -<span class="number">2</span>};</span><br><span class="line"> BubbleSort.sort(arr);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">sort</span><span class="params">(<span class="type">int</span>[] arr)</span> {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < arr.length - <span class="number">1</span>; i++) {</span><br><span class="line"> <span class="type">int</span> <span class="variable">temp</span> <span class="operator">=</span> <span class="number">0</span>; <span class="comment">//临时变量</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">j</span> <span class="operator">=</span> <span class="number">0</span>; j < arr.length - <span class="number">1</span> - i; j++) {</span><br><span class="line"> <span class="comment">//如果前面的数字大于后面的数字就交换</span></span><br><span class="line"> <span class="keyword">if</span> (arr[j] > arr[j + <span class="number">1</span>]) {</span><br><span class="line"> temp = arr[j];</span><br><span class="line"> arr[j] = arr[j + <span class="number">1</span>];</span><br><span class="line"> arr[j + <span class="number">1</span>] = temp;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"第"</span> + (i + <span class="number">1</span>) + <span class="string">"次排序:"</span> + Arrays.toString(arr));</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"排序之后的数组:"</span> + Arrays.toString(arr));</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>优化之后的代码(如果排序的过程中代码有序就不在排序)</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.sort;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Arrays;</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/15</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">class</span> <span class="title class_">BubbleSort</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">int</span> arr[] = {<span class="number">3</span>, <span class="number">9</span>, -<span class="number">1</span>, <span class="number">10</span>, -<span class="number">2</span>};</span><br><span class="line"> BubbleSort.sort(arr);</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 class="doctag">@param</span> arr 需要排序的数组</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">sort</span><span class="params">(<span class="type">int</span>[] arr)</span> {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < arr.length - <span class="number">1</span>; i++) {</span><br><span class="line"> <span class="type">int</span> <span class="variable">temp</span> <span class="operator">=</span> <span class="number">0</span>; <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">false</span>; <span class="comment">//表示是否进行过排序</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">j</span> <span class="operator">=</span> <span class="number">0</span>; j < arr.length - <span class="number">1</span> - i; j++) {</span><br><span class="line"> <span class="comment">//如果前面的数字大于后面的数字就交换</span></span><br><span class="line"> <span class="keyword">if</span> (arr[j] > arr[j + <span class="number">1</span>]) {</span><br><span class="line"> flag = <span class="literal">true</span>;</span><br><span class="line"> temp = arr[j];</span><br><span class="line"> arr[j] = arr[j + <span class="number">1</span>];</span><br><span class="line"> arr[j + <span class="number">1</span>] = temp;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"第"</span> + (i + <span class="number">1</span>) + <span class="string">"次排序:"</span> + Arrays.toString(arr));</span><br><span class="line"> <span class="keyword">if</span>(!flag){ <span class="comment">//说明一次都没有交换 说明已经有序</span></span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"排序之后的数组:"</span> + Arrays.toString(arr));</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230516091218716.png" alt="image-20230516091218716"></p>
|
||
<h3 id="5-选择排序"><a href="#5-选择排序" class="headerlink" title="5.选择排序"></a>5.选择排序</h3><h4 id="5-1-基本介绍"><a href="#5-1-基本介绍" class="headerlink" title="5.1 基本介绍"></a>5.1 基本介绍</h4><p>同一台电脑 8万个数据 两秒左右</p>
|
||
<p>选择式排序也属于内部排序法,是从欲排序的数据中,按指定的规则选出某一元素,再依规定交换位置后达到排序的目的</p>
|
||
<p><img src="/pictures/image-20230515105359552.png" alt="image-20230515105359552"></p>
|
||
<h4 id="5-2图解"><a href="#5-2图解" class="headerlink" title="5.2图解"></a>5.2图解</h4><p><img src="/pictures/selectionSort.gif" alt="img"></p>
|
||
<p><img src="/pictures/image-20230516083148055.png" alt="image-20230516083148055"></p>
|
||
<h4 id="5-3代码实现"><a href="#5-3代码实现" class="headerlink" title="5.3代码实现"></a>5.3代码实现</h4><p>两种方法 一个是自己的 一个是老师的</p>
|
||
<p>使用老师的代码 老师的代码验证过</p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.sort;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Arrays;</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/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="keyword">public</span> <span class="keyword">class</span> <span class="title class_">SelectSort</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">int</span>[] arr = {<span class="number">101</span>,<span class="number">34</span>,<span class="number">119</span>,<span class="number">1</span>};</span><br><span class="line"> <span class="type">int</span>[] arr1 = {<span class="number">3</span>, <span class="number">9</span>, -<span class="number">1</span>, <span class="number">10</span>, -<span class="number">2</span>};</span><br><span class="line"> <span class="type">int</span>[] arr2 = {<span class="number">3</span>, <span class="number">9</span>, -<span class="number">1</span>, <span class="number">10</span>, -<span class="number">2</span>};</span><br><span class="line"> System.out.println(<span class="string">"自己的代码"</span>);</span><br><span class="line"> SelectSort.selectSort(arr2);</span><br><span class="line"> System.out.println(<span class="string">"老师的代码"</span>);</span><br><span class="line"> SelectSort.selectSortByTeacher(arr1);</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="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">selectSort</span><span class="params">(<span class="type">int</span>[] arr)</span> {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < arr.length - <span class="number">1</span>; i++) {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">j</span> <span class="operator">=</span> i + <span class="number">1</span>; j < arr.length; j++) {<span class="comment">//从第一个数字开始 依次找到最小值</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">temp</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">if</span>(arr[i] > arr[j]) {</span><br><span class="line"> temp = arr[i];</span><br><span class="line"> arr[i] = arr[j];</span><br><span class="line"> arr[j] = temp;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"第次"</span>+(i+<span class="number">1</span>)+<span class="string">"排序的结果:"</span>+Arrays.toString(arr));</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"最终的结果:"</span>+Arrays.toString(arr));</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">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">selectSortByTeacher</span><span class="params">(<span class="type">int</span>[] arr)</span>{</span><br><span class="line"></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < arr.length - <span class="number">1</span>; i++) {</span><br><span class="line"> <span class="type">int</span> <span class="variable">minIndex</span> <span class="operator">=</span> i;</span><br><span class="line"> <span class="type">int</span> <span class="variable">min</span> <span class="operator">=</span> arr[i];</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">j</span> <span class="operator">=</span> i + <span class="number">1</span>; j < arr.length; j++) {<span class="comment">//从第一个数字开始 依次找到最小值</span></span><br><span class="line"> <span class="keyword">if</span>(min > arr[j]){</span><br><span class="line"> min = arr[j];</span><br><span class="line"> minIndex = j;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//交换</span></span><br><span class="line"> arr[minIndex] = arr[i];</span><br><span class="line"> arr[i] = min;</span><br><span class="line"> System.out.println(<span class="string">"第次"</span>+(i+<span class="number">1</span>)+<span class="string">"排序的结果:"</span>+Arrays.toString(arr));</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"最终的结果:"</span>+Arrays.toString(arr));</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230516093143656.png" alt="image-20230516093143656"></p>
|
||
<h3 id="6-插入排序"><a href="#6-插入排序" class="headerlink" title="6.插入排序"></a>6.插入排序</h3><h4 id="6-1-基本介绍"><a href="#6-1-基本介绍" class="headerlink" title="6.1 基本介绍"></a>6.1 基本介绍</h4><p>同一台电脑 8万个数据 五秒左右</p>
|
||
<p>插入式排序属于内部排序法,是对于欲排序的元素以插入的方式找寻该元素的适当位置,以达到排序的目的。</p>
|
||
<p><img src="/pictures/image-20230516100256880.png" alt="image-20230516100256880"></p>
|
||
<h4 id="6-2-图解"><a href="#6-2-图解" class="headerlink" title="6.2 图解"></a>6.2 图解</h4><img src="/pictures/insertionSort.gif" alt="img" style="zoom:150%;" />
|
||
|
||
<h4 id="6-3-代码实现"><a href="#6-3-代码实现" class="headerlink" title="6.3 代码实现"></a>6.3 代码实现</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.sort;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Arrays;</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/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="keyword">public</span> <span class="keyword">class</span> <span class="title class_">InsertSort</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">int</span>[] arr = {<span class="number">101</span>, <span class="number">34</span>, <span class="number">119</span>, <span class="number">1</span>,-<span class="number">1</span>,<span class="number">89</span>};</span><br><span class="line"> System.out.println(<span class="string">"插入前的数组:"</span>+Arrays.toString(arr));</span><br><span class="line"> InsertSort.insertSort(arr);</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">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">insertSort</span><span class="params">(<span class="type">int</span>[] arr)</span> {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">1</span>; i < arr.length; i++) {</span><br><span class="line"> <span class="comment">//定义待插入的数</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">insertVal</span> <span class="operator">=</span> arr[i];</span><br><span class="line"> <span class="comment">//待插入的数的前一个数的下标</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">insertIndex</span> <span class="operator">=</span> i - <span class="number">1</span>;</span><br><span class="line"> <span class="keyword">while</span> (insertIndex >= <span class="number">0</span> && insertVal < arr[insertIndex]) {</span><br><span class="line"> arr[insertIndex + <span class="number">1</span>] = arr[insertIndex];</span><br><span class="line"> insertIndex--;</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"> arr[insertIndex + <span class="number">1</span>] = insertVal;</span><br><span class="line"> System.out.println(<span class="string">"第"</span> + i + <span class="string">"次插入的结果:"</span> + Arrays.toString(arr));</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"最终的结果:"</span> + Arrays.toString(arr));</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><img src="/pictures/image-20230516105517026.png" alt="image-20230516105517026"></p>
|
||
<h3 id="7-希尔排序"><a href="#7-希尔排序" class="headerlink" title="7.希尔排序"></a>7.希尔排序</h3><h4 id="7-1基本介绍"><a href="#7-1基本介绍" class="headerlink" title="7.1基本介绍"></a>7.1基本介绍</h4><p>同一台电脑 8万个数据 十七秒左右(交换法)</p>
|
||
<p>同一台电脑 8万个数据 一秒左右(移动法)</p>
|
||
<p><img src="/pictures/image-20230517091741355.png" alt="image-20230517091741355"></p>
|
||
<p><img src="/pictures/image-20230517091841366.png" alt="image-20230517091841366"></p>
|
||
<h4 id="7-2-图解"><a href="#7-2-图解" class="headerlink" title="7.2.图解"></a>7.2.图解</h4><p><img src="/pictures/Sorting_shellsort_anim.gif" alt="img"></p>
|
||
<img src="/pictures/image-20230517102649272.png" alt="image-20230517102649272" style="zoom:150%;" />
|
||
|
||
<h4 id="7-3-代码实现"><a href="#7-3-代码实现" class="headerlink" title="7.3 代码实现"></a>7.3 代码实现</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.sort;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Arrays;</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/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="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ShellSort</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">int</span>[] arr = {<span class="number">8</span>, <span class="number">9</span>, <span class="number">1</span>, <span class="number">7</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">4</span>, <span class="number">6</span>, <span class="number">0</span>};</span><br><span class="line"> <span class="comment">//shellSort(arr);</span></span><br><span class="line"> shellSort2(arr);</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">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">shellSort</span><span class="params">(<span class="type">int</span>[] arr)</span> {</span><br><span class="line"> <span class="type">int</span> <span class="variable">temp</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="type">int</span> <span class="variable">count</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="comment">//用于分组 10个数据 第一次分5组 第二次分2组 第三次分1组 每组分别插入排序</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">gap</span> <span class="operator">=</span> arr.length / <span class="number">2</span>; gap > <span class="number">0</span>; gap /= <span class="number">2</span>) {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> gap; i < arr.length; i++) {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">j</span> <span class="operator">=</span> i - gap; j >= <span class="number">0</span>; j -= gap) {</span><br><span class="line"> <span class="comment">//如果当前的那个元素大于加上步长后的那个元素,就交换</span></span><br><span class="line"> <span class="keyword">if</span> (arr[j] > arr[j + gap]) {</span><br><span class="line"> temp = arr[j];</span><br><span class="line"> arr[j] = arr[j + gap];</span><br><span class="line"> arr[j + gap] = temp;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"排序第"</span> + (++count) + <span class="string">"轮的结果:"</span> + Arrays.toString(arr));</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"最终的结果:"</span> + Arrays.toString(arr));</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">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">shellSort2</span><span class="params">(<span class="type">int</span>[] arr)</span> {</span><br><span class="line"> <span class="comment">//用于分组 10个数据 第一次分5组 第二次分2组 第三次分1组 每组分别插入排序</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">count</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">gap</span> <span class="operator">=</span> arr.length / <span class="number">2</span>; gap > <span class="number">0</span>; gap /= <span class="number">2</span>) {</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> gap; i < arr.length; i++) {</span><br><span class="line"> <span class="type">int</span> <span class="variable">j</span> <span class="operator">=</span> i;</span><br><span class="line"> <span class="type">int</span> <span class="variable">temp</span> <span class="operator">=</span> arr[j];</span><br><span class="line"> <span class="keyword">if</span> (arr[j] < arr[j - gap]) {</span><br><span class="line"> <span class="keyword">while</span> (j - gap >= <span class="number">0</span> && temp < arr[j - gap]) {</span><br><span class="line"> arr[j] = arr[j - gap];</span><br><span class="line"> j -= gap;</span><br><span class="line"> }</span><br><span class="line"> arr[j] = temp; }</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"排序第"</span> + (++count) + <span class="string">"轮的结果:"</span> + Arrays.toString(arr));</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"最终的结果:"</span> + Arrays.toString(arr));</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="8-快速排序"><a href="#8-快速排序" class="headerlink" title="8.快速排序"></a>8.快速排序</h3><h4 id="8-1-基本介绍"><a href="#8-1-基本介绍" class="headerlink" title="8.1 基本介绍"></a>8.1 基本介绍</h4><p>同一台电脑 8万个数据 不到一秒 800万个数据两秒钟</p>
|
||
<p> <strong>快速排序(Quicksort)是对冒泡排序的一种改进。基本思想是:通过一趟排序将要排序的数据分割成独立的两部分,其中一部分的所有数据都比另外一部分的所有数据都要小,然后再按此方法对这两部分数据分别进行快速排序,整个排序过程可以递归进行,以此达到整个数据变成有序序列</strong></p>
|
||
<h4 id="8-2-图解"><a href="#8-2-图解" class="headerlink" title="8.2 图解"></a>8.2 图解</h4><img src="/pictures/quickSort.gif" alt="img" style="zoom:150%;" />
|
||
|
||
<img src="/pictures/image-20230517103139900.png" alt="image-20230517103139900" style="zoom:150%;" />
|
||
|
||
<h4 id="8-3-代码实现"><a href="#8-3-代码实现" class="headerlink" title="8.3 代码实现"></a>8.3 代码实现</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.sort;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Arrays;</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/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="keyword">public</span> <span class="keyword">class</span> <span class="title class_">QuickSort</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">int</span>[] arr = {-<span class="number">9</span>, <span class="number">78</span>, <span class="number">0</span>, <span class="number">23</span>, -<span class="number">567</span>, <span class="number">70</span>};</span><br><span class="line"> quickSort(arr, <span class="number">0</span>, arr.length - <span class="number">1</span>);</span><br><span class="line"> System.out.println(Arrays.toString(arr));</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 class="doctag">@param</span> arr 需要排序的数组</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> left 左下标</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> right 右下标</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">quickSort</span><span class="params">(<span class="type">int</span>[] arr, <span class="type">int</span> left, <span class="type">int</span> right)</span> {</span><br><span class="line"> <span class="type">int</span> <span class="variable">l</span> <span class="operator">=</span> left;</span><br><span class="line"> <span class="type">int</span> <span class="variable">r</span> <span class="operator">=</span> right;</span><br><span class="line"> <span class="comment">//pivot 中轴</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">pivot</span> <span class="operator">=</span> arr[(left + right) / <span class="number">2</span>];</span><br><span class="line"> <span class="type">int</span> <span class="variable">temp</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="comment">//while循环的目的是让比pivot小的放到左边 大的放在右边</span></span><br><span class="line"> <span class="keyword">while</span> (l < r) {</span><br><span class="line"> <span class="comment">//在pivot的左边一直找 找到大于等于pivot的值 才退出</span></span><br><span class="line"> <span class="keyword">while</span> (arr[l] < pivot) {</span><br><span class="line"> l += <span class="number">1</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//在pivot的左边一直找 找到大于等于pivot的值 才退出</span></span><br><span class="line"> <span class="keyword">while</span> (arr[r] > pivot) {</span><br><span class="line"> r -= <span class="number">1</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//如果l >= r成立 说明pivot的左右两边的值 已经是按照左边全部是</span></span><br><span class="line"> <span class="comment">//小于等于pivot值 右边全部是大于等于pivot值</span></span><br><span class="line"> <span class="keyword">if</span> (l >= r) {</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//交换</span></span><br><span class="line"> temp = arr[l];</span><br><span class="line"> arr[l] = arr[r];</span><br><span class="line"> arr[r] = temp;</span><br><span class="line"> <span class="comment">//如果交换完之后发现arr[l] = pivot值</span></span><br><span class="line"> <span class="keyword">if</span> (arr[l] == pivot) {</span><br><span class="line"> r--;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//如果交换完之后发现arr[r] = pivot值</span></span><br><span class="line"> <span class="keyword">if</span> (arr[r] == pivot) {</span><br><span class="line"> l++;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//如果l == r 必须l++ r--</span></span><br><span class="line"> <span class="keyword">if</span> (l == r) {</span><br><span class="line"> l += <span class="number">1</span>;</span><br><span class="line"> r -= <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="keyword">if</span> (left < r) {<span class="comment">//左边的数全部有序</span></span><br><span class="line"> quickSort(arr, left, r);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//向右递归</span></span><br><span class="line"> <span class="keyword">if</span> (right > l) {</span><br><span class="line"> quickSort(arr, l, right);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
|
||
|
||
<h3 id="9-归并排序"><a href="#9-归并排序" class="headerlink" title="9. 归并排序"></a>9. 归并排序</h3><h4 id="9-1基本介绍"><a href="#9-1基本介绍" class="headerlink" title="9.1基本介绍"></a>9.1基本介绍</h4><p>同一台电脑 8万个数据 大约一秒钟 800万个数据三秒</p>
|
||
<p><img src="/pictures/image-20230518111233009.png" alt="image-20230518111233009"></p>
|
||
<h4 id="9-2-图解"><a href="#9-2-图解" class="headerlink" title="9.2 图解"></a>9.2 图解</h4><img src="/pictures/mergeSort.gif" alt="img" style="zoom:150%;" />
|
||
|
||
<p><img src="/pictures/image-20230518111454775.png" alt="image-20230518111454775"></p>
|
||
<p><img src="/pictures/image-20230518111536026.png" alt="image-20230518111536026"></p>
|
||
<h4 id="9-3代码实现"><a href="#9-3代码实现" class="headerlink" title="9.3代码实现"></a>9.3代码实现</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.sort;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Arrays;</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/18</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">class</span> <span class="title class_">MergeSort</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">int</span>[] arr = {<span class="number">8</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">7</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">6</span>, <span class="number">2</span>};</span><br><span class="line"> <span class="type">int</span>[] temp = <span class="keyword">new</span> <span class="title class_">int</span>[arr.length];</span><br><span class="line"> mergeSort(arr,<span class="number">0</span>, arr.length -<span class="number">1</span>,temp);</span><br><span class="line"> System.out.println(<span class="string">"归并排序之后的数组:"</span>+ Arrays.toString(arr));</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">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">mergeSort</span><span class="params">(<span class="type">int</span>[] arr, <span class="type">int</span> left, <span class="type">int</span> right, <span class="type">int</span>[] temp)</span>{</span><br><span class="line"> <span class="keyword">if</span>(left < right){</span><br><span class="line"> <span class="type">int</span> <span class="variable">mid</span> <span class="operator">=</span> (left + right) / <span class="number">2</span>;</span><br><span class="line"> <span class="comment">//向左递归分解</span></span><br><span class="line"> mergeSort(arr,left,mid,temp);</span><br><span class="line"> <span class="comment">//向右递归分解</span></span><br><span class="line"> mergeSort(arr,mid+<span class="number">1</span>,right,temp);</span><br><span class="line"> <span class="comment">//合并</span></span><br><span class="line"> merge(arr,left,mid,right,temp);</span><br><span class="line"> }</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 class="doctag">@param</span> arr 需要排序的数组</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> left 右边有序序列的初始索引</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> mid 中间索引</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> right 右边索引</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> temp 中转的数组</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">merge</span><span class="params">(<span class="type">int</span>[] arr, <span class="type">int</span> left, <span class="type">int</span> mid, <span class="type">int</span> right, <span class="type">int</span>[] temp)</span> {</span><br><span class="line"> <span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> left;<span class="comment">//左边有序序列的初始索引</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">j</span> <span class="operator">=</span> mid + <span class="number">1</span>;<span class="comment">//右边有序序列的初始化索引</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">t</span> <span class="operator">=</span> <span class="number">0</span>;<span class="comment">//指向temp数组的当前索引</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">//1.</span></span><br><span class="line"> <span class="comment">//先把左右两边(有序)的数据填充到temp数组</span></span><br><span class="line"> <span class="comment">//直到左右两边的数据有一边处理完毕为止</span></span><br><span class="line"> <span class="keyword">while</span> (i <= mid && j <= right) {<span class="comment">//相当于左右两边的数组都有一个指针</span></span><br><span class="line"> <span class="keyword">if</span> (arr[i] <= arr[j]) {</span><br><span class="line"> temp[t] = arr[i];</span><br><span class="line"> t++;</span><br><span class="line"> i++;</span><br><span class="line"> } <span class="keyword">else</span> {<span class="comment">//反之将右边有序序列的当前元素 填充到temp数组</span></span><br><span class="line"> temp[t] = arr[j];</span><br><span class="line"> t++;</span><br><span class="line"> j++;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//2.</span></span><br><span class="line"> <span class="comment">//把有剩余数据的一边的数据依次全部填充到temp</span></span><br><span class="line"> <span class="keyword">while</span> (i <= mid) {<span class="comment">//说明左边的有序序列还有剩余的元素</span></span><br><span class="line"> temp[t] = arr[i];</span><br><span class="line"> t++;</span><br><span class="line"> i++;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">while</span> (j <= right) {</span><br><span class="line"> temp[t] = arr[j];</span><br><span class="line"> t++;</span><br><span class="line"> j++;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="comment">//3.</span></span><br><span class="line"> <span class="comment">//将temp数组的元素拷贝到arr</span></span><br><span class="line"> <span class="comment">//并不是每次都拷贝</span></span><br><span class="line"> t = <span class="number">0</span>;</span><br><span class="line"> <span class="type">int</span> <span class="variable">tempLeft</span> <span class="operator">=</span> left;</span><br><span class="line"> <span class="keyword">while</span> (tempLeft <= right) {</span><br><span class="line"> arr[tempLeft] = temp[t];</span><br><span class="line"> t++;</span><br><span class="line"> tempLeft++;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="10-基数排序"><a href="#10-基数排序" class="headerlink" title="10.基数排序"></a>10.基数排序</h3><p>同一台电脑8万个数据 一秒左右 8千万个数据会报内存不足</p>
|
||
<h4 id="10-1-基本介绍"><a href="#10-1-基本介绍" class="headerlink" title="10.1 基本介绍"></a>10.1 基本介绍</h4><p><img src="/pictures/image-20230525195008102.png" alt="image-20230525195008102"></p>
|
||
<p><img src="/pictures/image-20230526094945578.png" alt="image-20230526094945578"></p>
|
||
<p><img src="/pictures/image-20230526113739081.png" alt="image-20230526113739081"></p>
|
||
<h4 id="10-2-图解"><a href="#10-2-图解" class="headerlink" title="10.2 图解"></a>10.2 图解</h4><p><img src="/pictures/radixSort.gif" alt="img"></p>
|
||
<h4 id="10-3-代码实现"><a href="#10-3-代码实现" class="headerlink" title="10.3 代码实现"></a>10.3 代码实现</h4><p><strong>推导代码</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.sort;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Arrays;</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/26</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">class</span> <span class="title class_">RadixSort</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="comment">//定义一个待排序的数组</span></span><br><span class="line"> <span class="type">int</span> arr[] = {<span class="number">53</span>, <span class="number">3</span>, <span class="number">542</span>, <span class="number">748</span>, <span class="number">14</span>, <span class="number">214</span>};</span><br><span class="line"> RadixSort.radixSort(arr);</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">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">radixSort</span><span class="params">(<span class="type">int</span>[] arr)</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"> <span class="comment">//为了防止数据的溢出,这里每个桶的大小我们设置的大一些 大小定为arr.length</span></span><br><span class="line"> <span class="type">int</span>[][] bucket = <span class="keyword">new</span> <span class="title class_">int</span>[<span class="number">10</span>][arr.length];</span><br><span class="line"> <span class="comment">//为了记录每个桶中实际存放了多少个数据,我们定义一个一维数组来记录每个桶中依次放入数据的个数</span></span><br><span class="line"> <span class="comment">//bucketElementCounts[0]记录的就是第0个桶的数据的个数</span></span><br><span class="line"> <span class="type">int</span>[] bucketElementCounts = <span class="keyword">new</span> <span class="title class_">int</span>[<span class="number">10</span>];</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">j</span> <span class="operator">=</span> <span class="number">0</span>; j < arr.length; j++) {</span><br><span class="line"> <span class="comment">//取出每个元素的个位数的值</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">digitOfElement</span> <span class="operator">=</span> arr[j] % <span class="number">10</span>;</span><br><span class="line"> <span class="comment">//放入对应的桶中</span></span><br><span class="line"> bucket[digitOfElement][bucketElementCounts[digitOfElement]] = arr[j];</span><br><span class="line"> <span class="comment">//[bucketElementCounts[digitOfElement]]++的意思是在digitOfElement对应的桶中数据个数加一</span></span><br><span class="line"> bucketElementCounts[digitOfElement]++;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//按照这个桶中顺序取出数据</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">index</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">k</span> <span class="operator">=</span> <span class="number">0</span>; k < bucketElementCounts.length; k++) {</span><br><span class="line"> <span class="comment">//如果桶中有数据,我们才放入到原数组</span></span><br><span class="line"> <span class="keyword">if</span> (bucketElementCounts[k] != <span class="number">0</span>) {</span><br><span class="line"> <span class="comment">//循环该桶即第K个桶,放入</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">l</span> <span class="operator">=</span> <span class="number">0</span>; l < bucketElementCounts[k]; l++) {</span><br><span class="line"> arr[index++] = bucket[k][l];</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> bucketElementCounts[k] = <span class="number">0</span>;</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"第一轮:"</span> + Arrays.toString(arr));</span><br><span class="line"></span><br><span class="line"> <span class="comment">//2.第2轮</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">j</span> <span class="operator">=</span> <span class="number">0</span>; j < arr.length; j++) {</span><br><span class="line"> <span class="comment">//取出每个元素的十位数的值</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">digitOfElement</span> <span class="operator">=</span> arr[j] / <span class="number">10</span> % <span class="number">10</span>;</span><br><span class="line"> <span class="comment">//放入对应的桶中</span></span><br><span class="line"> bucket[digitOfElement][bucketElementCounts[digitOfElement]] = arr[j];</span><br><span class="line"> <span class="comment">//[bucketElementCounts[digitOfElement]]++的意思是在digitOfElement对应的桶中数据个数加一</span></span><br><span class="line"> bucketElementCounts[digitOfElement]++;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//按照这个桶中顺序取出数据</span></span><br><span class="line"> index = <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">k</span> <span class="operator">=</span> <span class="number">0</span>; k < bucketElementCounts.length; k++) {</span><br><span class="line"> <span class="comment">//如果桶中有数据,我们才放入到原数组</span></span><br><span class="line"> <span class="keyword">if</span> (bucketElementCounts[k] != <span class="number">0</span>) {</span><br><span class="line"> <span class="comment">//循环该桶即第K个桶,放入</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">l</span> <span class="operator">=</span> <span class="number">0</span>; l < bucketElementCounts[k]; l++) {</span><br><span class="line"> arr[index++] = bucket[k][l];</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> bucketElementCounts[k] = <span class="number">0</span>;</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"第2轮:"</span> + Arrays.toString(arr));</span><br><span class="line"></span><br><span class="line"> <span class="comment">//3.第3轮</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">j</span> <span class="operator">=</span> <span class="number">0</span>; j < arr.length; j++) {</span><br><span class="line"> <span class="comment">//取出每个元素的百位数的值</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">digitOfElement</span> <span class="operator">=</span> arr[j] / <span class="number">100</span> % <span class="number">10</span>;</span><br><span class="line"> <span class="comment">//放入对应的桶中</span></span><br><span class="line"> bucket[digitOfElement][bucketElementCounts[digitOfElement]] = arr[j];</span><br><span class="line"> <span class="comment">//[bucketElementCounts[digitOfElement]]++的意思是在digitOfElement对应的桶中数据个数加一</span></span><br><span class="line"> bucketElementCounts[digitOfElement]++;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//按照这个桶中顺序取出数据</span></span><br><span class="line"> index = <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">k</span> <span class="operator">=</span> <span class="number">0</span>; k < bucketElementCounts.length; k++) {</span><br><span class="line"> <span class="comment">//如果桶中有数据,我们才放入到原数组</span></span><br><span class="line"> <span class="keyword">if</span> (bucketElementCounts[k] != <span class="number">0</span>) {</span><br><span class="line"> <span class="comment">//循环该桶即第K个桶,放入</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">l</span> <span class="operator">=</span> <span class="number">0</span>; l < bucketElementCounts[k]; l++) {</span><br><span class="line"> arr[index++] = bucket[k][l];</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"第3轮:"</span> + Arrays.toString(arr));</span><br><span class="line"></span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>最终代码</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.sort;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Arrays;</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/26</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">class</span> <span class="title class_">RadixSort</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="comment">//定义一个待排序的数组</span></span><br><span class="line"> <span class="type">int</span> arr[] = {<span class="number">53</span>, <span class="number">3</span>, <span class="number">542</span>, <span class="number">748</span>, <span class="number">14</span>, <span class="number">214</span>};</span><br><span class="line"> RadixSort.radixSort(arr);</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">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">radixSort</span><span class="params">(<span class="type">int</span>[] arr)</span> {</span><br><span class="line"> <span class="comment">//得到数组中最大数的位数</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">max</span> <span class="operator">=</span> arr[<span class="number">0</span>];</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < arr.length; i++) {</span><br><span class="line"> <span class="keyword">if</span> (arr[i] > max) {</span><br><span class="line"> max = arr[i];</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="type">int</span> <span class="variable">maxLength</span> <span class="operator">=</span> (max + <span class="string">""</span>).length();</span><br><span class="line"> <span class="comment">//定义一个二维数组,表示十个桶,每个桶就是一个一维数组</span></span><br><span class="line"> <span class="type">int</span>[][] bucket = <span class="keyword">new</span> <span class="title class_">int</span>[<span class="number">10</span>][arr.length];</span><br><span class="line"> <span class="comment">//为了记录每个桶中实际存放了多少个数据,我们定义一个一维数组来记录每个桶中依次放入数据的个数</span></span><br><span class="line"> <span class="type">int</span>[] bucketElementCounts = <span class="keyword">new</span> <span class="title class_">int</span>[<span class="number">10</span>];</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>, n = <span class="number">1</span>; i < maxLength; i++, n *= <span class="number">10</span>) {<span class="comment">//循环的是每一轮,第一次是个位。第二次是百位</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">j</span> <span class="operator">=</span> <span class="number">0</span>; j < arr.length; j++) {</span><br><span class="line"> <span class="comment">//取出每个元素的对应位数的值</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">digitOfElement</span> <span class="operator">=</span> arr[j] / n % <span class="number">10</span>;</span><br><span class="line"> <span class="comment">//放入对应的桶中</span></span><br><span class="line"> bucket[digitOfElement][bucketElementCounts[digitOfElement]] = arr[j];</span><br><span class="line"> <span class="comment">//[bucketElementCounts[digitOfElement]]++的意思是在digitOfElement对应的桶中数据个数加一</span></span><br><span class="line"> bucketElementCounts[digitOfElement]++;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//按照这个桶中顺序取出数据</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">index</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">k</span> <span class="operator">=</span> <span class="number">0</span>; k < bucketElementCounts.length; k++) {</span><br><span class="line"> <span class="comment">//如果桶中有数据,我们才放入到原数组</span></span><br><span class="line"> <span class="keyword">if</span> (bucketElementCounts[k] != <span class="number">0</span>) {</span><br><span class="line"> <span class="comment">//循环该桶即第K个桶,放入</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">l</span> <span class="operator">=</span> <span class="number">0</span>; l < bucketElementCounts[k]; l++) {</span><br><span class="line"> arr[index++] = bucket[k][l];</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> bucketElementCounts[k] = <span class="number">0</span>;</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"第"</span> + (i + <span class="number">1</span>) + <span class="string">"轮:"</span> + Arrays.toString(arr));</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="11-常用排序算法总结和对比"><a href="#11-常用排序算法总结和对比" class="headerlink" title="11.常用排序算法总结和对比"></a>11.常用排序算法总结和对比</h3><p><img src="/pictures/image-20230526114127402.png" alt="image-20230526114127402"></p>
|
||
<h2 id="八-查找算法"><a href="#八-查找算法" class="headerlink" title="八.查找算法"></a>八.查找算法</h2><h3 id="1-简单介绍-1"><a href="#1-简单介绍-1" class="headerlink" title="1.简单介绍"></a>1.简单介绍</h3><img src="/pictures/image-20230526115027518.png" alt="image-20230526115027518" style="zoom:200%;" />
|
||
|
||
<h3 id="2-线性查找算法"><a href="#2-线性查找算法" class="headerlink" title="2.线性查找算法"></a>2.线性查找算法</h3><h4 id="2-1代码实现"><a href="#2-1代码实现" class="headerlink" title="2.1代码实现"></a>2.1代码实现</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.search;</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/29</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">class</span> <span class="title class_">SeqSearch</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">int</span>[] arr = {<span class="number">1</span>,<span class="number">9</span>,<span class="number">11</span>,-<span class="number">1</span>,<span class="number">34</span>,<span class="number">89</span>};<span class="comment">//没有顺序的数组</span></span><br><span class="line"> System.out.println(<span class="string">"目标值的下标:"</span>+seqSearch(arr, <span class="number">11</span>));</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 class="doctag">@param</span> arr 需要在这里面找目标值的数组</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> value 目标值</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">public</span> <span class="keyword">static</span> <span class="type">int</span> <span class="title function_">seqSearch</span><span class="params">(<span class="type">int</span>[] arr,<span class="type">int</span> value)</span>{</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < arr.length; i++) {</span><br><span class="line"> <span class="keyword">if</span>(arr[i] == value){</span><br><span class="line"> <span class="keyword">return</span> i;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> -<span class="number">1</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-二分查找算法"><a href="#3-二分查找算法" class="headerlink" title="3.二分查找算法"></a>3.二分查找算法</h3><h4 id="3-1-图解"><a href="#3-1-图解" class="headerlink" title="3.1 图解"></a>3.1 图解</h4><img src="/pictures/image-20230529104112317.png" alt="image-20230529104112317" style="zoom:150%;" />
|
||
|
||
<h4 id="3-2-代码实现"><a href="#3-2-代码实现" class="headerlink" title="3.2 代码实现"></a>3.2 代码实现</h4><p><em><strong>递归的方式解决</strong></em></p>
|
||
<p><strong>基本的写法</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.search;</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/29</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">class</span> <span class="title class_">BinarySearch</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">int</span>[] arr = {<span class="number">1</span>, <span class="number">8</span>, <span class="number">10</span>, <span class="number">89</span>, <span class="number">1000</span>, <span class="number">1234</span>};</span><br><span class="line"> System.out.println(<span class="string">"目标值的下标:"</span> + binarySearch(arr, <span class="number">0</span>, arr.length - <span class="number">1</span>, <span class="number">3</span>));</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 class="doctag">@param</span> arr 需要在这里面查找目标值的数组</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> left 左边的索引</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> right 右边的索引</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> findVal 要查找的值</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 目标值在数组中的下标,找到就返回下标,没有就返回-1</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="type">int</span> <span class="title function_">binarySearch</span><span class="params">(<span class="type">int</span>[] arr, <span class="type">int</span> left, <span class="type">int</span> right, <span class="type">int</span> findVal)</span> {</span><br><span class="line"> <span class="comment">//结束递归的条件</span></span><br><span class="line"> <span class="keyword">if</span> (left > right) {</span><br><span class="line"> <span class="keyword">return</span> -<span class="number">1</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="type">int</span> <span class="variable">mid</span> <span class="operator">=</span> (left + right) / <span class="number">2</span>;</span><br><span class="line"> <span class="type">int</span> <span class="variable">midVal</span> <span class="operator">=</span> arr[mid];</span><br><span class="line"> <span class="keyword">if</span> (findVal > midVal) {<span class="comment">//向右递归</span></span><br><span class="line"> <span class="keyword">return</span> binarySearch(arr, mid + <span class="number">1</span>, right, findVal);</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (findVal < midVal) {<span class="comment">//向左递归</span></span><br><span class="line"> <span class="keyword">return</span> binarySearch(arr, left, mid - <span class="number">1</span>, findVal);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="keyword">return</span> mid;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<p><strong>完整的代码</strong></p>
|
||
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.search;</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> 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/29</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">class</span> <span class="title class_">BinarySearch</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="type">int</span>[] arr = {<span class="number">1</span>, <span class="number">8</span>, <span class="number">10</span>, <span class="number">89</span>, <span class="number">1000</span>, <span class="number">1234</span>};</span><br><span class="line"> System.out.println(<span class="string">"目标值的下标:"</span> + binarySearch(arr, <span class="number">0</span>, arr.length - <span class="number">1</span>, <span class="number">3</span>));</span><br><span class="line"> <span class="type">int</span>[] arr2 = {<span class="number">1</span>, <span class="number">8</span>, <span class="number">10</span>, <span class="number">89</span>, <span class="number">89</span>, <span class="number">89</span>, <span class="number">1000</span>, <span class="number">1234</span>};</span><br><span class="line"> System.out.println(<span class="string">"目标值在数组中下标的集合:"</span> + binarySearch2(arr2, <span class="number">0</span>, arr2.length - <span class="number">1</span>, <span class="number">89</span>));</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 class="doctag">@param</span> arr 需要在这里面查找目标值的数组</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> left 左边的索引</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> right 右边的索引</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> findVal 要查找的值</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 目标值在数组中的下标,找到就返回下标,没有就返回-1</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="type">int</span> <span class="title function_">binarySearch</span><span class="params">(<span class="type">int</span>[] arr, <span class="type">int</span> left, <span class="type">int</span> right, <span class="type">int</span> findVal)</span> {</span><br><span class="line"> <span class="comment">//结束递归的条件</span></span><br><span class="line"> <span class="keyword">if</span> (left > right) {</span><br><span class="line"> <span class="keyword">return</span> -<span class="number">1</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="type">int</span> <span class="variable">mid</span> <span class="operator">=</span> (left + right) / <span class="number">2</span>;</span><br><span class="line"> <span class="type">int</span> <span class="variable">midVal</span> <span class="operator">=</span> arr[mid];</span><br><span class="line"> <span class="keyword">if</span> (findVal > midVal) {<span class="comment">//向右递归</span></span><br><span class="line"> <span class="keyword">return</span> binarySearch(arr, mid + <span class="number">1</span>, right, findVal);</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (findVal < midVal) {<span class="comment">//向左递归</span></span><br><span class="line"> <span class="keyword">return</span> binarySearch(arr, left, mid - <span class="number">1</span>, findVal);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="keyword">return</span> mid;</span><br><span class="line"> }</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 class="doctag">@param</span> arr 需要在这里面查找目标值的数组</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> left 左边的索引</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> right 右边的索引</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> findVal 要查找的的值</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">public</span> <span class="keyword">static</span> List<Integer> <span class="title function_">binarySearch2</span><span class="params">(<span class="type">int</span>[] arr, <span class="type">int</span> left, <span class="type">int</span> right, <span class="type">int</span> findVal)</span> {</span><br><span class="line"> <span class="comment">//结束递归的条件</span></span><br><span class="line"> <span class="keyword">if</span> (left > right) {</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> }</span><br><span class="line"> <span class="type">int</span> <span class="variable">mid</span> <span class="operator">=</span> (left + right) / <span class="number">2</span>;</span><br><span class="line"> <span class="type">int</span> <span class="variable">midVal</span> <span class="operator">=</span> arr[mid];</span><br><span class="line"> <span class="keyword">if</span> (findVal > midVal) {<span class="comment">//向右递归</span></span><br><span class="line"> <span class="keyword">return</span> binarySearch2(arr, mid + <span class="number">1</span>, right, findVal);</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (findVal < midVal) {<span class="comment">//向左递归</span></span><br><span class="line"> <span class="keyword">return</span> binarySearch2(arr, left, mid - <span class="number">1</span>, findVal);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> List<Integer> resList = <span class="keyword">new</span> <span class="title class_">ArrayList</span><>();</span><br><span class="line"> <span class="type">int</span> <span class="variable">temp</span> <span class="operator">=</span> mid - <span class="number">1</span>;</span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) { <span class="comment">//向左边探测相同值的元素</span></span><br><span class="line"> <span class="keyword">if</span> (temp < <span class="number">0</span> || arr[temp] != findVal) {</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//否则就把temp放入到集合中</span></span><br><span class="line"> resList.add(temp);</span><br><span class="line"> temp--;<span class="comment">//左移</span></span><br><span class="line"> }</span><br><span class="line"> resList.add(mid);</span><br><span class="line"> <span class="comment">//向右边探测</span></span><br><span class="line"> temp = mid + <span class="number">1</span>;</span><br><span class="line"> <span class="keyword">while</span> (<span class="literal">true</span>) { <span class="comment">//向右边探测相同值的元素</span></span><br><span class="line"> <span class="keyword">if</span> (temp > arr.length - <span class="number">1</span> || arr[temp] != findVal) {</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//否则就把temp放入到集合中</span></span><br><span class="line"> resList.add(temp);</span><br><span class="line"> temp++;<span class="comment">//右移</span></span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> resList;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="4-插值查找算法"><a href="#4-插值查找算法" class="headerlink" title="4.插值查找算法"></a>4.插值查找算法</h3><h4 id="4-1-图解"><a href="#4-1-图解" class="headerlink" title="4.1 图解"></a>4.1 图解</h4><p><img src="/pictures/image-20230530101020552.png"></p>
|
||
<img src="/pictures/image-20230530101803392.png" alt="image-20230530101803392" style="zoom:200%;" />
|
||
|
||
<h4 id="4-2-代码实现"><a href="#4-2-代码实现" class="headerlink" title="4.2 代码实现"></a>4.2 代码实现</h4><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.search;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Arrays;</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="keyword">public</span> <span class="keyword">class</span> <span class="title class_">InsertValueSearch</span> {</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> {</span><br><span class="line"> <span class="comment">//创建一个数组 用于模拟需要查找数据的数组</span></span><br><span class="line"> <span class="type">int</span>[] arr = <span class="keyword">new</span> <span class="title class_">int</span>[<span class="number">100</span>];</span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i < <span class="number">100</span>; i++) {</span><br><span class="line"> arr[i] = i + <span class="number">1</span>;</span><br><span class="line"> }</span><br><span class="line"> System.out.println(Arrays.toString(arr));</span><br><span class="line"> System.out.println(<span class="string">"查找的数的下标为:"</span> + insertValueSearch(arr, <span class="number">0</span>, arr.length - <span class="number">1</span>, <span class="number">30</span>));</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 class="doctag">@param</span> arr 目标数组(有序的)等差序列的最好,1-100有序的数组,找一个数只用找一次就行了</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> left 左边索引</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> right 右边索引</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> findVal 需要查找的值</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">public</span> <span class="keyword">static</span> <span class="type">int</span> <span class="title function_">insertValueSearch</span><span class="params">(<span class="type">int</span>[] arr, <span class="type">int</span> left, <span class="type">int</span> right, <span class="type">int</span> findVal)</span> {</span><br><span class="line"> System.out.println(<span class="string">"方法被调用了"</span>);</span><br><span class="line"> <span class="comment">//退出的条件和防止数组越界</span></span><br><span class="line"> <span class="keyword">if</span> (left > right || findVal < arr[<span class="number">0</span>] || findVal > arr[arr.length - <span class="number">1</span>]) {</span><br><span class="line"> <span class="keyword">return</span> -<span class="number">1</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//求出mid,这个是插值查找算法的灵魂,自适应的查找</span></span><br><span class="line"> <span class="type">int</span> <span class="variable">mid</span> <span class="operator">=</span> left + (right - left) * (findVal - arr[left]) / (arr[right] - arr[left]);</span><br><span class="line"> <span class="type">int</span> <span class="variable">midVal</span> <span class="operator">=</span> arr[mid];</span><br><span class="line"> <span class="keyword">if</span> (findVal > midVal) { <span class="comment">//应向右递归</span></span><br><span class="line"> <span class="keyword">return</span> insertValueSearch(arr, mid + <span class="number">1</span>, right, findVal);</span><br><span class="line"> } <span class="keyword">else</span> <span class="keyword">if</span> (findVal < midVal) {<span class="comment">//向左边递归</span></span><br><span class="line"> <span class="keyword">return</span> insertValueSearch(arr, left, mid - <span class="number">1</span>, findVal);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> <span class="keyword">return</span> mid;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
||
|
||
<h4 id="4-3-注意事项"><a href="#4-3-注意事项" class="headerlink" title="4.3 注意事项"></a>4.3 注意事项</h4><p><img src="/pictures/image-20230530105652529.png" alt="image-20230530105652529"></p>
|
||
<h3 id="5-斐波那契(黄金分割法)查找算法"><a href="#5-斐波那契(黄金分割法)查找算法" class="headerlink" title="5.斐波那契(黄金分割法)查找算法"></a>5.斐波那契(黄金分割法)查找算法</h3><h4 id="5-1-基本介绍-1"><a href="#5-1-基本介绍-1" class="headerlink" title="5.1 基本介绍"></a>5.1 基本介绍</h4><img src="/pictures/image-20230530110145048.png" alt="image-20230530110145048" style="zoom:150%;" />
|
||
|
||
<h4 id="5-2-原理介绍"><a href="#5-2-原理介绍" class="headerlink" title="5.2 原理介绍"></a>5.2 原理介绍</h4><p><img src="/pictures/image-20230530110511769.png" alt="image-20230530110511769"></p>
|
||
<hr>
|
||
<h2 id="PDF笔记"><a href="#PDF笔记" class="headerlink" title="PDF笔记"></a>PDF笔记</h2>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/尚硅谷图解Java数据结构和算法.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>数据结构与算法</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>MySQL5.7安装教程</title>
|
||
<url>/posts/17259.html</url>
|
||
<content><![CDATA[<h2 id="1-下载的地址"><a href="#1-下载的地址" class="headerlink" title="1.下载的地址"></a>1.下载的地址</h2><p>下载之后直接解压使用(下载之前看电脑上有没有mysql的服务,如果有先删除),解压的文件路径最好不要有中文</p>
|
||
<p>查看的方式</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">Win + R 输入 services.msc 回车打开 找是否有一个名为mysqld的服务</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>删除的指令</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">sc delete mysql</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>Mysql5.7地址:<a href="https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19-winx64.zip">https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19-winx64.zip</a></p>
|
||
<h2 id="2-配置环境变量"><a href="#2-配置环境变量" class="headerlink" title="2.配置环境变量"></a>2.配置环境变量</h2><p>添加环境变量 : 电脑-属性-高级系统设置-环境变量,在Path 环境变量增加mysql的安装目录\bin目录</p>
|
||
<h2 id="3-在mysql的安装目录下创建my-ini文件"><a href="#3-在mysql的安装目录下创建my-ini文件" class="headerlink" title="3.在mysql的安装目录下创建my.ini文件"></a>3.在mysql的安装目录下创建my.ini文件</h2><p><img src="/pictures/image-20230312152323079.png" alt="image-20230312152323079"></p>
|
||
<p>my.ini</p>
|
||
<figure class="highlight ini"><table><tr><td class="code"><pre><span class="line"><span class="section">[client]</span></span><br><span class="line"><span class="attr">port</span>=<span class="number">3306</span></span><br><span class="line"><span class="attr">default-character-set</span>=utf8</span><br><span class="line"><span class="section">[mysqld]</span></span><br><span class="line"><span class="comment"># 设置为自己MYSQL的安装目录</span></span><br><span class="line"><span class="attr">basedir</span>=C:\mysql\mysql-<span class="number">5.7</span>.<span class="number">19</span>-winx64\</span><br><span class="line"><span class="comment"># 设置为MYSQL的数据目录,这个目录系统帮我们创建</span></span><br><span class="line"><span class="attr">datadir</span>=C:\mysql\mysql-<span class="number">5.7</span>.<span class="number">19</span>-winx64\data\</span><br><span class="line"><span class="attr">port</span>=<span class="number">3306</span></span><br><span class="line"><span class="attr">character_set_server</span>=utf8</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">#skip-grant-tables</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="4-下载服务和初始化数据库"><a href="#4-下载服务和初始化数据库" class="headerlink" title="4.下载服务和初始化数据库"></a>4.下载服务和初始化数据库</h2><p>1.下载mysql的服务</p>
|
||
<p> 使用<strong>管理员身份</strong>打开 cmd , 并切换到mysql-5.7.19-winx64\bin 目录下, 执行 mysqld -install</p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">cd **/**/**/mysql-5.7.19-winx64\bin</span><br><span class="line">mysqld -install</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>2.初始化数据 </p>
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">mysqld --initialize-insecure --user=mysql</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="5-启动和停止mysql的服务"><a href="#5-启动和停止mysql的服务" class="headerlink" title="5.启动和停止mysql的服务"></a>5.启动和停止mysql的服务</h2><figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">#开启mysql的服务</span><br><span class="line">net start mysql</span><br><span class="line">#停止mysql的服务</span><br><span class="line">net stop mysql</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="6-修改账户和密码"><a href="#6-修改账户和密码" class="headerlink" title="6.修改账户和密码"></a>6.修改账户和密码</h2><figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">#9. 进入mysql 管理终端: 初次登录没有密码,直接按两下回车键进入</span><br><span class="line">mysql -u root -p</span><br><span class="line">进入之后执行:</span><br><span class="line">use mysql;</span><br><span class="line">update user set authentication_string=password('123456') where user='root' and Host='localhost';</span><br><span class="line">flush privileges; #刷新权限</span><br><span class="line">quit #退出</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>注释掉my.ini中的跳过权限检查 #skip-grant-tables </p>
|
||
<h2 id="7-重启mysql的服务"><a href="#7-重启mysql的服务" class="headerlink" title="7.重启mysql的服务"></a>7.重启mysql的服务</h2><figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">net stop mysql</span><br><span class="line">net start mysql</span><br><span class="line">mysql -u root -p #输入刚才设置的密码进入mysql服务</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>安装失败,删除服务,重新安装</p>
|
||
<h2 id="8-可视化工具"><a href="#8-可视化工具" class="headerlink" title="8.可视化工具"></a>8.可视化工具</h2><p>推荐SQLyog Navicat </p>
|
||
<p><a href="https://wwvc.lanzouy.com/iJTRn0wwz9fe">网盘地址</a></p>
|
||
<h2 id="PDF版本的教程-来源于韩顺平教育-转载注明出处"><a href="#PDF版本的教程-来源于韩顺平教育-转载注明出处" class="headerlink" title="PDF版本的教程(来源于韩顺平教育,转载注明出处)"></a>PDF版本的教程(来源于韩顺平教育,转载注明出处)</h2>
|
||
|
||
<div class="row">
|
||
<embed src="/pdf/MySQL5.7.19安装.pdf" width="100%" height="550" type="application/pdf">
|
||
</div>
|
||
|
||
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>Mysql</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>常用的DOS命令</title>
|
||
<url>/posts/51007.html</url>
|
||
<content><![CDATA[<h3 id="1-一些基础的DOS命令"><a href="#1-一些基础的DOS命令" class="headerlink" title="1.一些基础的DOS命令"></a>1.一些基础的DOS命令</h3><figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">c:\javacode>dir //查看C盘javacode目录下有那些文件</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">c:\javacode>cd /D d: //从C盘切换到D盘</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">c:\javacode>help cd //解释cd是怎么使用的</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">c:\javacode>cd .. //切换到上一级目录</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">c:\javacode>cd \ //切换到根目录</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">C:\tree c:\javacode //查看C盘下的子目录javacode下面的所有子目录,形成一个目录树</span><br></pre></td></tr></table></figure>
|
||
|
||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">>cls //清空所有内容,清屏</span><br><span class="line">>exit //退出控制台</span><br><span class="line">md[创建目录],rd[删除目录],copy[拷贝文件],del[删除文件],echo[输入内容到文件],type,move[剪切] </span><br><span class="line">>echo ok >pic.txt //创建pic.txt并把ok输入到pic.txt中</span><br><span class="line">>echo nul >pic.txt //创建一个空文件pic.txt</span><br><span class="line">>copy ok.txt d:\ok.txt //把ok.txt从当前路径拷贝到D盘下面,可以更改第二个ok.txt的文件名</span><br><span class="line">>move ok.txt d:\ok.txt //把ok.txt剪切到D盘下面</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="2-网络编程相关的DOS命令"><a href="#2-网络编程相关的DOS命令" class="headerlink" title="2.网络编程相关的DOS命令"></a>2.网络编程相关的DOS命令</h3><figure class="highlight dos"><table><tr><td class="code"><pre><span class="line">//获取IP相关的信息</span><br><span class="line">><span class="built_in">ipconfig</span></span><br><span class="line">//端口监听和网络监听情况</span><br><span class="line">>netstat -an</span><br><span class="line">>netstat -an | <span class="built_in">more</span>//分页显示</span><br><span class="line">>netstat -anb</span><br><span class="line">//<span class="built_in">ping</span>命令,查看网络是否连通</span><br><span class="line">><span class="built_in">ping</span> IP地址或者域名</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="3-MySql的相关DOS命令"><a href="#3-MySql的相关DOS命令" class="headerlink" title="3.MySql的相关DOS命令"></a>3.MySql的相关DOS命令</h3><figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">//开启MySQL和关闭MySQL服务</span><br><span class="line">>net start mysql //开</span><br><span class="line">>new stop mysql //关</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">//登录mysql的命令</span><br><span class="line">>mysql -u 用户名 -p密码 //密码可以先不输入,直接回车输入,或者直接写在p的后面,中间不要空格</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">//连接mysql服务(mysql数据库)的指令</span><br><span class="line">>mysql -h 主机ip -P端口 -u 用户名 -p密码</span><br><span class="line">//tips:</span><br><span class="line"> //p和密码中间不要有空格</span><br><span class="line"> //-p后面没有密码的话,会让回车的时候输入密码</span><br><span class="line"> //如果没有写-h主机,默认就是本机</span><br><span class="line"> //如果没有写-P端口,默认就是3306</span><br><span class="line"> //在实际的工作中端口一般会修改,使用3306这一端口,容易被黑客发现并攻击</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">//备份数据库的命令</span><br><span class="line"> //备份整个数据库</span><br><span class="line">>mysqldump -u root -p -B 数据库 数据库 > c:\\test\\bak.sql</span><br><span class="line"> //备份数据库的某个表</span><br><span class="line">>mysqldump -u root -p 数据库 表1 表2 表n > c:\\test\\bak.sql </span><br><span class="line">//这里就是把数据库hsp_db02 和数据库hsp_db03备份在C盘下面test目录中一个叫bak.sql的文件中,这里备份的是sql语句</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">//根据备份的文件,恢复数据库</span><br><span class="line">//第一种方式</span><br><span class="line">>source c:\\test\\bak.sql //根据C盘下面的c:\\test\\bak.sql的文件恢复数据库</span><br><span class="line">//第二种方式</span><br><span class="line">//直接把这个.sql的文件再执行一遍,就会恢复两个数据库了</span><br><span class="line"></span><br></pre></td></tr></table></figure>
|
||
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>常用命令</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>常用正则表达式大全</title>
|
||
<url>/posts/47003.html</url>
|
||
<content><![CDATA[<p>一、校验数字的表达式<br>1 数字:^[0-9]$<br>2 n位的数字:^\d{n}$<br>3 至少n位的数字:^\d{n,}$<br>4 m-n位的数字:^\d{m,n}$<br>5 零和非零开头的数字:^(0|[1-9][0-9])$<br>6 非零开头的最多带两位小数的数字:^([1-9][0-9])+(.[0-9]{1,2})?$<br>7 带1-2位小数的正数或负数:^(-)?\d+(.\d{1,2})?$<br>8 正数、负数、和小数:^(-|+)?\d+(.\d+)?$<br>9 有两位小数的正实数:^[0-9]+(.[0-9]{2})?$<br>10 有1~3位小数的正实数:^[0-9]+(.[0-9]{1,3})?$<br>11 非零的正整数:^[1-9]\d$ 或 ^([1-9][0-9]){1,3}$ 或 ^+?[1-9][0-9]$<br>12 非零的负整数:^-[1-9][]0-9”$ 或 ^-[1-9]\d$<br>13 非负整数:^\d+$ 或 ^[1-9]\d|0$<br>14 非正整数:^-[1-9]\d|0$ 或 ^((-\d+)|(0+))$<br>15 非负浮点数:^\d+(.\d+)?$ 或 ^[1-9]\d.\d|0.\d[1-9]\d|0?.0+|0$<br>16 非正浮点数:^((-\d+(.\d+)?)|(0+(.0+)?))$ 或 ^(-([1-9]\d.\d|0.\d[1-9]\d))|0?.0+|0$<br>17 正浮点数:^[1-9]\d.\d|0.\d[1-9]\d$ 或 ^(([0-9]+.[0-9][1-9][0-9])|([0-9][1-9][0-9].[0-9]+)|([0-9][1-9][0-9]))$<br>18 负浮点数:^-([1-9]\d.\d|0.\d[1-9]\d)$ 或 ^(-(([0-9]+.[0-9][1-9][0-9])|([0-9][1-9][0-9].[0-9]+)|([0-9][1-9][0-9])))$<br>19 浮点数:^(-?\d+)(.\d+)?$ 或 ^-?([1-9]\d.\d|0.\d[1-9]\d|0?.0+|0)$</p>
|
||
<p>二、校验字符的表达式<br>1 汉字:^[\u4e00-\u9fa5]{0,}$<br>2 英文和数字:^[A-Za-z0-9]+$ 或 ^[A-Za-z0-9]{4,40}$<br>3 长度为3-20的所有字符:^.{3,20}$<br>4 由26个英文字母组成的字符串:^[A-Za-z]+$<br>5 由26个大写英文字母组成的字符串:^[A-Z]+$<br>6 由26个小写英文字母组成的字符串:^[a-z]+$<br>7 由数字和26个英文字母组成的字符串:^[A-Za-z0-9]+$<br>8 由数字、26个英文字母或者下划线组成的字符串:^\w+$ 或 ^\w{3,20}$<br>9 中文、英文、数字包括下划线:^[\u4E00-\u9FA5A-Za-z0-9_]+$<br>10 中文、英文、数字但不包括下划线等符号:^[\u4E00-\u9FA5A-Za-z0-9]+$ 或 ^[\u4E00-\u9FA5A-Za-z0-9]{2,20}$<br>11 可以输入含有^%&’,;=?$"等字符:[^%&’,;=?$\x22]+<br>12 禁止输入含有<del>的字符:[^</del>\x22]+</p>
|
||
<p>三、特殊需求表达式<br>1 Email地址:^\w+([-+.]\w+)@\w+([-.]\w+).\w+([-.]\w+)$<br>2 域名:[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(/.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+/.?<br>3 InternetURL:[a-zA-z]+://[^\s] 或 ^https://([\w-]+.)+[\w-]+(/[\w-./?%&=])?$<br>4 手机号码:^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$<br>5 电话号码(“XXX-XXXXXXX”、”XXXX-XXXXXXXX”、”XXX-XXXXXXX”、”XXX-XXXXXXXX”、”XXXXXXX”和”XXXXXXXX):^((\d{3,4}-)|\d{3.4}-)?\d{7,8}$<br>6 国内电话号码(0511-4405222、021-87888822):\d{3}-\d{8}|\d{4}-\d{7}<br>7 身份证号:<br> 15或18位身份证:^\d{15}|\d{18}$<br> 15位身份证:^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$<br> 18位身份证:^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{4}$<br>8 短身份证号码(数字、字母x结尾):^([0-9]){7,18}(x|X)?$ 或 ^\d{8,18}|[0-9x]{8,18}|[0-9X]{8,18}?$<br>9 帐号是否合法(字母开头,允许5-16字节,允许字母数字下划线):^[a-zA-Z][a-zA-Z0-9_]{4,15}$<br>10 密码(以字母开头,长度在6~18之间,只能包含字母、数字和下划线):^[a-zA-Z]\w{5,17}$<br>11 强密码(必须包含大小写字母和数字的组合,不能使用特殊字符,长度在8-10之间):^(?=.\d)(?=.[a-z])(?=.[A-Z]).{8,10}$<br>12 日期格式:^\d{4}-\d{1,2}-\d{1,2}<br>13 一年的12个月(01~09和1~12):^(0?[1-9]|1[0-2])$<br>14 一个月的31天(01~09和1~31):^((0?[1-9])|((1|2)[0-9])|30|31)$<br>15 钱的输入格式:<br>16 1.有四种钱的表示形式我们可以接受:”10000.00” 和 “10,000.00”, 和没有 “分” 的 “10000” 和 “10,000”:^[1-9][0-9]$<br>17 2.这表示任意一个不以0开头的数字,但是,这也意味着一个字符”0”不通过,所以我们采用下面的形式:^(0|[1-9][0-9])$<br>18 3.一个0或者一个不以0开头的数字.我们还可以允许开头有一个负号:^(0|-?[1-9][0-9])$<br>19 4.这表示一个0或者一个可能为负的开头不为0的数字.让用户以0开头好了.把负号的也去掉,因为钱总不能是负的吧.下面我们要加的是说明可能的小数部分:^[0-9]+(.[0-9]+)?$<br>20 5.必须说明的是,小数点后面至少应该有1位数,所以”10.”是不通过的,但是 “10” 和 “10.2” 是通过的:^[0-9]+(.[0-9]{2})?$<br>21 6.这样我们规定小数点后面必须有两位,如果你认为太苛刻了,可以这样:^[0-9]+(.[0-9]{1,2})?$<br>22 7.这样就允许用户只写一位小数.下面我们该考虑数字中的逗号了,我们可以这样:^[0-9]{1,3}(,[0-9]{3})(.[0-9]{1,2})?$<br>23 8.1到3个数字,后面跟着任意个 逗号+3个数字,逗号成为可选,而不是必须:^([0-9]+|[0-9]{1,3}(,[0-9]{3}))(.[0-9]{1,2})?$<br>24 备注:这就是最终结果了,别忘了”+”可以用””替代如果你觉得空字符串也可以接受的话(奇怪,为什么?)最后,别忘了在用函数时去掉去掉那个反斜杠,一般的错误都在这里<br>25 xml文件:^([a-zA-Z]+-?)+[a-zA-Z0-9]+\.[x|X][m|M][l|L]$<br>26 中文字符的正则表达式:[\u4e00-\u9fa5]<br>27 双字节字符:[^\x00-\xff] (包括汉字在内,可以用来计算字符串的长度(一个双字节字符长度计2,ASCII字符计1))<br>28 空白行的正则表达式:\n\s\r (可以用来删除空白行)<br>29 HTML标记的正则表达式:<(\S?)[^>]>.?|<.? /> (网上流传的版本太糟糕,上面这个也仅仅能部分,对于复杂的嵌套标记依旧无能为力)<br>30 首尾空白字符的正则表达式:^\s|\s$或(^\s)|(\s$) (可以用来删除行首行尾的空白字符(包括空格、制表符、换页符等等),非常有用的表达式)<br>31 腾讯QQ号:[1-9][0-9]{4,} (腾讯QQ号从10000开始)<br>32 中国邮政编码:[1-9]\d{5}(?!\d) (中国邮政编码为6位数字)<br>33 IP地址:\d+.\d+.\d+.\d+ (提取IP地址时有用)</p>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>正则表达式</tag>
|
||
</tags>
|
||
</entry>
|
||
<entry>
|
||
<title>IDEA常用快捷键</title>
|
||
<url>/posts/63724.html</url>
|
||
<content><![CDATA[<h3 id="1-常用快捷键"><a href="#1-常用快捷键" class="headerlink" title="1.常用快捷键"></a>1.常用快捷键</h3><ol>
|
||
<li><p>在写一个main主函数的时候可以直接在键盘上敲main ,然后根据提示补全全部(模板快捷键)</p>
|
||
</li>
|
||
<li><p>在写System.out.println();输出函数代码的时候可以直接在键盘上面敲sout,然后根据提示补全(模板快捷键)</p>
|
||
</li>
|
||
<li><p>在写for循环的时候,我们可以直接在键盘上面打出 fori 然后根据提示补全代码(模板快捷键)</p>
|
||
</li>
|
||
<li><p>删除当前行 Ctrl+D (并非默认Ctrl + D,默认为Ctrl + Y),需要我们自己设置</p>
|
||
</li>
|
||
<li><p>复制当前行,快速向下复制一行 Ctrl + Alt + 向下箭头(并非默认,需要我们自己设置)</p>
|
||
</li>
|
||
<li><p>代码补全 Alt + /</p>
|
||
</li>
|
||
<li><p>添加注释和取消注释 Ctrl + /</p>
|
||
</li>
|
||
<li><p>自动导入import java.util.Scanner;我们在键盘上敲Scanner in = new Scanner(System,in);的时候按快捷键Alt + Enter 可以自动导入import java.util.Scanner;</p>
|
||
</li>
|
||
<li><p>代码格式化(格式调整为正常格式,,让代码变整洁,并非删除代码) Ctrl + Alt +L</p>
|
||
</li>
|
||
<li><p>快速运行程序(并非默认,需要我们自己设置)Alt + R,如果要使用这个快捷键,我们要切换到当前的主类,否则运行的还是之前运行的程序</p>
|
||
</li>
|
||
<li><p>构造器快捷键 Alt + insert ,按住Ctrl可以选择任意个参数的构造器,也可以点击Select None选择无参构造器; 我们在写一个私有类的getXxx()和setXxx()方法的时候,我们可以使用这个快捷键,光标移动到”Getter and Setter“的位置并选择。</p>
|
||
</li>
|
||
<li><p>查看一个类的层级关系 Ctrl + H</p>
|
||
</li>
|
||
<li><p>将光标放在一个方法上,使用快捷键 Ctrl + B 可以快速定位到这个方法的代码</p>
|
||
</li>
|
||
<li><p>我们在键盘上面敲Scanner in = new Scanner(System.in);的时候,我们先敲new Scanner(System.in),再在后面加上new Scanner(System.in).var,按Enter,就会自动补全前面的代码;定义一个Person类对象的时候我们也可以使用这种方法,如new Person().var,按Enter,就会自动补全前面的代码,变成 Person person = new Person();</p>
|
||
</li>
|
||
<li><p>重写某个方法的时候我们可以直接打出这个方法名,然后根据提示,移动光标选择。</p>
|
||
</li>
|
||
<li><p>Alt+insert移动光标选择toString,可以重写toString方法,并输出对象的属性。</p>
|
||
</li>
|
||
<li><p>断点调试的快捷键:F7(跳入),F8(跳过),shift+F8(跳出),F9(resume,执行到下一个断点)</p>
|
||
<p> F7:跳入方法内</p>
|
||
<p> F8:逐行执行代码</p>
|
||
<p> shift+F8:跳出方法</p>
|
||
</li>
|
||
<li><p>一个普通类实现接口,就必须将该接口的所有方法都实现,我们在实现这些接口的时候可以使用快捷键Alt+Enter</p>
|
||
</li>
|
||
<li><p>Ctrl+Alt+t 可以快捷的使用try-catch</p>
|
||
</li>
|
||
<li><p>遍历一个数组,生成while循环,可以快捷生成,快捷键是 itit + 回车 ,增强的for循环的迭代器的快捷输入 是大写的 I + enter</p>
|
||
</li>
|
||
<li><p>Ctrl + J 可以显示所有的快捷模板</p>
|
||
</li>
|
||
<li><p>Ctrl + R 查找替换</p>
|
||
</li>
|
||
<li><p>Shift+Enter 快速向下换一行</p>
|
||
</li>
|
||
<li><p>Shift+Home 快速选中一行</p>
|
||
</li>
|
||
<li><p>Ctrl + F 全局查找</p>
|
||
</li>
|
||
</ol>
|
||
]]></content>
|
||
<categories>
|
||
<category>后端</category>
|
||
</categories>
|
||
<tags>
|
||
<tag>快捷键</tag>
|
||
</tags>
|
||
</entry>
|
||
</search>
|