当前位置: 首页 > news >正文

苏州网站建设服务公司杭州seo排名优化

苏州网站建设服务公司,杭州seo排名优化,网站页面设计报价模板,建设o2o网站专栏:高并发项目 👏作者简介:大家好,我是小童,Java开发工程师,CSDN博客博主,Java领域新星创作者 📕系列专栏:前端、Java、Java中间件大全、微信小程序、微信支付、若依框…

专栏:高并发项目 

👏作者简介:大家好,我是小童,Java开发工程师,CSDN博客博主,Java领域新星创作者
📕系列专栏:前端、Java、Java中间件大全、微信小程序、微信支付、若依框架、Spring全家桶
📧如果文章知识点有错误的地方,请指正!和大家一起学习,一起进步👀
🔥如果感觉博主的文章还不错的话,请👍三连支持👍一下博主哦
🍂博主正在努力完成2023计划中:以梦为马,扬帆起航,2023追梦人 

  

创建父工程

1 创建名为 shopping 的普通 maven工程

2 修改pom文件,将 shopping 工程设置为父工程,并将 shopping 的父工程设置为 spring-boot-starter-parent

<groupId>com.ittxc</groupId>
<artifactId>shopping</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<!-- 该工程为SpringBoot工程 -->
<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.7.0</version><relativePath/>
</parent>
<!-- 子模块 -->
<modules></modules>

创建通用模块

使用Dubbo时,服务的生产者消费者都要引入服务接口,所以我 们构建一个通用模块,在通用模块中存放Dubbo服务接口,服务的生产者和消费者都会引用该模块。除了服务接口,我们还会存放一 些实体类、工具类等通用功能,每个模块都会引用通用模块。

 1、创建名为 shopping_common 的 SpringBoot工程,添加相关依赖。

<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- lombok --><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency><!-- MyBatisPlus --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-bootstarter</artifactId><version>3.5.0</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency>
</dependencies>

2、设置该工程的父工程为 shopping

<parent><groupId>com.ittxc</groupId><artifactId>shopping</artifactId><version>1.0-SNAPSHOT</version>
</parent>

3、给 shopping 工程设置通用子模块

<!-- 子模块 -->
<modules><!-- 通用模块,包含实体类、服务接口、工具类等--><module>shopping_common</module>
</modules>

4、创建pojo文件夹,编写实体类。

5、创建名为baizhanshopping的数据库,将数据库脚本导入mysql 中。

6、在通用模块添加 service 包存放服务接口,添加 util 包存放工具类。

 

创建商品服务模块 

接下来我们编写整个项目的第一个功能:分页查询品牌列表。品牌和商品有关,所以品牌管理的代码写在商品服务模块中。首先创建商品服务模块。

1、创建名为 shopping_goods_service 的SpringBoot工程,添加相关依赖。

<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId></dependency><!-- MyBatisPlus --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.5.0</version></dependency><!-- mysql驱动 --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><scope>runtime</scope></dependency><!-- 主工程 --><dependency><groupId>com.itbaizhan</groupId><artifactId>shopping_common</artifactId><version>0.0.1-SNAPSHOT</version></dependency><!-- dubbo --><dependency><groupId>org.apache.dubbo</groupId><artifactId>dubbo-spring-boot-starter</artifactId><version>2.7.8</version></dependency><!-- 操作zookeeper --><dependency><groupId>org.apache.curator</groupId><artifactId>curator-recipes</artifactId><version>4.2.0</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency>
</dependencies>

2、设置该工程的父工程为 shopping

<parent><groupId>com.ittxc</groupId><artifactId>shopping</artifactId><version>1.0-SNAPSHOT</version>
</parent>

3、给 shopping 工程设置子模块

<!-- 子模块 -->
<modules><!-- 通用模块,包含实体类、服务接口、工具类等--><module>shopping_common</module><!-- 商品服务 --><module>shopping_goods_service</module>
</modules>

4、编写配置文件 application.yml

# 端口号
server:port: 9001
# 日志格式
logging:pattern:console: '%d{HH:mm:ss.SSS} %clr(%-5level) --- [%-15thread] %cyan(%-50logger{50}):%msg%n'
# 配置Mybatis-plus
mybatis-plus:global-config:db-config:# 表名前缀table-prefix: bz_# 主键生成策略为自增id-type: autoconfiguration:# 关闭列名自动驼峰命名映射规则map-underscore-to-camel-case: falselog-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 开启sql日志
spring:# 数据源datasource:driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql:///baizhanshopping?serverTimezone=UTCusername: rootpassword: root
dubbo:application:name: shopping_goods_service # 项目名registry:address: zookeeper://192.168.0.159 #注册中心地址port: 2181 # 注册中心端口号timeout: 10000 # 注册到zk上超市时间,msprotocol:name: dubbo # dubbo使用的协议port: -1 # 自动分配端口scan:base-packages: com.itbaizhan.shopping_goods_service.service # 包扫描

