优化注释

open-doc
暮光:城中城 6 years ago
parent c25733b0e1
commit 691462d5e2

@ -1,9 +1,10 @@
package com.zyplayer.doc.db.framework.db.bean;
/**
* @Author
* @Date 2018/11/11
**/
*
* @author
* @since 201888
*/
public class DbConfigBean {
private String driverClassName;
private String url;

@ -1,97 +1,94 @@
package com.zyplayer.doc.db.framework.db.mapper.base;
import java.util.List;
import org.apache.ibatis.annotations.Param;
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;
import com.zyplayer.doc.db.framework.db.dto.TableColumnDescDto;
import com.zyplayer.doc.db.framework.db.dto.TableDescDto;
import com.zyplayer.doc.db.framework.db.dto.TableInfoDto;
/**
* mapper
* @author
* @since 201888
*/
public interface BaseMapper {
/**
*
* @author
* @since 201888
* @return
*/
List<DatabaseInfoDto> getDatabaseList();
/**
*
* @author
* @since 201888
* @param dbName
* @return
*/
List<TableInfoDto> getTableList(@Param("dbName")String dbName);
/**
*
* @author
* @since 201888
* @param dbName
* @param tableName
* @return
*/
List<TableColumnDescDto> getTableColumnList(@Param("dbName") String dbName, @Param("tableName") String tableName);
/**
*
* @author
* @since 201888
* @param tableName
* @return
*/
List<TableColumnDescDto> getTableColumnDescList(@Param("tableName") String tableName);
/**
*
* @author
* @since 201888
* @param searchText
* @return
*/
List<QueryTableColumnDescDto> getTableAndColumnBySearch(@Param("dbName") String dbName, @Param("searchText") String searchText);
/**
*
* @author
* @since 201888
* @param tableName
* @return
*/
List<TableDescDto> getTableDescList(@Param("tableName") String tableName);
/**
*
* @author
* @since 201888
* @param tableName
* @param newDesc
*/
void updateTableDesc(@Param("dbName") String dbName, @Param("tableName") String tableName, @Param("newDesc") String newDesc);
/**
*
*
* @author
* @since 201888
* @param tableName
* @param columnName
* @param newDesc
*/
void updateTableColumnDesc(@Param("dbName") String dbName, @Param("tableName") String tableName,
@Param("columnName") String columnName, @Param("newDesc") String newDesc,
@Param("columnInfo") ColumnInfoDto columnInfo);
package com.zyplayer.doc.db.framework.db.mapper.base;
import com.zyplayer.doc.db.framework.db.dto.*;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* mapper
* @author
* @since 201888
*/
public interface BaseMapper {
/**
*
* @author
* @since 201888
* @return
*/
List<DatabaseInfoDto> getDatabaseList();
/**
*
* @author
* @since 201888
* @param dbName
* @return
*/
List<TableInfoDto> getTableList(@Param("dbName")String dbName);
/**
*
* @author
* @since 201888
* @param dbName
* @param tableName
* @return
*/
List<TableColumnDescDto> getTableColumnList(@Param("dbName") String dbName, @Param("tableName") String tableName);
/**
*
* @author
* @since 201888
* @param tableName
* @return
*/
List<TableColumnDescDto> getTableColumnDescList(@Param("tableName") String tableName);
/**
*
* @author
* @since 201888
* @param dbName
* @param searchText
* @return
*/
List<QueryTableColumnDescDto> getTableAndColumnBySearch(@Param("dbName") String dbName, @Param("searchText") String searchText);
/**
*
* @author
* @since 201888
* @param tableName
* @return
*/
List<TableDescDto> getTableDescList(@Param("tableName") String tableName);
/**
*
* @author
* @since 201888
* @param tableName
* @param newDesc
*/
void updateTableDesc(@Param("dbName") String dbName, @Param("tableName") String tableName, @Param("newDesc") String newDesc);
/**
*
*
* @author
* @since 201888
* @param dbName
* @param tableName
* @param columnName
* @param newDesc
* @param 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;
import java.io.IOException;
import java.util.Date;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
import io.swagger.annotations.ApiModelProperty;
/**
*
*
* @author
* @since 201888
*/
public class DocDbResponseJson implements ResponseJson {
private static SerializeConfig mapping = new SerializeConfig();
static {
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));
}
@ApiModelProperty(value = "状态码")
private Integer errCode;
@ApiModelProperty(value = "返回值说明")
private String errMsg;
@ApiModelProperty(value = "返回数据")
private Object data;
public DocDbResponseJson() {
this.errCode = 200;
}
public DocDbResponseJson(Object data) {
this.setData(data);
this.errCode = 200;
}
public DocDbResponseJson(int errCode, String errMsg) {
super();
this.errCode = errCode;
this.errMsg = errMsg;
}
public DocDbResponseJson(int errCode, String errMsg, Object data) {
super();
this.setData(data);
this.errCode = errCode;
this.errMsg = errMsg;
}
public DocDbResponseJson(Integer errCode) {
super();
this.errCode = errCode;
}
public Integer getErrCode() {
return errCode;
}
public void setErrCode(Integer errCode) {
this.errCode = errCode;
}
public String getErrMsg() {
return errMsg;
}
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
/**
*
*
* @author
* @since 201887
* @return
*/
public static DocDbResponseJson warn(String errMsg) {
return new DocDbResponseJson(300, errMsg);
}
/**
*
*
* @author
* @since 201887
* @return
*/
public static DocDbResponseJson error(String errMsg) {
return new DocDbResponseJson(500, errMsg);
}
/**
*
*
* @author
* @since 201887
* @return
*/
public static DocDbResponseJson ok() {
return new DocDbResponseJson();
}
/**
*
*
* @author
* @since 201887
* @return
*/
public static DocDbResponseJson ok(Object data) {
return new DocDbResponseJson(data);
}
public String toJson() {
return JSON.toJSONString(this, mapping);
}
public void send(HttpServletResponse response) {
try {
response.setStatus(200);
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.setHeader("Cache-Control", "no-cache, must-revalidate");
response.getWriter().write(toJson());
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public String toString() {
return "DefaultResponseJson [errCode=" + errCode + ", errMsg=" + errMsg + ", data=" + data + "]";
}
}
package com.zyplayer.doc.db.framework.json;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
import io.swagger.annotations.ApiModelProperty;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
/**
*
*
* @author
* @since 201888
*/
public class DocDbResponseJson implements ResponseJson {
private static SerializeConfig mapping = new SerializeConfig();
static {
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));
}
@ApiModelProperty(value = "状态码")
private Integer errCode;
@ApiModelProperty(value = "返回值说明")
private String errMsg;
@ApiModelProperty(value = "返回数据")
private Object data;
public DocDbResponseJson() {
this.errCode = 200;
}
public DocDbResponseJson(Object data) {
this.setData(data);
this.errCode = 200;
}
public DocDbResponseJson(int errCode, String errMsg) {
super();
this.errCode = errCode;
this.errMsg = errMsg;
}
public DocDbResponseJson(int errCode, String errMsg, Object data) {
super();
this.setData(data);
this.errCode = errCode;
this.errMsg = errMsg;
}
public DocDbResponseJson(Integer errCode) {
super();
this.errCode = errCode;
}
public Integer getErrCode() {
return errCode;
}
public void setErrCode(Integer errCode) {
this.errCode = errCode;
}
public String getErrMsg() {
return errMsg;
}
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
/**
*
*
* @author
* @since 201887
* @param errMsg
* @return
*/
public static DocDbResponseJson warn(String errMsg) {
return new DocDbResponseJson(300, errMsg);
}
/**
*
*
* @author
* @since 201887
* @param errMsg
* @return
*/
public static DocDbResponseJson error(String errMsg) {
return new DocDbResponseJson(500, errMsg);
}
/**
*
*
* @author
* @since 201887
* @return
*/
public static DocDbResponseJson ok() {
return new DocDbResponseJson();
}
/**
*
*
* @author
* @since 201887
* @param data
* @return
*/
public static DocDbResponseJson ok(Object data) {
return new DocDbResponseJson(data);
}
public String toJson() {
return JSON.toJSONString(this, mapping);
}
public void send(HttpServletResponse response) {
try {
response.setStatus(200);
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.setHeader("Cache-Control", "no-cache, must-revalidate");
response.getWriter().write(toJson());
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public String toString() {
return "DefaultResponseJson [errCode=" + errCode + ", errMsg=" + errMsg + ", data=" + data + "]";
}
}

Loading…
Cancel
Save