Commit 03bd84cb by flying-cattle

Merge branch 'mybatisPlus' of…

Merge branch 'mybatisPlus' of https://github.com/flying-cattle/mybatis-dsc-generator.git into mybatisPlus
parents cac8068f 7faa83f4
# mybatis-dsc-generato
<p align="center">
<img src="https://oscimg.oschina.net/oscnet/7bccb4d805f683659d4f0ab1ef1a85edaa3.jpg" ></img>
</p>
<p align="center">
<a target="_blank" href="https://search.maven.org/search?q=com.github.flying-cattle">
<img src="https://img.shields.io/maven-central/v/com.gitee.nuliing/rmq-api.svg?label=Maven%20Central" ></img>
</a>
<a target="_blank" href="https://www.apache.org/licenses/LICENSE-2.0.html">
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" ></img>
</a>
<a target="_blank" href="https://www.oracle.com/technetwork/java/javase/downloads/index.html">
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" ></img>
</a>
</p>
# mybatis-dsc-generator
完美集成lombok,swagger的代码生成工具,让你不再为繁琐的注释和简单的接口实现而烦恼:entity集成,格式校验,swagger; dao自动加@ mapper,service自动注释和依赖; 控制器实现单表的增副改查,并集成swagger实现api文档。如果有缘看见,期望得到你的star,very thx.
# 源码地址
- GitHub:https://github.com/flying-cattle/mybatis-dsc-generator
......@@ -18,7 +34,7 @@
<dependency>
<groupId>com.github.flying-cattle</groupId>
<artifactId>mybatis-dsc-generator</artifactId>
<version>2.1.0.RELEASE</version>
<version>3.0.0.RELEASE</version>
</dependency>
```
# 数据表结构样式
......@@ -43,7 +59,7 @@ CREATE TABLE `user` (
要求必须有表注释,要求必须有主键为id,所有字段必须有注释(便于生成java注释swagger等)。
# 生成的实体类
生成方法参考源码中的:https://github.com/flying-cattle/mybatis-dsc-generator/blob/master/src/main/java/com/github/mybatis/test/TestMain.java
生成方法参考源码中的:https://github.com/flying-cattle/mybatis-dsc-generator/blob/mybatisPlus/src/main/java/com/github/mybatis/fl/test/TestMain.java
# 生成的实体类
``` java
......@@ -299,7 +315,6 @@ public class UserController {
}
return result;
}
/**
* @explain 添加或者更新用户对象
* @param 对象参数:user
......@@ -399,8 +414,10 @@ public class UserController {
import java.io.Serializable;
import java.net.ConnectException;
import java.sql.SQLException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
/**
* Copyright: Copyright (c) 2019
*
......@@ -413,9 +430,10 @@ import org.slf4j.LoggerFactory;
*---------------------------------------------------------*
* 2019/4/9 flying-cattle V1.0 initialize
*/
@Slf4j
@Data
public class JsonResult<T> implements Serializable{
Logger logger = LoggerFactory.getLogger(this.getClass());
private static final long serialVersionUID = 1071681926787951549L;
/**
......@@ -438,36 +456,7 @@ public class JsonResult<T> implements Serializable{
* <p>返回数据</p>
*/
private T data;
public Boolean getTrue() {
return isTrue;
}
public void setTrue(Boolean aTrue) {
isTrue = aTrue;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
/**
* <p>返回成功</p>
* @param type 业务码
......@@ -486,7 +475,7 @@ public class JsonResult<T> implements Serializable{
this.code ="0000";
}
public JsonResult(Throwable throwable) {
logger.error(throwable+"tt");
log.error(throwable+"tt");
this.isTrue=false;
if(throwable instanceof NullPointerException){
this.code= "1001";
......@@ -519,7 +508,7 @@ public class JsonResult<T> implements Serializable{
this.code= "1010";
this.message="运行时异常:"+throwable;
}else if(throwable instanceof Exception){
logger.error("未知异常:"+throwable);
log.error("未知异常:"+throwable);
this.code= "9999";
this.message="未知异常"+throwable;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment