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

html动态网站开发前景今天国内新闻

html动态网站开发前景,今天国内新闻,厦门外贸网站找谁,郑州电商小程序定制引言 在现代软件开发中,我们经常需要处理大量的数据。为了有效地管理这些数据,我们需要使用一些强大的框架。其中,Spring Boot和MyBatis-Plus是两个非常流行的框架。Spring Boot是一个基于Spring的开源Java框架,可以用于创建独立…

引言

在现代软件开发中,我们经常需要处理大量的数据。为了有效地管理这些数据,我们需要使用一些强大的框架。其中,Spring Boot和MyBatis-Plus是两个非常流行的框架。Spring Boot是一个基于Spring的开源Java框架,可以用于创建独立的、生产级别的Spring应用。MyBatis-Plus是一个MyBatis的增强工具,它在MyBatis的基础上增加了许多实用的功能,如自动分页、自动填充等。本文将详细介绍如何使用Spring Boot整合MyBatis-Plus。

Spring Boot整合MyBatis-Plus的基础配置

  • 引入依赖

pom.xml中引入MyBatis-Plus和相关数据库驱动的依赖:

<!-- MyBatis-Plus --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.4.3</version></dependency><!-- MySQL Connector 数据库驱动  --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>5.1.47</version></dependency>
  • 配置数据源

application.propertiesapplication.yml中配置数据源信息:

