Commit 29c339cb by qwmqiuwenmin

fix

parents
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gic</groupId>
<artifactId>sql-check</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>sql-check-sdk</module>
<module>sql-check-web</module>
</modules>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>gic-pom-base</artifactId>
<groupId>com.gic</groupId>
<version>4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.gic</groupId>
<artifactId>sql-check-sdk</artifactId>
<version>${libraryVersion}</version>
<properties>
<libraryVersion>1.0-SNAPSHOT</libraryVersion>
</properties>
<dependencies>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-commons</artifactId>
<version>${gic-commons}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>hb-common</artifactId>
<version>${hb-common}</version>
</dependency>
</dependencies>
<build>
<finalName>${artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>classes-copy-resources</id>
<phase>compile</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${classes.dir}</outputDirectory>
<resources>
<resource>
<directory>src/main/${package.environment}</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package com.gic.sql.interceptor;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.handlers.AbstractSqlParserHandler;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.mq.sdk.GicMQClient;
import net.sf.jsqlparser.JSQLParserException;
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
import net.sf.jsqlparser.util.TablesNamesFinder;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.ParameterMapping;
import org.apache.ibatis.mapping.ParameterMode;
import org.apache.ibatis.plugin.*;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.SystemMetaObject;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.type.TypeHandlerRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.sql.Connection;
import net.sf.jsqlparser.statement.Statement;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Properties;
/**
* 自定义mybatis插件,实现输出实际执行sql语句
*
* @author qwm
* @date 2020-10-10
*/
@Intercepts({
@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class}),
@Signature(type = StatementHandler.class, method = "batch", args = {Statement.class})
})
@Component
public class MybatisSqlInterceptor extends AbstractSqlParserHandler implements Interceptor {
private static Logger logger= LoggerFactory.getLogger(MybatisSqlInterceptor.class);
private static final String SERVICENAME = "com.gic.hb.sql.check.service.outer";
private static final String METHODNAME = "mqSqlCheck";
/**
* 忽略插入sql_log表的语句
*/
private static final String IGNORE_SQL_PREFIX = "insert";
@Override
public Object intercept(Invocation invocation) throws Throwable {
StatementHandler statementHandler = PluginUtils.realTarget(invocation.getTarget());
MetaObject metaObject = SystemMetaObject.forObject(statementHandler);
MappedStatement mappedStatement = (MappedStatement) metaObject.getValue("delegate.mappedStatement");
BoundSql boundSql = (BoundSql) metaObject.getValue("delegate.boundSql");
String sql = boundSql.getSql().replaceAll("\\s+", " ").toLowerCase();
if (sql.toLowerCase().startsWith(IGNORE_SQL_PREFIX)) {
return invocation.proceed();
}
List<ParameterMapping> parameterMappings = new ArrayList<>(boundSql.getParameterMappings());
Object parameterObject = boundSql.getParameterObject();
if (parameterMappings.isEmpty() && parameterObject == null) {
logger.warn("parameterMappings is empty or parameterObject is null");
return invocation.proceed();
}
Configuration configuration = mappedStatement.getConfiguration();
TypeHandlerRegistry typeHandlerRegistry = configuration.getTypeHandlerRegistry();
String realSql = "";
try {
this.sqlParser(metaObject);
String parameter = "null";
MetaObject newMetaObject = configuration.newMetaObject(parameterObject);
for (ParameterMapping parameterMapping : parameterMappings) {
if (parameterMapping.getMode() == ParameterMode.OUT) {
continue;
}
String propertyName = parameterMapping.getProperty();
if (typeHandlerRegistry.hasTypeHandler(parameterObject.getClass())) {
parameter = getParameterValue(parameterObject);
} else if (newMetaObject.hasGetter(propertyName)) {
parameter = getParameterValue(newMetaObject.getValue(propertyName));
} else if (boundSql.hasAdditionalParameter(propertyName)) {
parameter = getParameterValue(boundSql.getAdditionalParameter(propertyName));
}
// fixme 此处不严谨,若sql语句中有❓,则替换错位。?️
realSql = sql.replaceFirst("\\?", parameter);
}
// 将拦截到的sql语句插入日志表中
logger.info(realSql);
com.alibaba.fastjson.JSONObject json = new JSONObject();
json.put("sqlKey", sql);
json.put("sql", realSql);
json.put("project", "test");
// String tables = getTableNames(realSql);
// json.put("table", tables);
GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try {
clientInstance.sendCommonMessage("commonRouter", json.toJSONString(), SERVICENAME, METHODNAME);
} catch (Exception e) {
logger.info("发送试算表:{}", e.getStackTrace());
}
} catch (Exception e) {
logger.error(String.format("intercept sql error: [%s]", sql), e);
}
return invocation.proceed();
}
/**
* @param sql
* @return 获取sql所有的表名
*/
private String getTableNames(String sql) {
Statement statement = null;
try {
statement = CCJSqlParserUtil.parse(sql);
} catch (JSQLParserException e) {
throw new RuntimeException("解析sql语句错误!sql:" + sql, e);
}
TablesNamesFinder tablesNamesFinder = new TablesNamesFinder();
List <String> tableList = tablesNamesFinder.getTableList(statement);
String tableNames = "";
for (String tableName : tableList) {
//获取去掉“`”的表名
if (tableName.startsWith("`") && tableName.endsWith("`")) {
tableNames += tableName.substring(1, tableName.length()-1).toUpperCase() + ",";
}else {
tableNames += tableName.toUpperCase() + ",";
}
}
if(StringUtils.isNotEmpty(tableNames)){
tableNames = tableNames.substring(0,tableNames.length() - 1);
}
return tableNames;
}
/**
* 获取参数
*
* @param param Object类型参数
* @return 转换之后的参数
*/
private static String getParameterValue(Object param) {
if (param == null) {
return "null";
}
if (param instanceof Number) {
return param.toString();
}
String value = null;
if (param instanceof String) {
value = param.toString();
} else if (param instanceof Date) {
DateUtil.dateToStr((Date) param, "yyyy-MM-dd HH:mm:ss");
} else if (param instanceof IEnum) {
value = String.valueOf(((IEnum) param).getValue());
} else {
value = param.toString();
}
return StringUtils.quotaMark(value);
}
@Override
public Object plugin(Object o) {
if (o instanceof StatementHandler) {
return Plugin.wrap(o, this);
}
return o;
}
@Override
public void setProperties(Properties properties) {
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>gic-pom-base</artifactId>
<groupId>com.gic</groupId>
<version>4.0-SNAPSHOT</version>
</parent>
<groupId>com.gic</groupId>
<artifactId>sql-check-web</artifactId>
<version>${libraryVersion}</version>
<name>sql-cleck-web</name>
<description>Demo project for Spring Boot</description>
<properties>
<libraryVersion>1.0-SNAPSHOT</libraryVersion>
<hb-config>1.0-SNAPSHOT</hb-config>
<hb-common>1.0-SNAPSHOT</hb-common>
<sql-check-sdk>1.0-SNAPSHOT</sql-check-sdk>
<archety-pehb-api>1.0-SNAPSHOT</archety-pehb-api>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<sring.boot.version>2.1.5.RELEASE</sring.boot.version>
<hb-data-api>1.0-SNAPSHOT</hb-data-api>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>hb-common</artifactId>
<version>${hb-common}</version>
<exclusions>
<exclusion>
<artifactId>dubbo</artifactId>
<groupId>com.alibaba</groupId>
</exclusion>
<exclusion>
<artifactId>logback-core</artifactId>
<groupId>ch.qos.logback</groupId>
</exclusion>
<exclusion>
<artifactId>spring-data-redis</artifactId>
<groupId>org.springframework.data</groupId>
</exclusion>
<exclusion>
<artifactId>servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>hb-config</artifactId>
<version>${hb-config}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>code-generator</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.59</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${sring.boot.version}</version>
<exclusions>
<exclusion>
<artifactId>logback-classic</artifactId>
<groupId>ch.qos.logback</groupId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.9</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.23</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-platform-member-base-commons</artifactId>
<version>${gic-platform-member-base-commons}</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>sql-check-sdk</artifactId>
<version>${sql-check-sdk}</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<classesDirectory>target/classes/</classesDirectory>
<archive>
<manifest>
<mainClass>com.gic.commons.DubboMain</mainClass>
<!-- 打包时 MANIFEST.MF文件不记录的时间戳版本 -->
<useUniqueVersions>false</useUniqueVersions>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
<manifestEntries>
<Class-Path>.</Class-Path>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<type>jar</type>
<includeTypes>jar</includeTypes>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.1.0</version>
<configuration>
<flattenMode>defaults</flattenMode>
</configuration>
<executions>
<!-- enable flattening -->
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<!-- ensure proper cleanup -->
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${sring.boot.version}</version>
<configuration>
<mainClass>com.gic.HbWebApplication</mainClass>
<excludeGroupIds>ch.qos.logback</excludeGroupIds>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package com.gic;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
import org.springframework.context.annotation.ImportResource;
/**
*
* @author Administrator
*
*/
@SpringBootApplication(
scanBasePackages = "com.gic.sql.check.*",
exclude = {
RedisAutoConfiguration.class,
RedisRepositoriesAutoConfiguration.class,
QuartzAutoConfiguration.class
}
)
@ImportResource(value = {
"classpath*:applicationContext-conf.xml"
})
public class HbWebApplication {
public static void main(String[] args) {
SpringApplication.run(HbWebApplication.class, args);
}
}
package com.gic.sql.check.controller;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.sql.check.errorcode.HbErrorCode;
/**
* Created 2020/7/3.
*
* @author hua
*/
public class BaseController {
protected RestResponse resultResponse(HbErrorCode errorCode, Object data, String errDetail){
return RestResponse.create(errorCode.getCode(),errorCode.getMessage(),data,errDetail);
}
protected RestResponse resultResponse(HbErrorCode errorCode,Object data){
return RestResponse.create(errorCode.getCode(),errorCode.getMessage(),data);
}
protected RestResponse resultResponse(HbErrorCode errorCode) {
return RestResponse.create(errorCode.getCode(),errorCode.getMessage(),null);
}
protected RestResponse resultResponse(ServiceResponse serviceResponse) {
if (null == serviceResponse) {
return RestResponse.failure(HbErrorCode.ERR_0001.getCode(),HbErrorCode.ERR_0001.getMessage());
}
if (serviceResponse.isSuccess()) {
return RestResponse.create(HbErrorCode.ERR_0000.getCode(),HbErrorCode.ERR_0000.getMessage(),serviceResponse.getResult());
}else {
return RestResponse.create(HbErrorCode.ERR_0004.getCode(), serviceResponse.getMessage(), null);
}
}
protected RestResponse resultPage(ServiceResponse serviceResponse) {
if (null == serviceResponse) {
return RestResponse.failure(HbErrorCode.ERR_0001.getCode(),HbErrorCode.ERR_0001.getMessage());
}
if (serviceResponse.isSuccess()) {
return RestResponse.create(HbErrorCode.ERR_0000.getCode(),HbErrorCode.ERR_0000.getMessage(),serviceResponse.getResult());
}else {
return RestResponse.create(HbErrorCode.ERR_0004.getCode(), serviceResponse.getMessage(), null);
}
}
}
package com.gic.sql.check.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.hb.base.common.BasePageInfo;
import com.gic.sql.check.dto.TabSqlCheckDTO;
import com.gic.sql.check.service.outer.SqlCheckApiService;
/**
*
* @author qwm
*
*/
@RestController
public class SqlCheckController extends BaseController{
@Autowired
SqlCheckApiService sqlCheckApiService;
/**
* 查询sql
* @param startDate
* @param endDate
* @param project
* @param pageInfo
* @return
*/
@RequestMapping("/list-sql")
public RestResponse select(String startDate,String endDate,String project,BasePageInfo pageInfo){
ServiceResponse<Page<TabSqlCheckDTO>> sr = sqlCheckApiService.listByParams(startDate,endDate,project,pageInfo);
return resultPage(sr);
}
}
package com.gic.sql.check.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TestController extends BaseController{
/**
* 保存test
* @param qo
* @return
*/
@RequestMapping("/select")
public void select(){
System.err.println("111");
}
}
package com.gic.sql.check.dto;
import java.io.Serializable;
import java.util.Date;
public class TabSqlCheckDTO implements Serializable{
private static final long serialVersionUID = 1L;
/**
* sqlId
*/
private Integer sqlCheckSqlId;
/**
* sql的关键字
*/
private String sqlCheckSqlKey;
/**
* 真实sql
*/
private String sqlCheckSql;
/**
* 表的id
*/
private Integer sqlCheckTableId;
/**
* 表的名
*/
private String sqlCheckTableName;
/**
* 项目id
*/
private Integer sqlCheckProjectId;
/**
* 项目名称
*/
private String sqlCheckProjectName;
/**
* 删除状态1是0否
*/
private Integer deleteFlag;
/**
* 是否完善索引1是0否
*/
private Integer sqlCheckIndexType;
/**
* 索引的语句
*/
private String sqlCheckIndex;
/**
* 完善人id
*/
private Long commitId;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
public Integer getSqlCheckSqlId() {
return sqlCheckSqlId;
}
public void setSqlCheckSqlId(Integer sqlCheckSqlId) {
this.sqlCheckSqlId = sqlCheckSqlId;
}
public String getSqlCheckSqlKey() {
return sqlCheckSqlKey;
}
public void setSqlCheckSqlKey(String sqlCheckSqlKey) {
this.sqlCheckSqlKey = sqlCheckSqlKey;
}
public String getSqlCheckSql() {
return sqlCheckSql;
}
public void setSqlCheckSql(String sqlCheckSql) {
this.sqlCheckSql = sqlCheckSql;
}
public Integer getSqlCheckTableId() {
return sqlCheckTableId;
}
public void setSqlCheckTableId(Integer sqlCheckTableId) {
this.sqlCheckTableId = sqlCheckTableId;
}
public Integer getSqlCheckProjectId() {
return sqlCheckProjectId;
}
public void setSqlCheckProjectId(Integer sqlCheckProjectId) {
this.sqlCheckProjectId = sqlCheckProjectId;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getSqlCheckTableName() {
return sqlCheckTableName;
}
public void setSqlCheckTableName(String sqlCheckTableName) {
this.sqlCheckTableName = sqlCheckTableName;
}
public String getSqlCheckProjectName() {
return sqlCheckProjectName;
}
public void setSqlCheckProjectName(String sqlCheckProjectName) {
this.sqlCheckProjectName = sqlCheckProjectName;
}
public Integer getSqlCheckIndexType() {
return sqlCheckIndexType;
}
public void setSqlCheckIndexType(Integer sqlCheckIndexType) {
this.sqlCheckIndexType = sqlCheckIndexType;
}
public String getSqlCheckIndex() {
return sqlCheckIndex;
}
public void setSqlCheckIndex(String sqlCheckIndex) {
this.sqlCheckIndex = sqlCheckIndex;
}
public Long getCommitId() {
return commitId;
}
public void setCommitId(Long commitId) {
this.commitId = commitId;
}
@Override
public String toString() {
return "TabSqlCheckSql{" +
"sqlCheckSqlId=" + sqlCheckSqlId +
", sqlCheckSqlKey=" + sqlCheckSqlKey +
", sqlCheckSql=" + sqlCheckSql +
", sqlCheckTableId=" + sqlCheckTableId +
", sqlCheckProjectId=" + sqlCheckProjectId +
", delFlag=" + deleteFlag +
", createTime=" + createTime +
", updateTime=" + updateTime +
"}";
}
}
package com.gic.sql.check.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author mybatis
* @since 2020-10-15
*/
@TableName("tab_hb_sql_check_project")
public class TabSqlCheckProject implements Serializable {
private static final long serialVersionUID = 1L;
/**
* sql校验项目Id
*/
private Integer sqlCheckProjectId;
/**
* 项目名称
*/
private String sqlCheckProjectName;
/**
* 0正常1删除
*/
private Integer deleteFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
public Integer getSqlCheckProjectId() {
return sqlCheckProjectId;
}
public void setSqlCheckProjectId(Integer sqlCheckProjectId) {
this.sqlCheckProjectId = sqlCheckProjectId;
}
public String getSqlCheckProjectName() {
return sqlCheckProjectName;
}
public void setSqlCheckProjectName(String sqlCheckProjectName) {
this.sqlCheckProjectName = sqlCheckProjectName;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "TabSqlCheckProject{" +
"sqlCheckProjectId=" + sqlCheckProjectId +
", sqlCheckProjectName=" + sqlCheckProjectName +
", delFlag=" + deleteFlag +
", createTime=" + createTime +
", updateTime=" + updateTime +
"}";
}
}
package com.gic.sql.check.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author mybatis
* @since 2020-10-15
*/
@TableName("tab_hb_sql_check_sql")
public class TabSqlCheckSql implements Serializable {
private static final long serialVersionUID = 1L;
/**
* sqlId
*/
@TableId(value = "sql_check_sql_id", type = IdType.AUTO)
private Integer sqlCheckSqlId;
/**
* sql的关键字
*/
private String sqlCheckSqlKey;
/**
* 真实sql
*/
private String sqlCheckSql;
/**
* 表的id
*/
private Integer sqlCheckTableId;
/**
* 表的名
*/
private String sqlCheckTableName;
/**
* 项目id
*/
private Integer sqlCheckProjectId;
/**
* 项目名称
*/
private String sqlCheckProjectName;
/**
* 删除状态1是0否
*/
private Integer deleteFlag;
/**
* 是否完善索引1是0否
*/
private Integer sqlCheckIndexType;
/**
* 索引的语句
*/
private String sqlCheckIndex;
/**
* 完善人id
*/
private Long commitId;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
public Integer getSqlCheckSqlId() {
return sqlCheckSqlId;
}
public void setSqlCheckSqlId(Integer sqlCheckSqlId) {
this.sqlCheckSqlId = sqlCheckSqlId;
}
public String getSqlCheckSqlKey() {
return sqlCheckSqlKey;
}
public void setSqlCheckSqlKey(String sqlCheckSqlKey) {
this.sqlCheckSqlKey = sqlCheckSqlKey;
}
public String getSqlCheckSql() {
return sqlCheckSql;
}
public void setSqlCheckSql(String sqlCheckSql) {
this.sqlCheckSql = sqlCheckSql;
}
public Integer getSqlCheckTableId() {
return sqlCheckTableId;
}
public void setSqlCheckTableId(Integer sqlCheckTableId) {
this.sqlCheckTableId = sqlCheckTableId;
}
public Integer getSqlCheckProjectId() {
return sqlCheckProjectId;
}
public void setSqlCheckProjectId(Integer sqlCheckProjectId) {
this.sqlCheckProjectId = sqlCheckProjectId;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getSqlCheckTableName() {
return sqlCheckTableName;
}
public void setSqlCheckTableName(String sqlCheckTableName) {
this.sqlCheckTableName = sqlCheckTableName;
}
public String getSqlCheckProjectName() {
return sqlCheckProjectName;
}
public void setSqlCheckProjectName(String sqlCheckProjectName) {
this.sqlCheckProjectName = sqlCheckProjectName;
}
public Integer getSqlCheckIndexType() {
return sqlCheckIndexType;
}
public void setSqlCheckIndexType(Integer sqlCheckIndexType) {
this.sqlCheckIndexType = sqlCheckIndexType;
}
public String getSqlCheckIndex() {
return sqlCheckIndex;
}
public void setSqlCheckIndex(String sqlCheckIndex) {
this.sqlCheckIndex = sqlCheckIndex;
}
public Long getCommitId() {
return commitId;
}
public void setCommitId(Long commitId) {
this.commitId = commitId;
}
@Override
public String toString() {
return "TabSqlCheckSql{" +
"sqlCheckSqlId=" + sqlCheckSqlId +
", sqlCheckSqlKey=" + sqlCheckSqlKey +
", sqlCheckSql=" + sqlCheckSql +
", sqlCheckTableId=" + sqlCheckTableId +
", sqlCheckProjectId=" + sqlCheckProjectId +
", delFlag=" + deleteFlag +
", createTime=" + createTime +
", updateTime=" + updateTime +
"}";
}
}
package com.gic.sql.check.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author mybatis
* @since 2020-10-15
*/
@TableName("tab_hb_sql_check_table")
public class TabSqlCheckTable implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 表id
*/
@TableId(value = "sql_check_table_id", type = IdType.AUTO)
private Integer sqlCheckTableId;
/**
* 表名称
*/
private String sqlCheckTableName;
/**
* 删除标记1是0否
*/
private Integer deleteFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
public Integer getSqlCheckTableId() {
return sqlCheckTableId;
}
public void setSqlCheckTableId(Integer sqlCheckTableId) {
this.sqlCheckTableId = sqlCheckTableId;
}
public String getSqlCheckTableName() {
return sqlCheckTableName;
}
public void setSqlCheckTableName(String sqlCheckTableName) {
this.sqlCheckTableName = sqlCheckTableName;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "TabSqlCheckTable{" +
"sqlCheckTableId=" + sqlCheckTableId +
", sqlCheckTableName=" + sqlCheckTableName +
", delFlag=" + deleteFlag +
", createTime=" + createTime +
", updateTime=" + updateTime +
"}";
}
}
package com.gic.sql.check.errorcode;
/**
*
* @author Administrator
*
*/
public enum HbErrorCode {
/**
**
* 操作成功
*/
ERR_0000("0000","操作成功"),
/**
* 操作失败
*/
ERR_0001("0001","操作失败"),
/**
* 系统异常
*/
ERR_0002("0002","系统异常"),
/**
* 登录异常
*/
ERR_0003("0003","登录异常"),
/**
* 自定义异常
*/
ERR_0004("0004","自定义操作失败"),
/**
* 缺少参数
*/
ERR_0005("0005","缺少参数"),
;
private String code;
private String message;
HbErrorCode(String code, String message) {
this.code = code;
this.message = message;
}
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;
}
}
package com.gic.sql.check.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gic.sql.check.entity.TabSqlCheckProject;
/**
* <p>
* Mapper 接口
* </p>
*
* @author mybatis
* @since 2020-10-15
*/
public interface SqlCheckProjectMapper extends BaseMapper<TabSqlCheckProject> {
}
package com.gic.sql.check.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gic.sql.check.entity.TabSqlCheckSql;
/**
* <p>
* Mapper 接口
* </p>
*
* @author mybatis
* @since 2020-10-15
*/
public interface SqlCheckSqlMapper extends BaseMapper<TabSqlCheckSql> {
}
package com.gic.sql.check.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gic.sql.check.entity.TabSqlCheckTable;
/**
* <p>
* Mapper 接口
* </p>
*
* @author mybatis
* @since 2020-10-15
*/
public interface SqlCheckTableMapper extends BaseMapper<TabSqlCheckTable> {
}
package com.gic.sql.check.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gic.sql.check.entity.TabSqlCheckProject;
/**
* <p>
* 服务类
* </p>
*
* @author mybatis
* @since 2020-10-15
*/
public interface SqlCheckProjectService extends IService<TabSqlCheckProject> {
TabSqlCheckProject getByProjectCode(String project);
}
package com.gic.sql.check.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gic.api.base.commons.Page;
import com.gic.hb.base.common.BasePageInfo;
import com.gic.sql.check.dto.TabSqlCheckDTO;
import com.gic.sql.check.entity.TabSqlCheckSql;
/**
* <p>
* 服务类
* </p>
*
* @author mybatis
* @since 2020-10-15
*/
public interface SqlCheckSqlService extends IService<TabSqlCheckSql> {
void saveByKey(String sqlKey, String sql, String project, String table, Integer sqlCheckTableId,
Integer sqlCheckProjectId);
Page<TabSqlCheckDTO> listByParams(String startDate, String endDate, String project, BasePageInfo pageInfo);
}
package com.gic.sql.check.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gic.sql.check.entity.TabSqlCheckTable;
/**
* <p>
* 服务类
* </p>
*
* @author mybatis
* @since 2020-10-15
*/
public interface SqlCheckTableService extends IService<TabSqlCheckTable> {
TabSqlCheckTable getByTableCode(String table);
}
package com.gic.sql.check.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gic.sql.check.entity.TabSqlCheckProject;
import com.gic.sql.check.mapper.SqlCheckProjectMapper;
import com.gic.sql.check.service.SqlCheckProjectService;
import java.util.Date;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author mybatis
* @since 2020-10-15
*/
@Service
public class SqlCheckProjectServiceImpl extends ServiceImpl<SqlCheckProjectMapper, TabSqlCheckProject> implements SqlCheckProjectService {
@Override
public TabSqlCheckProject getByProjectCode(String project) {
QueryWrapper<TabSqlCheckProject> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(TabSqlCheckProject::getSqlCheckProjectName,project);
queryWrapper.lambda().eq(TabSqlCheckProject::getDeleteFlag,0);
TabSqlCheckProject tab = this.getOne(queryWrapper);
if(tab == null){
tab = new TabSqlCheckProject();
tab.setCreateTime(new Date());
tab.setDeleteFlag(0);
tab.setSqlCheckProjectName(project);
tab.setUpdateTime(new Date());
this.save(tab);
}
return tab;
}
}
package com.gic.sql.check.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.hb.base.common.BasePageInfo;
import com.gic.sql.check.dto.TabSqlCheckDTO;
import com.gic.sql.check.entity.TabSqlCheckSql;
import com.gic.sql.check.mapper.SqlCheckSqlMapper;
import com.gic.sql.check.service.SqlCheckSqlService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import java.util.Date;
import java.util.List;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author mybatis
* @since 2020-10-15
*/
@Service
public class SqlCheckSqlServiceImpl extends ServiceImpl<SqlCheckSqlMapper, TabSqlCheckSql> implements SqlCheckSqlService {
@Override
public void saveByKey(String sqlKey, String sql, String project, String table, Integer sqlCheckTableId,
Integer sqlCheckProjectId) {
QueryWrapper<TabSqlCheckSql> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(TabSqlCheckSql::getSqlCheckSqlKey,sqlKey);
queryWrapper.lambda().eq(TabSqlCheckSql::getDeleteFlag,0);
TabSqlCheckSql tab = this.getOne(queryWrapper);
if(tab != null){
return;
}
tab = new TabSqlCheckSql();
tab.setCreateTime(new Date());
tab.setSqlCheckProjectId(sqlCheckProjectId);
tab.setSqlCheckProjectName(project);
tab.setDeleteFlag(0);
tab.setSqlCheckSql(sql);
tab.setSqlCheckSqlKey(sqlKey);
tab.setSqlCheckTableId(sqlCheckTableId);
tab.setSqlCheckTableName(table);
tab.setUpdateTime(new Date());
this.save(tab);
}
@Override
public Page<TabSqlCheckDTO> listByParams(String startDate, String endDate, String project, BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo);
QueryWrapper<TabSqlCheckSql> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(TabSqlCheckSql::getSqlCheckProjectName,project);
queryWrapper.lambda().eq(TabSqlCheckSql::getDeleteFlag,0);
queryWrapper.lambda().between(TabSqlCheckSql::getCreateTime, startDate, endDate);
List<TabSqlCheckSql> list = this.list(queryWrapper);
PageInfo<TabSqlCheckSql> resPage = new PageInfo<>(list);
Page<TabSqlCheckDTO> page = new Page<>();
page.setPageSize(pageInfo.getPageSize());
page.setCurrentPage(pageInfo.getPageNum());
page.setTotalCount((int)resPage.getTotal());
page.setTotalPage(resPage.getPages());
page.setResult(EntityUtil.changeEntityListByJSON(TabSqlCheckDTO.class, resPage.getList()));
return page;
}
}
package com.gic.sql.check.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gic.sql.check.entity.TabSqlCheckTable;
import com.gic.sql.check.mapper.SqlCheckTableMapper;
import com.gic.sql.check.service.SqlCheckTableService;
import java.util.Date;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author mybatis
* @since 2020-10-15
*/
@Service
public class SqlCheckTableServiceImpl extends ServiceImpl<SqlCheckTableMapper, TabSqlCheckTable> implements SqlCheckTableService {
@Override
public TabSqlCheckTable getByTableCode(String table) {
QueryWrapper<TabSqlCheckTable> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(TabSqlCheckTable::getSqlCheckTableName,table);
queryWrapper.lambda().eq(TabSqlCheckTable::getDeleteFlag,0);
TabSqlCheckTable tab = this.getOne(queryWrapper);
if(tab == null){
tab = new TabSqlCheckTable();
tab.setCreateTime(new Date());
tab.setDeleteFlag(0);
tab.setSqlCheckTableName(table);
tab.setUpdateTime(new Date());
this.save(tab);
}
return tab;
}
}
package com.gic.sql.check.service.outer;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.hb.base.common.BasePageInfo;
import com.gic.sql.check.dto.TabSqlCheckDTO;
public interface SqlCheckApiService {
/**
* my回调
* @param res
*/
void mqSqlCheck(String res);
/**
* 查询sql
* @param startDate
* @param endDate
* @param project
* @param pageInfo
* @return
*/
ServiceResponse<Page<TabSqlCheckDTO>> listByParams(String startDate, String endDate, String project,
BasePageInfo pageInfo);
}
package com.gic.sql.check.service.outer.impl;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.hb.base.common.BasePageInfo;
import com.gic.sql.check.dto.TabSqlCheckDTO;
import com.gic.sql.check.entity.TabSqlCheckProject;
import com.gic.sql.check.service.SqlCheckProjectService;
import com.gic.sql.check.service.SqlCheckSqlService;
import com.gic.sql.check.service.outer.SqlCheckApiService;
@Service
public class SqlCheckApiServiceImpl implements SqlCheckApiService {
private static Logger logger= LoggerFactory.getLogger(SqlCheckApiServiceImpl.class);
@Autowired
private SqlCheckProjectService sqlCheckProjectService;
// @Autowired
// private SqlCheckTableService sqlCheckTableService;
@Autowired
private SqlCheckSqlService sqlCheckSqlService;
@Override
public void mqSqlCheck(String res){
if(StringUtils.isBlank(res)){
logger.info("参数为空");
return ;
}
JSONObject json = JSON.parseObject(res);
String sqlKey = json.getString("sqlKey");
String sql = json.getString("sql");
String project = json.getString("project");
String table = json.getString("table");
TabSqlCheckProject sqlCheckProject = sqlCheckProjectService.getByProjectCode(project);
sqlCheckSqlService.saveByKey(sqlKey,sql,project,table,-1,sqlCheckProject.getSqlCheckProjectId());
}
@Override
public ServiceResponse<Page<TabSqlCheckDTO>> listByParams(String startDate, String endDate, String project,
BasePageInfo pageInfo) {
return ServiceResponse.success(sqlCheckSqlService.listByParams(startDate,endDate,project,pageInfo));
}
}
server:
port: 8714
servlet:
context-path: /sql-check-web
tomcat:
uri-encoding: UTF-8
spring:
jackson:
serialization:
# 以时间戳返回日期
write-dates-as-timestamps: true
http:
encoding:
charset: UTF-8
enabled: true
force: true
main:
allow-bean-definition-overriding: true
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="classpath:applicationContext-init.xml"/>
<import resource="classpath:dubbo-sql-check-web.xml"/>
<import resource="classpath*:dubbo-setting.xml"/>
<import resource="classpath:jdbc-sql-check.xml"/>
</beans>
\ No newline at end of file
dubbo.registry.file=db-contacts-service
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<context:component-scan base-package="com.gic.sql.check.*"/>
<!-- 应用名称 -->
<dubbo:application name="hb-sql-select-web"/>
<dubbo:service interface="com.gic.sql.check.service.outer.SqlCheckApiService" ref="sqlCheckApiServiceImpl" />
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:apollo="http://www.ctrip.com/schema/apollo"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.ctrip.com/schema/apollo
http://www.ctrip.com/schema/apollo.xsd">
<context:annotation-config/>
<import resource="classpath:applicationContext-db-only.xml"/>
<!-- <import resource="classpath*:jdbc-config.xml"/> -->
<bean class="com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean" id="sqlSessionFactory">
<property name="dataSource" ref="dataSource"/>
<property name="typeAliasesPackage" value="com.gic.sql.check.**.entity"/>
<property name="mapperLocations" value="classpath*:mapper/*.xml"/>
<property name="plugins">
<array>
<!-- 自动生成id -->
<bean class="com.gic.commons.plugin.mybatis.AutoIdInterceptor"/>
<!-- <bean class="com.gic.hb.sql.interceptor.MybatisSqlInterceptor"></bean> -->
<!-- 分页插件 -->
<bean class="com.github.pagehelper.PageInterceptor">
<property name="properties">
<value>
helperDialect=mysql
</value>
</property>
</bean>
</array>
</property>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.gic.sql.check.**.mapper"/>
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>
<bean class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- 事务管理器 -->
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<tx:annotation-driven transaction-manager="txManager"/>
</beans>
\ No newline at end of file
<?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.gic.hb.manage.service.dao.mapper.SqlCheckProjectMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.gic.sql.check.entity.TabSqlCheckProject">
<result column="sql_check_project_id" property="sqlCheckProjectId" />
<result column="sql_check_project_name" property="sqlCheckProjectName" />
<result column="del_flag" property="delFlag" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
sql_check_project_id, sql_check_project_name, del_flag, create_time, update_time
</sql>
</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.gic.hb.manage.service.dao.mapper.SqlCheckSqlMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.gic.sql.check.entity.TabSqlCheckSql">
<id column="sql_check_sql_id" property="sqlCheckSqlId" />
<result column="sql_check_sql_key" property="sqlCheckSqlKey" />
<result column="sql_check_sql" property="sqlCheckSql" />
<result column="sql_check_table_id" property="sqlCheckTableId" />
<result column="sql_check_project_id" property="sqlCheckProjectId" />
<result column="del_flag" property="delFlag" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
sql_check_sql_id, sql_check_sql_key, sql_check_sql, sql_check_table_id, sql_check_project_id, del_flag, create_time, update_time
</sql>
</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.gic.hb.manage.service.dao.mapper.SqlCheckTableMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.gic.sql.check.entity.TabSqlCheckTable">
<id column="sql_check_table_id" property="sqlCheckTableId" />
<result column="sql_check_table_name" property="sqlCheckTableName" />
<result column="del_flag" property="delFlag" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
sql_check_table_id, sql_check_table_name, del_flag, create_time, update_time
</sql>
</mapper>
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