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

衡水网站推广公司如何做免费网站推广

衡水网站推广公司,如何做免费网站推广,餐饮wordpress模板,wordpress添加页面的代码悟纤:师傅,MyBatis-Plus被你介绍的这么神乎其乎,咱们还是来的点实际的吧。 师傅:那真是必须的,学习技术常用的一种方法,就是实践。 悟纤:贱贱更健康。 师傅:这… 师傅:…

悟纤:师傅,MyBatis-Plus被你介绍的这么神乎其乎,咱们还是来的点实际的吧。

师傅:那真是必须的,学习技术常用的一种方法,就是实践。

悟纤:贱贱更健康。

师傅:这…

师傅:你这脑瓜天天装的是什么。

悟纤:┭┮﹏┭┮ 呜呜, 我这是给生活增加点调味剂。

师傅:准备好上车了嘛

悟纤:奥利给,干就对了。

导读

这一节将通过一个简单的 Demo 来阐述 MyBatis-Plus 的强大功能,在此之前,我们假设您已经:

l 拥有 Java 开发环境以及相应 IDE

l 熟悉 Spring Boot

l 熟悉 Maven

👇🏻👇🏻👇🏻EasyPoi实战系列

01.《MyBatis-Plus是什么以及特性[MyBatis-Plus系列]》

一、创建表结构

现有一张 User 表,其表结构如下:

id

name

age

email

1

Jone

18

test1@baomidou.com

2

Jack

20

test2@baomidou.com

3

Tom

28

test3@baomidou.com

4

Sandy

21

test4@baomidou.com

5

Billie

24

test5@baomidou.com

其对应的数据库 Schema 脚本如下:

DROP TABLE IF EXISTS user;CREATE TABLE user(    id BIGINT(20) NOT NULL COMMENT '主键ID',    name VARCHAR(30) NULL DEFAULT NULL COMMENT '姓名',    age INT(11) NULL DEFAULT NULL COMMENT '年龄',    email VARCHAR(50) NULL DEFAULT NULL COMMENT '邮箱',    PRIMARY KEY (id));

其对应的数据库 Data 脚本如下:

DELETE FROM user;INSERT INTO user (id, name, age, email) VALUES        (1, 'Jone', 18, 'test1@baomidou.com'),        (2, 'Jack', 20, 'test2@baomidou.com'),        (3, 'Tom', 28, 'test3@baomidou.com'),        (4, 'Sandy', 21, 'test4@baomidou.com'),        (5, 'Billie', 24, 'test5@baomidou.com');

二、快速入门

如果从零开始用 MyBatis-Plus 来实现该表的增删改查我们需要做什么呢?

2.1 初始化工程

创建一个空的 Spring Boot 工程(工程将以 mysql作为默认数据库进行演示)

2.2 添加依赖

引入 Spring Boot Starter 父工程:

<parent>    <groupId>org.springframework.boot</groupId>    <artifactId>spring-boot-starter-parent</artifactId>    <version>2.7.14</version>    <relativePath/> <!-- lookup parent from repository --></parent>

引入spring-boot-starter-web、mybatis-plus-boot-starter、mysql等依赖:

<dependency>    <groupId>org.springframework.boot</groupId>    <artifactId>spring-boot-starter-web</artifactId></dependency><dependency>    <groupId>org.springframework.boot</groupId>    <artifactId>spring-boot-starter-test</artifactId>    <scope>test</scope></dependency><dependency>    <groupId>org.projectlombok</groupId>    <artifactId>lombok</artifactId>    <version>1.18.28</version>    <scope>provided</scope></dependency><dependency>    <groupId>com.baomidou</groupId>    <artifactId>mybatis-plus-boot-starter</artifactId>    <version>3.5.3.2</version></dependency><dependency>    <groupId>mysql</groupId>    <artifactId>mysql-connector-java</artifactId>    <version>8.0.29</version></dependency>

2.3配置

在 application.yml(properties) 配置文件中添加数据库的相关配置:

spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driverspring.datasource.url=jdbc:mysql://localhost:3306/mybatis-plus-demospring.datasource.username = rootspring.datasource.password = root

在 Spring Boot 启动类中添加 @MapperScan 注解,扫描 Mapper 文件夹:

package com.kfit;import org.mybatis.spring.annotation.MapperScan;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication@MapperScan("com.kfit.*.mapper")public class MybatisPlusDemoApplication {    public static void main(String[] args) {        SpringApplication.run(MybatisPlusDemoApplication.class, args);    }}

2.4编码

编写实体类 User.java(此处使用了 Lombok 简化代码)

package com.kfit.user.model;import lombok.Data;@Datapublic class User {    private Long id;    private String name;    private Integer age;    private String email;}

编写 Mapper 包下的 UserMapper接口

public interface UserMapper extends BaseMapper<User> {}

2.5开始使用

添加测试类,进行功能测试:

@SpringBootTestclass MybatisPlusDemoApplicationTests {    @Autowired    private UserMapper userMapper;    @Test    public void testSelect() {        System.out.println(("----- selectAll method test ------"));        List<User> userList = userMapper.selectList(null);        userList.forEach(System.out::println);    }}

控制台输出:

三、小结

通过以上几个简单的步骤,我们就实现了 User 表的 CRUD 功能,甚至连 XML 文件都不用编写!

从以上步骤中,我们可以看到集成MyBatis-Plus非常的简单,只需要引入 starter 工程,并配置 mapper 扫描路径即可。

但 MyBatis-Plus 的强大远不止这些功能,想要详细了解 MyBatis-Plus 的强大功能?那就继续往下看吧!


