
数据库
成_蹉_跎
程序小白,在一步步成长,愿与君共同进步。个人笔记分享 https://gitee.com/nian_zuo_chen/chunlei-note
展开
-
MybatisPlus--5 删除
@RunWith(SpringRunner.class) @SpringBootTest public class TestDelete { @Autowired private EmployeeMapper employeeMapper; @Test public void testDeleteById() { int rows = empl...原创 2020-02-26 19:35:50 · 1014 阅读 · 0 评论 -
MybatisPlus--4 更新
updateById @RunWith(SpringRunner.class) @SpringBootTest public class TestUpdateById { @Autowired private EmployeeMapper employeeMapper; /** * updateById (Entity) 传递的是一个实体 * 按照实...原创 2020-02-26 19:34:41 · 287 阅读 · 0 评论 -
MybatisPlus--3.6 其他查询
包含: selectMaps 使用 数据库提供函数 selectObjs selectOne @RunWith(SpringRunner.class) @SpringBootTest public class TestOthers { @Autowired private EmployeeMapper employeeMapper; /** * selectM...原创 2020-02-26 19:32:00 · 360 阅读 · 0 评论 -
MybatisPlus--3.5 指定查询列
@RunWith(SpringRunner.class) @SpringBootTest public class TestSelectByWrapperSupper { @Autowired private EmployeeMapper employeeMapper; /** * 查询出指定列的数据 */ @Test public v...原创 2020-02-26 19:30:38 · 12098 阅读 · 0 评论 -
MybatisPlus--3.4 Lambda 查询
@RunWith(SpringRunner.class) @SpringBootTest public class TestLambdaWrapper { @Autowired private EmployeeMapper employeeMapper; /** * 使用 Lambda 构造器会防止错误书写,因为使用 get 方法的时候不会出现前面写字段名的过程...原创 2020-02-26 19:29:08 · 917 阅读 · 0 评论 -
MybatisPlus--3.3 动态条件查询
@RunWith(SpringRunner.class) @SpringBootTest public class TestCondition { @Autowired private EmployeeMapper employeeMapper; /** * 情景,多条件查询中,条件动态选择 */ @Test public void t...原创 2020-02-26 19:28:11 · 5100 阅读 · 1 评论 -
MybatisPlus--3.2 传入实体类查询
@RunWith(SpringRunner.class) @SpringBootTest public class TestSelectEntity { @Autowired private EmployeeMapper employeeMapper; /** * 创建条件构造器时传入实例对象 * 实例对象不为 null 的属性都将变成查询条件,拼接...原创 2020-02-26 19:27:02 · 4455 阅读 · 0 评论 -
Mybatisplus--3.1基本查询
包含对 limit、in 的使用 @RunWith(SpringRunner.class) @SpringBootTest public class TestMpSelect { @Autowired private EmployeeMapper employeeMapper; /** * 2.1 基本的查询方法 * 默认使用 and 进行连接的 ...原创 2020-02-26 19:26:05 · 490 阅读 · 0 评论 -
MybatisPlus--2.插入
@RunWith(SpringRunner.class) // 运行器,可以 SpringBoot 环境下运行 junit 测试 @SpringBootTest // 可以运行基于 SpringBoot 的测试 public class TestMpInsert { @Autowired private EmployeeMapper emplo...原创 2020-02-26 19:24:31 · 442 阅读 · 0 评论 -
MybatisPlus--1.准备
MyBatisPlus 只做增强不做改变,简化开发,提高生产力。 文档地址:https://mp.baomidou.com/guide/ 1. 添加依赖 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http...原创 2020-02-26 19:23:14 · 213 阅读 · 0 评论 -
PostgreSQL
PostgreSQL 是一个自由的对象-关系数据库服务器(数据库管理系统) 关系型数据库:Oracle、MySQL、SQLServer、PostgreSQL Ubuntu 安装 $ sudo atp-get install postgresql $ psql --version 1. psql 的基础 2. 数据库简单操作 3.写一个 SQL $ su postgres // 切换到默认...原创 2020-02-26 19:18:06 · 182 阅读 · 0 评论 -
sql语句
1.创建用户 : 先以root身份登录MySQL create uaer ‘username’@’host’ identified by ‘password’; localhost指的是用户只能在本地登陆,不能在另外一台机器远程登陆。像要远程登陆的话,把localhost改成%或者指定某台机器就好了。 host:指定该用户在哪个主机上可以登陆,如果是本地用户可用localhost,如果想让该用户可...原创 2019-01-03 23:51:27 · 179 阅读 · 0 评论 -
sql语句(MySQL)
基础 启动 mysql -hlocalhost -u用户名 -p密码 查看已创建数据库:show databases; 使用已创建的数据库:use database_name; 创建数据库:create database database_name; 删除已经创建的数据库: drop database database_name; 用得少,容易忘 修改表名:alter table table_ol...原创 2019-01-03 23:41:09 · 706 阅读 · 0 评论