优化注释
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
package com.zyplayer.doc.db.framework.db.bean;
|
package com.zyplayer.doc.db.framework.db.bean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author
|
* 数据库配置信息
|
||||||
* @Date 2018/11/11
|
* @author 暮光:城中城
|
||||||
**/
|
* @since 2018年8月8日
|
||||||
|
*/
|
||||||
public class DbConfigBean {
|
public class DbConfigBean {
|
||||||
private String driverClassName;
|
private String driverClassName;
|
||||||
private String url;
|
private String url;
|
||||||
|
|||||||
@@ -1,97 +1,94 @@
|
|||||||
package com.zyplayer.doc.db.framework.db.mapper.base;
|
package com.zyplayer.doc.db.framework.db.mapper.base;
|
||||||
|
|
||||||
import java.util.List;
|
import com.zyplayer.doc.db.framework.db.dto.*;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
import java.util.List;
|
||||||
import com.zyplayer.doc.db.framework.db.dto.ColumnInfoDto;
|
|
||||||
import com.zyplayer.doc.db.framework.db.dto.DatabaseInfoDto;
|
/**
|
||||||
import com.zyplayer.doc.db.framework.db.dto.QueryTableColumnDescDto;
|
* 数据库的mapper持有对象接口
|
||||||
import com.zyplayer.doc.db.framework.db.dto.TableColumnDescDto;
|
* @author 暮光:城中城
|
||||||
import com.zyplayer.doc.db.framework.db.dto.TableDescDto;
|
* @since 2018年8月8日
|
||||||
import com.zyplayer.doc.db.framework.db.dto.TableInfoDto;
|
*/
|
||||||
|
public interface BaseMapper {
|
||||||
/**
|
|
||||||
* 数据库的mapper持有对象接口
|
/**
|
||||||
* @author 暮光:城中城
|
* 获取库列表
|
||||||
* @since 2018年8月8日
|
* @author 暮光:城中城
|
||||||
*/
|
* @since 2018年8月8日
|
||||||
public interface BaseMapper {
|
* @return 数据库列表
|
||||||
|
*/
|
||||||
/**
|
List<DatabaseInfoDto> getDatabaseList();
|
||||||
* 获取库列表
|
|
||||||
* @author 暮光:城中城
|
/**
|
||||||
* @since 2018年8月8日
|
* 获取表列表
|
||||||
* @return
|
* @author 暮光:城中城
|
||||||
*/
|
* @since 2018年8月8日
|
||||||
List<DatabaseInfoDto> getDatabaseList();
|
* @param dbName 数据库名
|
||||||
|
* @return 数据库表列表
|
||||||
/**
|
*/
|
||||||
* 获取表列表
|
List<TableInfoDto> getTableList(@Param("dbName")String dbName);
|
||||||
* @author 暮光:城中城
|
|
||||||
* @since 2018年8月8日
|
/**
|
||||||
* @param dbName
|
* 获取字段列表
|
||||||
* @return
|
* @author 暮光:城中城
|
||||||
*/
|
* @since 2018年8月8日
|
||||||
List<TableInfoDto> getTableList(@Param("dbName")String dbName);
|
* @param dbName 数据库名
|
||||||
|
* @param tableName 表名
|
||||||
/**
|
* @return 字段列表
|
||||||
* 获取字段列表
|
*/
|
||||||
* @author 暮光:城中城
|
List<TableColumnDescDto> getTableColumnList(@Param("dbName") String dbName, @Param("tableName") String tableName);
|
||||||
* @since 2018年8月8日
|
|
||||||
* @param dbName
|
/**
|
||||||
* @param tableName
|
* 获取字段注释
|
||||||
* @return
|
* @author 暮光:城中城
|
||||||
*/
|
* @since 2018年8月8日
|
||||||
List<TableColumnDescDto> getTableColumnList(@Param("dbName") String dbName, @Param("tableName") String tableName);
|
* @param tableName 表名
|
||||||
|
* @return 表字段注释
|
||||||
/**
|
*/
|
||||||
* 获取字段注释
|
List<TableColumnDescDto> getTableColumnDescList(@Param("tableName") String tableName);
|
||||||
* @author 暮光:城中城
|
|
||||||
* @since 2018年8月8日
|
/**
|
||||||
* @param tableName
|
* 模糊搜索表和字段
|
||||||
* @return
|
* @author 暮光:城中城
|
||||||
*/
|
* @since 2018年8月8日
|
||||||
List<TableColumnDescDto> getTableColumnDescList(@Param("tableName") String tableName);
|
* @param dbName 数据库名
|
||||||
|
* @param searchText 搜索内容
|
||||||
/**
|
* @return 表和字段信息
|
||||||
* 模糊搜索表和字段
|
*/
|
||||||
* @author 暮光:城中城
|
List<QueryTableColumnDescDto> getTableAndColumnBySearch(@Param("dbName") String dbName, @Param("searchText") String searchText);
|
||||||
* @since 2018年8月8日
|
|
||||||
* @param searchText
|
/**
|
||||||
* @return
|
* 获取表注释
|
||||||
*/
|
* @author 暮光:城中城
|
||||||
List<QueryTableColumnDescDto> getTableAndColumnBySearch(@Param("dbName") String dbName, @Param("searchText") String searchText);
|
* @since 2018年8月8日
|
||||||
|
* @param tableName 可不传,传了只查询指定表的注释
|
||||||
/**
|
* @return 表注释
|
||||||
* 获取表注释
|
*/
|
||||||
* @author 暮光:城中城
|
List<TableDescDto> getTableDescList(@Param("tableName") String tableName);
|
||||||
* @since 2018年8月8日
|
|
||||||
* @param tableName 可不传,传了只查询指定表的注释
|
/**
|
||||||
* @return
|
* 增加表注释
|
||||||
*/
|
* @author 暮光:城中城
|
||||||
List<TableDescDto> getTableDescList(@Param("tableName") String tableName);
|
* @since 2018年8月8日
|
||||||
|
* @param tableName 表名
|
||||||
/**
|
* @param newDesc 新的注释
|
||||||
* 增加表注释
|
*/
|
||||||
* @author 暮光:城中城
|
void updateTableDesc(@Param("dbName") String dbName, @Param("tableName") String tableName, @Param("newDesc") String newDesc);
|
||||||
* @since 2018年8月8日
|
|
||||||
* @param tableName
|
/**
|
||||||
* @param newDesc
|
* 增加字段注释
|
||||||
*/
|
*
|
||||||
void updateTableDesc(@Param("dbName") String dbName, @Param("tableName") String tableName, @Param("newDesc") String newDesc);
|
* @author 暮光:城中城
|
||||||
|
* @since 2018年8月8日
|
||||||
/**
|
* @param dbName 数据库名
|
||||||
* 增加字段注释
|
* @param tableName 表名
|
||||||
*
|
* @param columnName 字段名
|
||||||
* @author 暮光:城中城
|
* @param newDesc 新的注释
|
||||||
* @since 2018年8月8日
|
* @param columnInfo 字段信息
|
||||||
* @param tableName
|
*/
|
||||||
* @param columnName
|
void updateTableColumnDesc(@Param("dbName") String dbName, @Param("tableName") String tableName,
|
||||||
* @param newDesc
|
@Param("columnName") String columnName, @Param("newDesc") String newDesc,
|
||||||
*/
|
@Param("columnInfo") ColumnInfoDto columnInfo);
|
||||||
void updateTableColumnDesc(@Param("dbName") String dbName, @Param("tableName") String tableName,
|
|
||||||
@Param("columnName") String columnName, @Param("newDesc") String newDesc,
|
|
||||||
@Param("columnInfo") ColumnInfoDto columnInfo);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,147 +1,148 @@
|
|||||||
package com.zyplayer.doc.db.framework.json;
|
package com.zyplayer.doc.db.framework.json;
|
||||||
|
|
||||||
import java.io.IOException;
|
import com.alibaba.fastjson.JSON;
|
||||||
import java.util.Date;
|
import com.alibaba.fastjson.serializer.SerializeConfig;
|
||||||
|
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import com.alibaba.fastjson.serializer.SerializeConfig;
|
import java.io.IOException;
|
||||||
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
|
import java.util.Date;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
/**
|
||||||
|
* 数据库文档返回数据格式
|
||||||
/**
|
*
|
||||||
* 数据库文档返回数据格式
|
* @author 暮光:城中城
|
||||||
*
|
* @since 2018年8月8日
|
||||||
* @author 暮光:城中城
|
*/
|
||||||
* @since 2018年8月8日
|
public class DocDbResponseJson implements ResponseJson {
|
||||||
*/
|
private static SerializeConfig mapping = new SerializeConfig();
|
||||||
public class DocDbResponseJson implements ResponseJson {
|
static {
|
||||||
private static SerializeConfig mapping = new SerializeConfig();
|
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));
|
||||||
static {
|
}
|
||||||
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));
|
@ApiModelProperty(value = "状态码")
|
||||||
}
|
private Integer errCode;
|
||||||
@ApiModelProperty(value = "状态码")
|
@ApiModelProperty(value = "返回值说明")
|
||||||
private Integer errCode;
|
private String errMsg;
|
||||||
@ApiModelProperty(value = "返回值说明")
|
@ApiModelProperty(value = "返回数据")
|
||||||
private String errMsg;
|
private Object data;
|
||||||
@ApiModelProperty(value = "返回数据")
|
|
||||||
private Object data;
|
public DocDbResponseJson() {
|
||||||
|
this.errCode = 200;
|
||||||
public DocDbResponseJson() {
|
}
|
||||||
this.errCode = 200;
|
|
||||||
}
|
public DocDbResponseJson(Object data) {
|
||||||
|
this.setData(data);
|
||||||
public DocDbResponseJson(Object data) {
|
this.errCode = 200;
|
||||||
this.setData(data);
|
}
|
||||||
this.errCode = 200;
|
|
||||||
}
|
public DocDbResponseJson(int errCode, String errMsg) {
|
||||||
|
super();
|
||||||
public DocDbResponseJson(int errCode, String errMsg) {
|
this.errCode = errCode;
|
||||||
super();
|
this.errMsg = errMsg;
|
||||||
this.errCode = errCode;
|
}
|
||||||
this.errMsg = errMsg;
|
|
||||||
}
|
public DocDbResponseJson(int errCode, String errMsg, Object data) {
|
||||||
|
super();
|
||||||
public DocDbResponseJson(int errCode, String errMsg, Object data) {
|
this.setData(data);
|
||||||
super();
|
this.errCode = errCode;
|
||||||
this.setData(data);
|
this.errMsg = errMsg;
|
||||||
this.errCode = errCode;
|
}
|
||||||
this.errMsg = errMsg;
|
|
||||||
}
|
public DocDbResponseJson(Integer errCode) {
|
||||||
|
super();
|
||||||
public DocDbResponseJson(Integer errCode) {
|
this.errCode = errCode;
|
||||||
super();
|
}
|
||||||
this.errCode = errCode;
|
|
||||||
}
|
public Integer getErrCode() {
|
||||||
|
return errCode;
|
||||||
public Integer getErrCode() {
|
}
|
||||||
return errCode;
|
|
||||||
}
|
public void setErrCode(Integer errCode) {
|
||||||
|
this.errCode = errCode;
|
||||||
public void setErrCode(Integer errCode) {
|
}
|
||||||
this.errCode = errCode;
|
|
||||||
}
|
public String getErrMsg() {
|
||||||
|
return errMsg;
|
||||||
public String getErrMsg() {
|
}
|
||||||
return errMsg;
|
|
||||||
}
|
public void setErrMsg(String errMsg) {
|
||||||
|
this.errMsg = errMsg;
|
||||||
public void setErrMsg(String errMsg) {
|
}
|
||||||
this.errMsg = errMsg;
|
|
||||||
}
|
public Object getData() {
|
||||||
|
return data;
|
||||||
public Object getData() {
|
}
|
||||||
return data;
|
|
||||||
}
|
public void setData(Object data) {
|
||||||
|
this.data = data;
|
||||||
public void setData(Object data) {
|
}
|
||||||
this.data = data;
|
|
||||||
}
|
/**
|
||||||
|
* 提示语
|
||||||
/**
|
*
|
||||||
* 提示语
|
* @author 暮光:城中城
|
||||||
*
|
* @since 2018年8月7日
|
||||||
* @author 暮光:城中城
|
* @param errMsg 提示信息
|
||||||
* @since 2018年8月7日
|
* @return 对象
|
||||||
* @return
|
*/
|
||||||
*/
|
public static DocDbResponseJson warn(String errMsg) {
|
||||||
public static DocDbResponseJson warn(String errMsg) {
|
return new DocDbResponseJson(300, errMsg);
|
||||||
return new DocDbResponseJson(300, errMsg);
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* 错误
|
||||||
* 错误
|
*
|
||||||
*
|
* @author 暮光:城中城
|
||||||
* @author 暮光:城中城
|
* @since 2018年8月7日
|
||||||
* @since 2018年8月7日
|
* @param errMsg 错误信息
|
||||||
* @return
|
* @return 对象
|
||||||
*/
|
*/
|
||||||
public static DocDbResponseJson error(String errMsg) {
|
public static DocDbResponseJson error(String errMsg) {
|
||||||
return new DocDbResponseJson(500, errMsg);
|
return new DocDbResponseJson(500, errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成功的返回方法
|
* 成功的返回方法
|
||||||
*
|
*
|
||||||
* @author 暮光:城中城
|
* @author 暮光:城中城
|
||||||
* @since 2018年8月7日
|
* @since 2018年8月7日
|
||||||
* @return
|
* @return 对象
|
||||||
*/
|
*/
|
||||||
public static DocDbResponseJson ok() {
|
public static DocDbResponseJson ok() {
|
||||||
return new DocDbResponseJson();
|
return new DocDbResponseJson();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成功的返回方法
|
* 成功的返回方法
|
||||||
*
|
*
|
||||||
* @author 暮光:城中城
|
* @author 暮光:城中城
|
||||||
* @since 2018年8月7日
|
* @since 2018年8月7日
|
||||||
* @return
|
* @param data 数据
|
||||||
*/
|
* @return 对象
|
||||||
public static DocDbResponseJson ok(Object data) {
|
*/
|
||||||
return new DocDbResponseJson(data);
|
public static DocDbResponseJson ok(Object data) {
|
||||||
}
|
return new DocDbResponseJson(data);
|
||||||
|
}
|
||||||
public String toJson() {
|
|
||||||
return JSON.toJSONString(this, mapping);
|
public String toJson() {
|
||||||
}
|
return JSON.toJSONString(this, mapping);
|
||||||
|
}
|
||||||
public void send(HttpServletResponse response) {
|
|
||||||
try {
|
public void send(HttpServletResponse response) {
|
||||||
response.setStatus(200);
|
try {
|
||||||
response.setContentType("application/json");
|
response.setStatus(200);
|
||||||
response.setCharacterEncoding("UTF-8");
|
response.setContentType("application/json");
|
||||||
response.setHeader("Cache-Control", "no-cache, must-revalidate");
|
response.setCharacterEncoding("UTF-8");
|
||||||
response.getWriter().write(toJson());
|
response.setHeader("Cache-Control", "no-cache, must-revalidate");
|
||||||
} catch (IOException e) {
|
response.getWriter().write(toJson());
|
||||||
e.printStackTrace();
|
} catch (IOException e) {
|
||||||
}
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public String toString() {
|
@Override
|
||||||
return "DefaultResponseJson [errCode=" + errCode + ", errMsg=" + errMsg + ", data=" + data + "]";
|
public String toString() {
|
||||||
}
|
return "DefaultResponseJson [errCode=" + errCode + ", errMsg=" + errMsg + ", data=" + data + "]";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user