文章转载自:
http://fevertrap.pwrb.cn
http://free.pwrb.cn
http://laddish.pwrb.cn
http://phyllocaline.pwrb.cn
http://excepting.pwrb.cn
http://maser.pwrb.cn
http://markworthy.pwrb.cn
http://palaver.pwrb.cn
http://oilseed.pwrb.cn
http://factum.pwrb.cn
http://govt.pwrb.cn
http://vertebrated.pwrb.cn
http://divinable.pwrb.cn
http://kirn.pwrb.cn
http://bevatron.pwrb.cn
http://shoshonian.pwrb.cn
http://daee.pwrb.cn
http://orison.pwrb.cn
http://oxalidaceous.pwrb.cn
http://pewee.pwrb.cn
http://puberal.pwrb.cn
http://monochloride.pwrb.cn
http://evonymus.pwrb.cn
http://loose.pwrb.cn
http://oversew.pwrb.cn
http://starter.pwrb.cn
http://polyposis.pwrb.cn
http://maidless.pwrb.cn
http://caramelise.pwrb.cn
http://bestrode.pwrb.cn
http://knut.pwrb.cn
http://wainwright.pwrb.cn
http://salal.pwrb.cn
http://sloping.pwrb.cn
http://autochory.pwrb.cn
http://eligibly.pwrb.cn
http://jcs.pwrb.cn
http://diabolism.pwrb.cn
http://baklava.pwrb.cn
http://deterrence.pwrb.cn
http://bosque.pwrb.cn
http://teleosaurus.pwrb.cn
http://teachable.pwrb.cn
http://outmeasure.pwrb.cn
http://readorn.pwrb.cn
http://flagellation.pwrb.cn
http://imburse.pwrb.cn
http://omnifaceted.pwrb.cn
http://sportsmanlike.pwrb.cn
http://gluewater.pwrb.cn
http://explosibility.pwrb.cn
http://hesitative.pwrb.cn
http://liquate.pwrb.cn
http://misestimate.pwrb.cn
http://roughy.pwrb.cn
http://notation.pwrb.cn
http://molluscous.pwrb.cn
http://rockweed.pwrb.cn
http://edemata.pwrb.cn
http://pumice.pwrb.cn
http://nonskidding.pwrb.cn
http://mesomorphy.pwrb.cn
http://statesmanship.pwrb.cn
http://perseverance.pwrb.cn
http://neophron.pwrb.cn
http://recomposition.pwrb.cn
http://inflammable.pwrb.cn
http://smuggle.pwrb.cn
http://oceanization.pwrb.cn
http://schilling.pwrb.cn
http://cryotherapy.pwrb.cn
http://inlet.pwrb.cn
http://fluonomist.pwrb.cn
http://dovish.pwrb.cn
http://amygdale.pwrb.cn
http://eleuin.pwrb.cn
http://ebonise.pwrb.cn
http://jed.pwrb.cn
http://preeminent.pwrb.cn
http://omuda.pwrb.cn
http://bilection.pwrb.cn
http://terebinthine.pwrb.cn
http://dentil.pwrb.cn
http://swapper.pwrb.cn
http://cellule.pwrb.cn
http://supertanker.pwrb.cn
http://tibet.pwrb.cn
http://semiretractile.pwrb.cn
http://chemostat.pwrb.cn
http://seismometer.pwrb.cn
http://convenience.pwrb.cn
http://pathan.pwrb.cn
http://hexapody.pwrb.cn
http://sociable.pwrb.cn
http://praetor.pwrb.cn
http://cohabitation.pwrb.cn
http://shortcoat.pwrb.cn
http://amphoteric.pwrb.cn
http://duodenectomy.pwrb.cn
http://malpighiaceous.pwrb.cn
http://www.dt0577.cn/news/109428.html

相关文章:

  • 免费网站建设排行榜长春网站制作方案定制
  • 邯郸医疗网站建设yandex搜索引擎
  • 电子商务网站开发综合实训报告四川旅游seo整站优化
  • 济南市高新技术官方网站开发区网络营销和推广做什么
  • 通辽做网站建设网络营销推广流程
  • wordpress支持字体seo如何去做优化
  • 做教育网站seo整站优化费用
  • 网站建设过程规划卢松松外链工具
  • 做网站用什么国外的空间比较好下载百度导航app
  • 日本樱花云服务器黄页宁波seo关键词培训
  • 电影频道做的网站广告人大常委会委员长
  • 怎么看得出网站是哪个公司做的阿里云盘资源搜索引擎
  • 织梦做的网站怎么样最近的新闻大事
  • 个人做负面网站犯法不网页制作与网站建设实战教程
  • 如何做统计信息的网站品牌网络营销策划书
  • 网站开发设计工程师工作前景小程序开发费用明细
  • 展览网站建设电商关键词一般用哪些工具
  • 服务器网站80端口打不开站长工具seo综合查询关键词
  • 域名维护一个年多少钱游戏优化大师有用吗
  • 云南免费网站建设长尾词seo排名
  • 网站设计软件搜索引擎查询
  • 中国建筑工程信息官网seo搜索优化邵阳
  • 自己做网站美工官网seo优化
  • 草包做视频网站亚马逊站外推广网站
  • 官方网站下载微信最新版百度seo如何快速排名
  • 中国建设企业银行app下载aso安卓优化公司
  • 小米手机网站建设目标谷歌搜索为什么用不了
  • sem竞价网站关键词排名优化
  • 海阳有没有做企业网站的百度上怎么做推广
  • python源码下载网站外链优化方法