Comments (5)
博主这个问题能帮忙看看吗?
from mybatis-generator-plugin.
这个暂时没法自定义,但是Column和你使用@column注解不会冲突啊。
from mybatis-generator-plugin.
会冲突啊(可能之前提问题的时候大小写没注意,其实都是Column),比如以下代码:
`package com.yanda.entity.generated;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
@table(name = "t_log_info")
public class LogInfo implements Serializable {
/**
* 日志ID
*/
@id
@column(name = "log_id")
private Integer logId;
/**
* 请求url
*/
@Column(name = "request_url")
private String requestUrl;
/**
* 请求方法类型
*/
private String method;
/**
* 请求ip
*/
private String ip;
/**
* 方法全路径
*/
@Column(name = "class_method")
private String classMethod;
/**
* 请求参数
*/
private String params;
/**
* 创建时间
*/
@Column(name = "create_time")
private Date createTime;
/**
* 失败消息
*/
private String message;
/**
* 堆栈日志
*/
private String error;
private static final long serialVersionUID = 1L;
public LogInfo(Integer logId, String requestUrl, String method, String ip, String classMethod, String params, Date createTime, String message) {
this.logId = logId;
this.requestUrl = requestUrl;
this.method = method;
this.ip = ip;
this.classMethod = classMethod;
this.params = params;
this.createTime = createTime;
this.message = message;
}
public LogInfo(Integer logId, String requestUrl, String method, String ip, String classMethod, String params, Date createTime, String message, String error) {
this.logId = logId;
this.requestUrl = requestUrl;
this.method = method;
this.ip = ip;
this.classMethod = classMethod;
this.params = params;
this.createTime = createTime;
this.message = message;
this.error = error;
}
public LogInfo() {
super();
}
/**
* 获取日志ID
*
* @return log_id - 日志ID
*/
public Integer getLogId() {
return logId;
}
/**
* 设置日志ID
*
* @param logId 日志ID
*/
public void setLogId(Integer logId) {
this.logId = logId;
}
/**
* 获取请求url
*
* @return request_url - 请求url
*/
public String getRequestUrl() {
return requestUrl;
}
/**
* 设置请求url
*
* @param requestUrl 请求url
*/
public void setRequestUrl(String requestUrl) {
this.requestUrl = requestUrl == null ? null : requestUrl.trim();
}
/**
* 获取请求方法类型
*
* @return method - 请求方法类型
*/
public String getMethod() {
return method;
}
/**
* 设置请求方法类型
*
* @param method 请求方法类型
*/
public void setMethod(String method) {
this.method = method == null ? null : method.trim();
}
/**
* 获取请求ip
*
* @return ip - 请求ip
*/
public String getIp() {
return ip;
}
/**
* 设置请求ip
*
* @param ip 请求ip
*/
public void setIp(String ip) {
this.ip = ip == null ? null : ip.trim();
}
/**
* 获取方法全路径
*
* @return class_method - 方法全路径
*/
public String getClassMethod() {
return classMethod;
}
/**
* 设置方法全路径
*
* @param classMethod 方法全路径
*/
public void setClassMethod(String classMethod) {
this.classMethod = classMethod == null ? null : classMethod.trim();
}
/**
* 获取请求参数
*
* @return params - 请求参数
*/
public String getParams() {
return params;
}
/**
* 设置请求参数
*
* @param params 请求参数
*/
public void setParams(String params) {
this.params = params == null ? null : params.trim();
}
/**
* 获取创建时间
*
* @return create_time - 创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置创建时间
*
* @param createTime 创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取失败消息
*
* @return message - 失败消息
*/
public String getMessage() {
return message;
}
/**
* 设置失败消息
*
* @param message 失败消息
*/
public void setMessage(String message) {
this.message = message == null ? null : message.trim();
}
/**
* 获取堆栈日志
*
* @return error - 堆栈日志
*/
public String getError() {
return error;
}
/**
* 设置堆栈日志
*
* @param error 堆栈日志
*/
public void setError(String error) {
this.error = error == null ? null : error.trim();
}
public enum Column {
logId("log_id"),
requestUrl("request_url"),
method("method"),
ip("ip"),
classMethod("class_method"),
params("params"),
createTime("create_time"),
message("message"),
error("error");
private final String column;
public String value() {
return this.column;
}
public String getValue() {
return this.column;
}
Column(String column) {
this.column = column;
}
public String desc() {
return this.column + " DESC";
}
public String asc() {
return this.column + " ASC";
}
}
}`
会报很多这样的错误:
LogInfo.Column is not an annotation type
因为一边引用的是同名的javax.persistence.Column,而另一边又自己定义了同名Column枚举类
from mybatis-generator-plugin.
暂时可以这样用,我看下后期版本增加可以自定义的方式。
@javax.persistence.Column(name = "class_method")
private String classMethod;
from mybatis-generator-plugin.
好的,谢谢
from mybatis-generator-plugin.
Related Issues (20)
- 希望支持全表关键字搜索
- 逻辑删除支持设置id
- Upsert配合useGeneratedKeys使用触发ibatis异常 HOT 1
- 什么时候可以升级mybatis-generator-core到1.4.0啊,非常期待 HOT 3
- The alias 'Column' is already mapped to the value 'com.aaa.bbb.dao.entity.Ccc$Column' HOT 1
- OptimisticLockerPlugin does not support tables that have multiple primary keys
- LombokPlugin conflicts with MyBatis3Simple
- 能否开发支持JSON的插件,比如JSON_SET, JSON_ARRAY_APPEND之类的?
- Not working via try to eclipse plugin HOT 1
- 支持多表联合查询吗
- 使用Java API方式生成代码,报“获取插件列表失败!”
- UpsertPlugin生成的upsert开头的方法sql语义不正确
- 希望增加BaseMapper,BaseEntity 这种继承
- 数据库中decimal类型的字段会被生成为Long类型的java类字段 HOT 1
- select返回的结果会自动去掉前后空格?
- A required class was missing while executing org.mybatis.generator:mybatis-generator-maven-plugin:1.4.1:generate: org/mybatis/generator/api/dom/xml/Element HOT 7
- 请问批量插入开启allowMultiQueries后是否保证原子性
- 我使用rootClass属性设置继承父类,然后也是用了插件的builder,但是结果导致,生产的builder也继承了父类,有没有解决办法
- 批量插入batchInsertSelective无法返回id
- 能否增加空行插件
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mybatis-generator-plugin.