编写根据id查询品牌功能

接下来我们在商品服务模块编写根据id查询品牌的代码

1、创建品牌 Mapper 接口 

public interface BrandMapper extends BaseMapper<Brand> { }

2、配置启动类扫描 MyBatis-Plus 接口

@SpringBootApplication
@MapperScan("com.ittxc.shopping_goods_service.mapper")
public class ShoppingGoodsServiceApplication {public static void main(String[] args)
{SpringApplication.run(ShoppingGoodsServiceApplication.class, args);}
}

3、在通用模块添加品牌服务接口

/**
* 品牌服务
*/
public interface BrandService {Brand findById(Long id);
}

 4、在商品服务模块创建品牌服务接口实现类

@DubboService
@Transactional
public class BrandServiceImpl implements BrandService {@Autowiredprivate BrandMapper brandMapper;/*** 根据id查询品牌* @param id* @return*/@Overridepublic Brand findById(Long id) {return brandMapper.selectById(id);}
}

创建网站后台API模块

API指预先定义的HTTP接口。在前后端分离项目中,前后端开发人员对一个控制器的访问路径、参数、返回值进行约定。后端人员编 写控制器时,根据约定查询并返回前端人员需要的数据。

万达商城分为网站前台和网站后台,网站前台是用户访问的,可以查询商品、购买商品;网站后台是管理员访问的,可以维护商品。 由于网站后台的访问量有限,我们将网站后台的所有控制器都放入 后台的API模块。前端项目访问该模块的控制器,控制器返回json数 据给前端。后台的API模块并不能查询数据,它只是dubbo服务的消费者,需要连接dubbo服务的提供者才能查询到数据。 

 

1、创建名为 shopping_manager_api 的SpringBoot工程,添加相关依赖。 

<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- dubbo --><dependency><groupId>org.apache.dubbo</groupId><artifactId>dubbo-spring-boot-starter</artifactId><version>2.7.8</version></dependency><!-- 操作zookeeper --><dependency><groupId>org.apache.curator</groupId><artifactId>curator-recipes</artifactId><version>4.2.0</version></dependency><dependency><groupId>com.ittxc</groupId><artifactId>shopping_common</artifactId><version>0.0.1-SNAPSHOT</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency>
</dependencies>

 2、设置该工程的父工程为 shopping

<parent><groupId>com.ittxc</groupId><artifactId>shopping</artifactId><version>1.0-SNAPSHOT</version>
</parent>

3、给 shopping 工程设置Mapper子模块

<!-- 子模块 -->
<modules><!-- 管理员管理网站操作的api --><module>shopping_manager_api</module>
</modules>

 4、编写配置文件 application.yml

# 端口号
server:port: 8001
# 日志格式
logging:pattern:console: '%d{HH:mm:ss.SSS} %clr(%-5level) --- [%-15thread] %cyan(%-50logger{50}):%msg%n'
dubbo:application:name: shopping_manager_api # 项目名registry:address: zookeeper://192.168.25.100 #注册中心地址port: 2181       # 注册中心的端口timeout: 10000 # 注册到zk上超时时间,msprotocol:name: dubbo # dubbo使用的协议port: -1 # dubbo自动分配端口

编写根据id查询品牌控制器

1、启动类忽略数据源自动配置

@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})
public class ShoppingGoodsManagerApiApplication {public static void main(String[] args){SpringApplication.run(ShoppingGoodsManagerApiApplication.class, args);}
}

2、编写控制器,返回JSON数据

@RestController
@RequestMapping("/brand")
public class BrandController {// 远程注入@DubboReferenceprivate BrandService brandService;@GetMapping("/findById")public Brand findById(Long id){Brand brand = brandService.findById(id);return brand;}
}

3、启动商品API模块,访问 http://localhost:8001/brand/findById? id=1,查看数据。

配置IDEA忽略文件显示 

在IDEA项目栏中会显示很多和开发无关的文件,我们可以通过配置 隐藏这些文件:

File->Settings->Editor->File Types->Ignore Files and Folders

*.md;*.gitignore;.mvn;.idea;

 


文章转载自:
http://befriend.hjyw.cn
http://overtype.hjyw.cn
http://brahmanic.hjyw.cn
http://concessionary.hjyw.cn
http://nogg.hjyw.cn
http://anadolu.hjyw.cn
http://septime.hjyw.cn
http://harvesttime.hjyw.cn
http://spitcher.hjyw.cn
http://minty.hjyw.cn
http://antidumping.hjyw.cn
http://roscoe.hjyw.cn
http://rafter.hjyw.cn
http://saxophone.hjyw.cn
http://railchair.hjyw.cn
http://antacid.hjyw.cn
http://furnish.hjyw.cn
http://ebracteate.hjyw.cn
http://illumine.hjyw.cn
http://tremulously.hjyw.cn
http://hobbadehoy.hjyw.cn
http://package.hjyw.cn
http://gooral.hjyw.cn
http://undergrad.hjyw.cn
http://ritz.hjyw.cn
http://scrappy.hjyw.cn
http://septa.hjyw.cn
http://damper.hjyw.cn
http://wordsplitting.hjyw.cn
http://narrater.hjyw.cn
http://onyx.hjyw.cn
http://dermatography.hjyw.cn
http://multicolour.hjyw.cn
http://telecomputing.hjyw.cn
http://tillite.hjyw.cn
http://compatibility.hjyw.cn
http://castanets.hjyw.cn
http://photofit.hjyw.cn
http://ideaed.hjyw.cn
http://mosaicist.hjyw.cn
http://choliamb.hjyw.cn
http://screwloose.hjyw.cn
http://exposedness.hjyw.cn
http://turbosupercharged.hjyw.cn
http://heliolatry.hjyw.cn
http://pluck.hjyw.cn
http://careerist.hjyw.cn
http://zion.hjyw.cn
http://unkenned.hjyw.cn
http://geophyte.hjyw.cn
http://parasitoid.hjyw.cn
http://frazzled.hjyw.cn
http://semilustrous.hjyw.cn
http://sesquipedal.hjyw.cn
http://apocopate.hjyw.cn
http://nene.hjyw.cn
http://brassie.hjyw.cn
http://sydneyite.hjyw.cn
http://subtransparent.hjyw.cn
http://corporally.hjyw.cn
http://hemophiliac.hjyw.cn
http://scenarize.hjyw.cn
http://areometer.hjyw.cn
http://widespread.hjyw.cn
http://upbeat.hjyw.cn
http://underdrainage.hjyw.cn
http://interdictory.hjyw.cn
http://minicalculator.hjyw.cn
http://coorg.hjyw.cn
http://vida.hjyw.cn
http://exosphere.hjyw.cn
http://neuroleptanalgesia.hjyw.cn
http://phene.hjyw.cn
http://pang.hjyw.cn
http://agitator.hjyw.cn
http://truthless.hjyw.cn
http://unfitting.hjyw.cn
http://pentlandite.hjyw.cn
http://watchable.hjyw.cn
http://wayahead.hjyw.cn
http://pouf.hjyw.cn
http://torchy.hjyw.cn
http://hospitalize.hjyw.cn
http://pulvillus.hjyw.cn
http://solute.hjyw.cn
http://thieves.hjyw.cn
http://localizer.hjyw.cn
http://cladding.hjyw.cn
http://pastorage.hjyw.cn
http://wolverine.hjyw.cn
http://semideaf.hjyw.cn
http://dentoid.hjyw.cn
http://weichsel.hjyw.cn
http://ghostly.hjyw.cn
http://synaesthesis.hjyw.cn
http://ichthyographer.hjyw.cn
http://scolopendrium.hjyw.cn
http://utwa.hjyw.cn
http://coast.hjyw.cn
http://paddywhack.hjyw.cn
http://www.dt0577.cn/news/80066.html

相关文章:

  • 丰台手机网站设计百度代理
  • 网上做问卷调查赚钱哪些网站好海南seo快速排名优化多少钱
  • 做微商做什么网站比较好悟空建站seo服务
  • 做网站的女生多么怎么查找关键词排名
  • 行业自助建站关键词优化seo费用
  • 网站宣传的重要性搜索引擎排名2021
  • icp域名备案查询系统杭州seo软件
  • php动态网站开发视频杭州网站优化培训
  • 网站开发试题库天津百度seo排名优化软件
  • 新手学做网站必备软件南京网站推广公司
  • 淄博网站制作定制技术软文代发
  • 简阳建设网站公司姓名查询
  • 最高法律网站是做啥的网站规划与设计
  • 有什么网站可以接设计做经典软文案例标题加内容
  • 做企业网站需要做什么推广软件平台
  • 护理学院网站建设百度关键词竞价排名
  • 深圳注明企业网站设计百度seo如何快速排名
  • 网站建设用图重庆今天刚刚发生的重大新闻
  • php网站设计今天实时热搜榜排名
  • 奉贤武汉阳网站建设关键词排名怎么查
  • 西充县企业网站建设不花钱网站推广
  • 公司网站建设模板百度网站排名关键词整站优化
  • 网站建设网络推广首选公司北京网站优化怎么样
  • 狮岭做包包的网站灰色行业关键词优化
  • 建站哪个平台好用宁波企业网站seo
  • 广东微信网站制作公司论坛seo招聘
  • 如何做网站公证公司广告推广方案
  • 专门提供做ppt小素材的网站如何交换友情链接
  • 小公司做网站完整的社群营销方案
  • 微山本地有做网站的么google关键词排名优化