- 浏览: 179761 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (225)
- 链接数据库 (1)
- Linux下面安装tomcat步骤 (1)
- 数据库简单添加索引 (1)
- Ubuntu 16.04安装jdk步骤 (1)
- Ubuntu 16.04安装mysql链接工具workbench (1)
- Java基础 (1)
- Java 获取两个时间的时间查 如 1 天 2 小时 30 分钟 (1)
- jdbc链接增删该查 (1)
- springboot 跨域解决 (1)
- springboot如何读取配置文件(application.yml)中的属性值 (1)
- springboot配置redis (1)
- 数据库访问优化法则 (1)
- springboot 配置定时任务 (1)
- 使用Spring Boot上传文件 (1)
- Java并发编程:Callable、Future和FutureTask (1)
- springboot配置所有信息demo (1)
- 常用软件地址 (1)
- Java DateUtil时间大全 (1)
- Java DateUtil当天,本周,本月时间获取方法 (1)
- @Data的用法 (1)
- 身份证工具类 (1)
- springboot添加日志 (1)
- List集合中的对象按照某个字段去重实现 (1)
- JavaBean和Map转换封装类 (1)
- StringUtils工具类用法 (1)
- BigDecimal用户详情 (1)
- java常用集合总结 (1)
- openfile 插件开发步骤 (0)
- Linux rpc客户端步骤 (1)
- Java开发必会的Linux命令 (1)
- springboot配置拦截器,控制登录跳转 (1)
- springboot 异步调用的方法 (0)
- springboot如何读取配置文件test.properties (1)
- springboot 异步调用的方法 (1)
- HttpClient操作,HttpPost (1)
- HttpGet (1)
- HttpDelete (1)
- HttpPut (1)
- mybatis生成代码后,想用自己的关联查询demo (1)
- Arrays工具类十大常用方法 (1)
- 如何生成唯一订单号 (1)
- 订单号唯一性 (1)
- msyql lest的用法 (1)
- //循环递归删除 (0)
- 循环递归删除 (1)
- java 属性首字母大写返回json解决办法 (1)
- 根据两点间经纬度坐标(double值),计算两点间距离,单位为米 (1)
- 运用开发好的jar部署到linux服务中 (1)
- mybatis批量新增 (1)
- mybatis 增删该查demo,新手必看 (1)
- java中字符串查找一个字符串的个数几种方法 (1)
- @Select in 的用法 (1)
- Ubuntu 16.04使用ieda简单配置 (1)
- 统计一个字符串中相应字符出现的次数 (1)
- SimpleDateFormat同步的解决办法 (1)
- gradle打包springboot jar例子 (1)
- java 提取字符串中的数字 (1)
- springboot 对像异常处理,还可以作为全部异常处理 (1)
- 面试题 (0)
- Linux下面安装virtualBox (1)
- java带有效期的map (1)
- 2018年JAVA基础面试题和高级面试题总结 (1)
- mysql修改密码的方法 (1)
- 排名前 16 的 Java 工具类 (1)
- 最完整的Linux常用命令大全 (1)
- Mysql 开发标准规范 (1)
- idea 快捷键 (1)
- mysql 建立索引 (1)
- Java中判断字符串是否为数字的五种方法 (1)
- springboot集成redis (1)
- springboot异步调用demo (1)
- springboot2集成redis (1)
- springboot2集成Elasticsearch (1)
- java过滤敏感字体的方式 (1)
- 对象的值赋给另一个对象 (1)
- mybitse+pagehelper 的使用方法 (1)
- java时间的处理 (1)
- xshell5 下载地址 (1)
- springboot2集成Excel (1)
- 检查数组是否包含某个值的方法 (1)
- 关于Java代码优化的N条建议! (1)
- Java Map按Key值进行排序 (1)
- List进行排序 (1)
- Stream 完整实例 (1)
- StringUtils isNoneBlank和isAnyBlank——demo (1)
- vim最全常用命令 (1)
- JWT生成Token (1)
- 学习参看地址 (1)
- java初始化数据 (1)
- 简单json (1)
- 数据库脚本 (1)
- restTemplate http请求 (1)
- 学习网站 (1)
- JsonUtil (1)
- Rsa (1)
- BeanUtils的赋值方法比较 (1)
- HttpClientUtil (2)
- ValidUtils (0)
- 读取excel,批量插入库demo (1)
- springboot对redis封装使用 (1)
- java后端简答验证码 (1)
- java高级面试题及其答案 (1)
- 序列换成json时 (1)
- 将所有的long变成string (1)
- ControllerAdvice (0)
- RedisService 工具类 (1)
- Java常用正则表达式验证工具类RegexUtils (1)
- CollectionUtil (1)
- thrift使用 (1)
- springboot播客学习 (1)
- mybitse 批量更新 (1)
- https://www.cnblogs.com/cxiaocai/p/11715874.html (1)
- elasticsearch安装及其head步骤 (0)
- elasticsearch7.6.2安装及其head、kibana、ik分词器步骤 (0)
- elasticsearch7.6.2集成springboot (0)
- gradle仓库选址 (1)
- elasticsearch7.6.2集成springboot2.2.6---2 (1)
- elasticsearch7.6.2安装及其head、kibana、ik分词器步骤-----1 (1)
- elasticsearch7.6.2集成springboot2.2.6基本语法---3 (1)
- Jsoup (1)
- elasticsearch7.6.2集成springboot2.2.6----demo (1)
- mybatis官网地址 (1)
- springboot发送邮件到qq (1)
- navicat Premium 链接sql Server的方法 (1)
- 简单开发springboot搭建 (1)
- sqlServer 查询两个小时的sql语句 (1)
- BigDecimalUtil (1)
- 雪花算法生成id (1)
- JsonUtils (1)
- Spring Boot监控与管理的实现 (1)
- springboot 使用undertow启动,替换tomcat (1)
- RedisConfig配置使用 (1)
- RedisUtil (1)
- easypoi读取excel (1)
- easyexcel读取excel (0)
- easyexcel读取excel与下载 (1)
- 生成指定长度的随机数 (1)
- Spring Boot AOP实战 (1)
- fastjsonfastjson新手必看 (1)
- 获取IP地址 (1)
- CommonUtils (1)
- 5万字长文:Stream和Lambda表达式最佳实践-附PDF下载 (1)
- DateUtils 最新工具类 (1)
- screw的使用 (1)
- 15000 字的 SQL 语句大全 (1)
- hutool (1)
- PdfToWord (1)
- MySQL修改最大连接数 (1)
- MAP排序 (1)
- 归纳从文件中读取数据的六种方法-JAVA IO基础总结 (1)
- 天气 (1)
- Intellij IDEA中Mybatis Mapper自动注入警告的6种解决方案 (1)
- 全网最全编程学习网站汇总来了,还不赶快收藏 (1)
- win10 (0)
- 电脑知识 (0)
- util工具类 (1)
- ieda提示mapper报错 (1)
- zysnba (1)
- 自增方式 (1)
- mybits链表查询 (1)
- SpringBoot如何优雅的处理校验参数 (1)
- 参考记录 (1)
- 企业微信封装方法 (1)
- 二维码 (1)
- mysql简单创建索引 (1)
- msyql函数 (1)
- mybitse-plus多表查询demo (1)
- git 提交本地代码步骤 (1)
- gradle5.X以上lombok引入 (1)
- SpringBoot定时任务及Cron表达式详解 (1)
- Hutool工具集之DateUtil(日期时间工具)详解使用 (1)
- 对象属性为空字符串变成null (1)
- DateUtils 工具类 (0)
- face++照片不对工具类 (1)
- 判断某个值是否在list集合中的某个对象中存在 (1)
- mybatisplus时间更新操作 (1)
- Java8 List通用方法处理总结 (0)
- 阿斯蒂芬 (0)
- springboot多数据源配置 (0)
- MyBatis和MyBatis-Plus 官网地址 (1)
- jwt (0)
- java---ValidUtils (1)
- Java之下载网络图片到本地文件夹 (1)
- 初始化内容数据 (1)
- springboot启动指定端口和启动环境 (1)
- 根据生日计算年龄 (1)
- idea快捷键大全 (1)
- springboot数据验证例子 (1)
- springboot文章 (1)
- 获取当前时间,推迟一年 (0)
- 获取当前时间,推迟一周 推迟一年示例 (1)
- ResultBean返回对象 (1)
- SpringBoot注解最全详解 (1)
- JeecgBoot (1)
- 电脑优化 (0)
- 简单数据队列 (1)
- CacheUtil换成工具类 (0)
- CacheUtil缓存工具类 (0)
- xml和对象互转 (0)
- 导出word (0)
- 企业微信通过code获取用户基本信息 (1)
- Java开发中的一些小技巧 (1)
- 判断当前时间是否在一个时间区间例如8点:21点 (1)
- springboot 启动指定环境 (1)
- 打印springboot启动的环境 (1)
- 根据时间日期获取当天是周几 (1)
- LocalDateTimeToString (1)
- java导出word (1)
- java 对xml和对象互转 (1)
- java CacheUtil缓存工具类 (1)
- 史上最牛逼电脑优化,让电脑飞起来 (1)
- isEmpty 和 isBlank 的用法区别 (1)
- 根据图片url地址获取其流InputStream (1)
- springboot解决LocalDateTime (1)
- springboot配置文件list映射 (1)
- SpringBoot中必须掌握的45个注解 (1)
- sql 优化的 15 个小技巧 (1)
- Cron表达式 (1)
- 数据库创建时间和修改时间默认值 (1)
- 小程序解析手机号 (1)
- 小程序获取手机号 (0)
- java 获取resource下面的文件路径,springboot打成jar也可以使用 (1)
- 数据库字段不显示对象和swwager前段不显示 (1)
- java生成pdf (1)
- springboot 异步调用 (1)
- java获取时间段内的每一天 (1)
- hutool----DateUtil简单的时间 (1)
- java 8两个List集合取交集、并集、差集、去重并集 (1)
- 服务调用demo (1)
- hutool导入excel (1)
- hutool导出 (1)
- 切面日志 (1)
- 校验参数为空 (1)
- 两个集合对象某一个属性相匹配 (1)
- JAVA stream流详细教程 (1)
- 查看java进程的命令 (1)
- Java 保留两位小数 百分数 (1)
- freemarker读写word模板生成word文档 (1)
- springboot项目中,读取 resources 目录下的文件的9种方式 (1)
- Knife4j (1)
- Java8 获取两个List交集 (1)
- list泛型和list对象交集 (1)
- 未来7天过生日的孩子sql (1)
- 数据校验,全局异常 (1)
- 获取最近10天过生日的sql (1)
- 随机数 (1)
- Java获取两个日期的天数打印 (1)
- 通过时间获取星期几 (1)
- Java时间类型相互转化 (2)
最新评论
1需要引入的jar
repositories {
// mavenCentral()
maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
//Hikaricp 代号光
implementation 'com.zaxxer:HikariCP:2.4.7'
//swagger
implementation 'io.springfox:springfox-swagger2:2.7.0'
implementation 'io.springfox:springfox-swagger-ui:2.7.0'
// mysql
implementation 'mysql:mysql-connector-java'
//mybatis
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.2'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
2配置文件
student.name=nba
student.age=23
swagger.enable=true
#\u65E5\u5FD7
#logging.file.path=./log/文件夹
logging.file=./log/logback.log
logging.level.root=info
logging.register-shutdown-hook=false
logging.config=classpath:logback-spring.xml
logging.file.name
## 数据库配置
#datasource
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/demo?useSSL=false&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=123456
## Hikari 连接池配置 ------ 详细配置请访问:https://github.com/brettwooldridge/HikariCP
## 最小空闲连接数量
spring.datasource.hikari.minimum-idle=5
## 空闲连接存活最大时间,默认600000(10分钟)
spring.datasource.hikari.idle-timeout=180000
## 连接池最大连接数,默认是15
spring.datasource.hikari.maximum-pool-size=15
## 此属性控制从池返回的连接的默认自动提交行为,默认值:true
spring.datasource.hikari.auto-commit=true
## 连接池名称
spring.datasource.hikari.pool-name=DatebookHikariCP
## 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
spring.datasource.hikari.max-lifetime=1800000
## 数据库连接超时时间,默认30秒,即30000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
#server http://localhost:8080/swagger-ui.html#/
server.port=8080
server.tomcat.max-threads=800
server.tomcat.uri-encoding=UTF-8
#mybatis
mybatis.type-aliases-package=com.test.entity
mybatis.mapper-locations=classpath:mapper/*.xml
3,log日志logback-spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration >
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}spring.log}"/>
<include resource="org/springframework/boot/logging/logback/file-appender.xml" />
<springProfile name="dev">
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />
<root level="INFO">
<appender-ref ref="FILE" /> <!--将日志输出到文件中-->
<appender-ref ref="CONSOLE" /> <!--将日志输出到控制台中-->
</root>
</springProfile>
<springProfile name="test">
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />
<root level="INFO">
<appender-ref ref="FILE" />
<appender-ref ref="CONSOLE" />
</root>
</springProfile>
<springProfile name="pro">
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />
<root level="INFO">
<appender-ref ref="FILE" />
<appender-ref ref="CONSOLE" />
</root>
</springProfile>
</configuration>
4加入Swagger
package com.test.config;
import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.ResponseEntity;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class Swagger2Config {
@Value("${swagger.enable}")
private boolean enableSwagger;
@Bean
public Docket createRestApi(){
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo()).securitySchemes(Lists.newArrayList(apiKey())).enable(enableSwagger)
.genericModelSubstitutes(ResponseEntity.class)
.select()
.apis(RequestHandlerSelectors.basePackage("com.test.controller"))
.paths(PathSelectors.any())
.build();
}
//token
private ApiKey apiKey(){
return new ApiKey("token", "authentication", "header");
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("gradle+springboot 整合swaager2 构建api文档")
.description("XXX科技有限公司 ,http://www.baidu.com/")
.termsOfServiceUrl("https://blog.csdn.net/u013783065")
.version("1.0")
.build();
}
}
5,dao接口
public interface UserInfoMapper {
int deleteByPrimaryKey(Integer id);
int insert(UserInfo record);
int insertSelective(UserInfo record);
UserInfo selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(UserInfo record);
int updateByPrimaryKey(UserInfo record);
}
5,mapper 文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.test.dao.UserInfoMapper">
<resultMap id="BaseResultMap" type="com.test.UserInfo">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="company_id" jdbcType="BIGINT" property="companyId" />
</resultMap>
<sql id="Base_Column_List">
id, user_id, name, code, company_id
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from user_info
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from user_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.etonkids.assets.entity.UserInfo">
insert into user_info (id, user_id, name,
code, company_id)
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{code,jdbcType=VARCHAR}, #{companyId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="com.etonkids.assets.entity.UserInfo">
insert into user_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="name != null">
name,
</if>
<if test="code != null">
code,
</if>
<if test="companyId != null">
company_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
#{companyId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.etonkids.assets.entity.UserInfo">
update user_info
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
company_id = #{companyId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.etonkids.assets.entity.UserInfo">
update user_info
set user_id = #{userId,jdbcType=BIGINT},
name = #{name,jdbcType=VARCHAR},
code = #{code,jdbcType=VARCHAR},
company_id = #{companyId,jdbcType=BIGINT}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
repositories {
// mavenCentral()
maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
//Hikaricp 代号光
implementation 'com.zaxxer:HikariCP:2.4.7'
//swagger
implementation 'io.springfox:springfox-swagger2:2.7.0'
implementation 'io.springfox:springfox-swagger-ui:2.7.0'
// mysql
implementation 'mysql:mysql-connector-java'
//mybatis
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.2'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
2配置文件
student.name=nba
student.age=23
swagger.enable=true
#\u65E5\u5FD7
#logging.file.path=./log/文件夹
logging.file=./log/logback.log
logging.level.root=info
logging.register-shutdown-hook=false
logging.config=classpath:logback-spring.xml
logging.file.name
## 数据库配置
#datasource
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/demo?useSSL=false&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=123456
## Hikari 连接池配置 ------ 详细配置请访问:https://github.com/brettwooldridge/HikariCP
## 最小空闲连接数量
spring.datasource.hikari.minimum-idle=5
## 空闲连接存活最大时间,默认600000(10分钟)
spring.datasource.hikari.idle-timeout=180000
## 连接池最大连接数,默认是15
spring.datasource.hikari.maximum-pool-size=15
## 此属性控制从池返回的连接的默认自动提交行为,默认值:true
spring.datasource.hikari.auto-commit=true
## 连接池名称
spring.datasource.hikari.pool-name=DatebookHikariCP
## 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
spring.datasource.hikari.max-lifetime=1800000
## 数据库连接超时时间,默认30秒,即30000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
#server http://localhost:8080/swagger-ui.html#/
server.port=8080
server.tomcat.max-threads=800
server.tomcat.uri-encoding=UTF-8
#mybatis
mybatis.type-aliases-package=com.test.entity
mybatis.mapper-locations=classpath:mapper/*.xml
3,log日志logback-spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration >
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}spring.log}"/>
<include resource="org/springframework/boot/logging/logback/file-appender.xml" />
<springProfile name="dev">
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />
<root level="INFO">
<appender-ref ref="FILE" /> <!--将日志输出到文件中-->
<appender-ref ref="CONSOLE" /> <!--将日志输出到控制台中-->
</root>
</springProfile>
<springProfile name="test">
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />
<root level="INFO">
<appender-ref ref="FILE" />
<appender-ref ref="CONSOLE" />
</root>
</springProfile>
<springProfile name="pro">
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />
<root level="INFO">
<appender-ref ref="FILE" />
<appender-ref ref="CONSOLE" />
</root>
</springProfile>
</configuration>
4加入Swagger
package com.test.config;
import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.ResponseEntity;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class Swagger2Config {
@Value("${swagger.enable}")
private boolean enableSwagger;
@Bean
public Docket createRestApi(){
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo()).securitySchemes(Lists.newArrayList(apiKey())).enable(enableSwagger)
.genericModelSubstitutes(ResponseEntity.class)
.select()
.apis(RequestHandlerSelectors.basePackage("com.test.controller"))
.paths(PathSelectors.any())
.build();
}
//token
private ApiKey apiKey(){
return new ApiKey("token", "authentication", "header");
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("gradle+springboot 整合swaager2 构建api文档")
.description("XXX科技有限公司 ,http://www.baidu.com/")
.termsOfServiceUrl("https://blog.csdn.net/u013783065")
.version("1.0")
.build();
}
}
5,dao接口
public interface UserInfoMapper {
int deleteByPrimaryKey(Integer id);
int insert(UserInfo record);
int insertSelective(UserInfo record);
UserInfo selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(UserInfo record);
int updateByPrimaryKey(UserInfo record);
}
5,mapper 文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.test.dao.UserInfoMapper">
<resultMap id="BaseResultMap" type="com.test.UserInfo">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="company_id" jdbcType="BIGINT" property="companyId" />
</resultMap>
<sql id="Base_Column_List">
id, user_id, name, code, company_id
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from user_info
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from user_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.etonkids.assets.entity.UserInfo">
insert into user_info (id, user_id, name,
code, company_id)
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{code,jdbcType=VARCHAR}, #{companyId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="com.etonkids.assets.entity.UserInfo">
insert into user_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="name != null">
name,
</if>
<if test="code != null">
code,
</if>
<if test="companyId != null">
company_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
#{companyId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.etonkids.assets.entity.UserInfo">
update user_info
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
company_id = #{companyId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.etonkids.assets.entity.UserInfo">
update user_info
set user_id = #{userId,jdbcType=BIGINT},
name = #{name,jdbcType=VARCHAR},
code = #{code,jdbcType=VARCHAR},
company_id = #{companyId,jdbcType=BIGINT}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
相关推荐
SpringBoot 是一款基于 Spring Framework 的轻量级框架,它简化了 Spring 应用的初始搭建以及开发过程。本篇文章将详细讲解如何利用 SpringBoot 搭建一个支持 JSP(JavaServer Pages)的 Web 应用。 1. **Spring ...
SpringBoot 基于 Spring 框架,旨在简化 Spring 应用的初始搭建以及开发过程。它通过自动配置、起步依赖和命令行接口等特性,让开发者能够快速构建可生产的 Spring 应用。 **三、SpringBoot 集成 Activiti** 1. **...
本内容发布系统采用流行的SpringBoot搭建,支持静态化、标签化建站。不需要专业的后台开发技能,会HTML就能建站,上手超简单;只需使用系统提供的标签就能轻松建设网站。全面支持各类表单字段,真正实现“0”代码...
在“SpringBoot简单搭建Demo”中,我们可以理解为这是一个演示如何使用SpringBoot快速构建应用的实例。以下是一些关于SpringBoot的关键知识点: 1. **起步依赖(Starter Dependencies)**:SpringBoot的核心特性之...
1. **起步依赖(Starter Dependencies)**:Spring Boot通过“起步依赖”提供了一种简单的方式来添加所需的库。例如,为了搭建数据库连接,我们可以添加`spring-boot-starter-data-jpa`依赖,这会自动引入JPA、...
### SpringBoot简单搭建教程 #### 一、SpringBoot概述与特点 **SpringBoot**是一个由Pivotal团队提供的全新框架,旨在简化新Spring应用的初始搭建以及开发过程。该框架使用了特定的方式(如通过约定优先于配置)来...
SpringBoot 是一个由 Pivotal 团队开发的框架,旨在简化 Spring 应用程序的初始搭建以及开发过程。它集成了大量常用的第三方库配置,如 JDBC、MongoDB、JPA、RabbitMQ、Quartz 等,使得开发者能够快速地创建一个独立...
【标题】"基于SpringBoot搭建的个人博客系统"揭示了这个项目的核心技术栈,即SpringBoot,这是一种由Pivotal团队提供的快速开发框架,用于简化Spring应用的初始搭建以及开发过程。SpringBoot通过自动化配置、内嵌式...
在本项目中,"springboot+netty开发简易式游戏源码"是一个使用Spring Boot和Netty框架构建的轻量级游戏服务器的示例。这个项目结合了两个强大的技术,旨在提供一个高效、可扩展的游戏后端解决方案。下面将详细阐述...
在本教程中,我们将深入探讨如何使用IntelliJ IDEA(简称Idea)搭建SpringBoot环境,并结合MyBatis框架和MySQL数据库实现数据的增、删、改、查操作。这个项目是一个非常适合初学者上手的实例,包含了所有必要的组件...
本话题主要探讨如何在IntelliJ IDEA(Idea)环境下,使用SpringBoot搭建基于SSM(Spring、SpringMVC、Mybatis)的传统架构,以及使用JPA(Java Persistence API)进行数据库操作,同时也会对比不使用SpringBoot搭建...
总的来说,"springboot搭建简单增删查改"这个项目涵盖了Spring Boot的基础使用,数据库连接,以及基本的Web开发流程。通过学习和实践这个项目,初学者能够掌握Spring Boot的基本概念,以及如何构建一个简单的CRUD...
本文将深入探讨如何使用Vue UI与SpringBoot搭建一个完整的项目框架。 Vue.js是一个轻量级的JavaScript框架,它以组件化、易学习、高性能著称。Vue UI则是基于Vue.js的一系列UI组件库,它提供了丰富的界面元素,帮助...
现在,让我们一起按照以下步骤来搭建这个简单的SpringBoot+MybatisPlus项目。 首先,我们需要创建一个新的Maven项目。在IntelliJ IDEA中,选择"New Project",然后选择"Maven"并填写项目的GroupId、ArtifactId和...
SpringBoot框架简单搭建并运行是初学者和开发者进入微服务开发领域的常见步骤。Spring Boot是由Pivotal Team创建的一个框架,旨在简化Spring应用的初始搭建以及开发过程,它集成了大量常用的第三方库配置,如数据源...
SpringBoot和Mybatis是Java开发中的两个重要框架,SpringBoot简化了Spring应用的初始搭建以及开发过程,而Mybatis则是一个轻量级的持久层框架,专注于SQL映射。本项目是一个适合初学者理解这两种技术如何结合使用的...
在这个项目中,我们将学习如何使用SpringBoot来搭建一个简单的应用程序。 首先,我们需要在本地环境中安装Java开发工具(JDK),因为SpringBoot是建立在Java平台上的。确保你的系统已安装了JDK 8或更高版本,并正确...
该项目利用了基于springboot + vue + mysql的开发模式框架实现的课设系统,包括了项目的源码资源、sql文件、相关指引文档等等。 【项目资源】:包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理...
SpringBoot 是一个由 Pivotal 团队开发的框架,旨在简化 Spring 应用的初始搭建以及开发过程。它集成了大量常用的第三方库配置,如 JDBC、MongoDB、JPA、RabbitMQ、Quartz 等,让你可以快速地创建一个独立运行的、...
SpringBoot简化了Spring应用的初始搭建以及开发过程,通过内嵌Tomcat服务器、自动配置Spring组件以及一系列starter,使得开发者可以快速构建出可部署的应用程序。在本项目中,SpringBoot作为基础框架,提供了快速...