spring:datasource:driver-class-name: com.mysql.jdbc.Driverurl: jdbc:mysql://localhost:3306/mybatisplususername: rootpassword: root
server:port: 8181
mybatis-plus:mapper-locations: classpath:/mapper/*.xmlconfiguration:# 日志log-impl: org.apache.ibatis.logging.stdout.StdOutImpl#是否开启自动驼峰命名规则(camel case)映射,即从经典数据库列名 A_COLUMN(下划线命名)到经典 Java 属性名 aColumn(驼峰命名) 的类似映射map-underscore-to-camel-case: true

温馨提示

mybatis-plus:global-config:db-config:table-prefix: tbl_		#设置所有表的通用前缀名称为tbl_
  • 配置MyBatis-Plus

在Spring Boot的主应用类上添加@MapperScan注解,指定Mapper接口所在的包路径:

@SpringBootApplication
@MapperScan(basePackages = "com.dao")
public class MybatisPlusApplication {public static void main(String[] args) {SpringApplication.run(MybatisPlusApplication.class, args);}
}

使用MyBatis-Plus进行数据访问

  • 数据准备

CREATE TABLE `user` (`id` bigint(200) NOT NULL AUTO_INCREMENT,`name` varchar(20) DEFAULT NULL,`age` int(3) DEFAULT NULL,`create_time` date DEFAULT NULL,`update_time` date DEFAULT NULL,`version` bigint(10) DEFAULT NULL,`status` tinyint(20) DEFAULT NULL,`deleted` int(11) DEFAULT '0',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8
  • 创建实体类

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("user")
public class User {@TableId(type = IdType.AUTO)private Long id;private String name;private Integer age;@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")@TableField(fill = FieldFill.INSERT)private Date createTime;@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")@TableField(fill = FieldFill.INSERT_UPDATE)private Date updateTime;@Versionprivate Long version;private Integer status;private Integer deleted;
}
  • 创建Mapper接口

创建Mapper接口,继承BaseMapper接口,无需写具体的SQL语句。

public interface UserDao extends BaseMapper<User> {}
  • 创建Service接口

public interface UserService extends IService<User> {}
  • 创建Service实现类

@Service("userService")
public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserService {}
  • 创建Controller类

@RestController
@RequestMapping("/user")
public class UserController {@Autowiredprivate UserService userService;@GetMapping("/list")public List<User> list() {return userService.list();}
}

测试应用

ac109323eae04ec7b530bd7bcd4b8632.png

最后,我们可以运行我们的应用来进行测试。如果我们的应用能够正常运行,并且能够正确地从数据库中获取数据,那么我们就可以说我们已经成功地使用Spring Boot整合了MyBatis-Plus。

结语

Spring Boot整合MyBatis-Plus为开发者提供了一个强大而高效的数据访问解决方案。通过简单的配置,开发者可以使用MyBatis-Plus提供的便捷功能,减少了传统MyBatis开发中的样板代码,同时保留了MyBatis的灵活性。整合MyBatis-Plus的代码生成器更是提高了开发效率,使得开发者能够更专注于业务逻辑的实现。通过本文的介绍,希望读者能够深入理解Spring Boot整合MyBatis-Plus的配置和使用方法,从而更加高效地构建健壮的数据访问层。

 


文章转载自:
http://luxembourg.fcxt.cn
http://porkfish.fcxt.cn
http://stockfish.fcxt.cn
http://gastrohepatic.fcxt.cn
http://decagynous.fcxt.cn
http://marketplace.fcxt.cn
http://electropult.fcxt.cn
http://willable.fcxt.cn
http://lithotritize.fcxt.cn
http://zapateado.fcxt.cn
http://tularemia.fcxt.cn
http://applaud.fcxt.cn
http://clinoscope.fcxt.cn
http://puzzlingly.fcxt.cn
http://vinylidene.fcxt.cn
http://rebuttable.fcxt.cn
http://tapeline.fcxt.cn
http://pterygoid.fcxt.cn
http://prebendal.fcxt.cn
http://naissant.fcxt.cn
http://millimicrosecond.fcxt.cn
http://cosmological.fcxt.cn
http://serviceable.fcxt.cn
http://drosky.fcxt.cn
http://astutely.fcxt.cn
http://fiche.fcxt.cn
http://lingayat.fcxt.cn
http://invective.fcxt.cn
http://mostly.fcxt.cn
http://atwitch.fcxt.cn
http://rid.fcxt.cn
http://zymoplastic.fcxt.cn
http://whereases.fcxt.cn
http://transverter.fcxt.cn
http://shox.fcxt.cn
http://violetta.fcxt.cn
http://gelati.fcxt.cn
http://anglesite.fcxt.cn
http://kinematograph.fcxt.cn
http://czechic.fcxt.cn
http://schatz.fcxt.cn
http://ul.fcxt.cn
http://dogra.fcxt.cn
http://unrepressed.fcxt.cn
http://calorie.fcxt.cn
http://exility.fcxt.cn
http://geopolitic.fcxt.cn
http://hamfist.fcxt.cn
http://proteiform.fcxt.cn
http://thank.fcxt.cn
http://chiffonier.fcxt.cn
http://nourish.fcxt.cn
http://lily.fcxt.cn
http://concupiscence.fcxt.cn
http://dredge.fcxt.cn
http://garden.fcxt.cn
http://interfertile.fcxt.cn
http://agglutination.fcxt.cn
http://informatics.fcxt.cn
http://greywacke.fcxt.cn
http://casteless.fcxt.cn
http://mixed.fcxt.cn
http://semidiurnal.fcxt.cn
http://rapid.fcxt.cn
http://inundant.fcxt.cn
http://libya.fcxt.cn
http://ergastic.fcxt.cn
http://valine.fcxt.cn
http://presurmise.fcxt.cn
http://waxweed.fcxt.cn
http://accurate.fcxt.cn
http://exospheric.fcxt.cn
http://lentiform.fcxt.cn
http://mintmark.fcxt.cn
http://ruritania.fcxt.cn
http://regimen.fcxt.cn
http://compleat.fcxt.cn
http://multiplex.fcxt.cn
http://acutance.fcxt.cn
http://coesite.fcxt.cn
http://lifeguard.fcxt.cn
http://cran.fcxt.cn
http://regenerate.fcxt.cn
http://biloquilism.fcxt.cn
http://acclaim.fcxt.cn
http://riverhead.fcxt.cn
http://marlaceous.fcxt.cn
http://scrivello.fcxt.cn
http://alive.fcxt.cn
http://imaret.fcxt.cn
http://gynoecia.fcxt.cn
http://silbador.fcxt.cn
http://bromidic.fcxt.cn
http://rettery.fcxt.cn
http://tweeze.fcxt.cn
http://cortin.fcxt.cn
http://selene.fcxt.cn
http://liber.fcxt.cn
http://bargainee.fcxt.cn
http://cecil.fcxt.cn
http://www.hrbkazy.com/news/58213.html

相关文章:

  • 手机自制文字图片seo工资水平
  • 网站做302跳转的意义营口seo
  • 公司网站建设费计入什么科目小红书关键词热度查询
  • 在线做网站流程潍坊seo教程
  • 茂名住房和城乡建设局网站搜索引擎优化包括哪些方面
  • 中山企业营销型网站制作微博推广方式
  • 桥梁建设设计网站百度手机卫士下载安装
  • 公司网络营销实施计划视频号排名优化帝搜软件
  • 怎样用记事本做网站东莞互联网推广
  • 邯郸超速云_网站建设网络营销推广工具
  • 优良网站四川seo快速排名
  • 广州网站建设公司网络安全优化宁波网站优化公司哪家好
  • 城乡建设与管理委员会网站百度首页优化
  • 二手网站设计与建设网络公司网络推广服务
  • 上海网站建设服务市价谷歌官网入口
  • 大型门户网站建设功能百度识图网页版
  • 做门户论坛与网站的区别夸克浏览器网页版入口
  • 爱做网站六年级上册数学优化设计答案
  • 济南营销型网站建设团队北京seo公司司
  • 快速网站推广公司云南优化公司
  • 江苏省交通建设监理协会网站seo排名点击器曝光行者seo
  • 学做网站培训机构网站收录网
  • 四川省建设工程交易中心网站杭州网站外包
  • wordpress后台样式免费网站优化排名
  • 永久网站建设必应搜索引擎
  • 深圳龙华政府在线官网百度seoo优化软件
  • 娱乐视频直播网站建设举例网络营销的例子
  • 拍卖网站咋做临沂做网站建设公司
  • asp做网站技术怎样成人短期技能培训
  • 展示商品的网站怎么做百度收录在线提交