Преглед на файлове

Merge branch 'release/1.6.0'

tianyunperfect преди 4 години
родител
ревизия
a4aaf41fe7

+ 0 - 12
app/pom.xml

@@ -63,18 +63,6 @@
             <version>3.3.7</version>
         </dependency>
 
-        <!--mybatis springboot自动配置-->
-        <dependency>
-            <groupId>org.mybatis.spring.boot</groupId>
-            <artifactId>mybatis-spring-boot-starter</artifactId>
-            <version>1.1.1</version>
-            <exclusions>
-                <exclusion>
-                    <artifactId>mybatis</artifactId>
-                    <groupId>org.mybatis</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
         <!--dao层mybatis-->
         <dependency>
             <groupId>com.alvin</groupId>

+ 21 - 19
app/src/main/resources/application-dev.yml

@@ -9,25 +9,27 @@ spring:
     username: xxx
     password: xxx
     #下面为连接池补充设置
-    initialSize: 5
-    # 配置获取连接等待超时的时间
-    maxWait: 60000
-    # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
-    timeBetweenEvictionRunsMillis: 60000
-    # 配置一个连接在池中最小生存的时间,单位是毫秒
-    minEvictableIdleTimeMillis: 300000
-    validationQuery: SELECT 1 FROM DUAL
-    testWhileIdle: true
-    testOnBorrow: false
-    testOnReturn: false
-    # 打开PSCache,并且指定每个连接上PSCache的大小
-    poolPreparedStatements: true
-    # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
-    filters: stat,wall
-    # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
-    connectionProperties: config.stat.mergeSql=true;config.stat.slowSqlMillis=5000
-    # 合并多个DruidDataSource的监控数据
-    useGlobalDataSourceStat: true
+    druid:
+      initial-size: 5 # 初始化
+      max-active: 5 # 最大
+      min-idle: 5 # 最小
+      max-wait: 6000 # 超时时间
+      time-between-eviction-runs-millis: 60000 # 每分钟检查一次空闲链接
+      min-evictable-idle-time-millis: 300000 # 空闲链接可以保持多久而不被驱逐
+      # 检测链接是否有效的query
+      validation-query: SELECT 1 FROM DUAL
+      test-while-idle: true # 检测到链接空闲时,验证是否有效
+      test-on-borrow: false # 申请链接时,不检测
+      test-on-return: false # 返回链接时,不检测
+      pool-prepared-statements: false # 是否缓存preparedStatement,oracle打开,mysql关闭
+      # 如果上面开启了游标,这里要设置一下大小,例如 50
+      max-pool-prepared-statement-per-connection-size: -1
+      # 统计、监控配置
+      filters: stat,wall # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      # 合并执行的相同sql,避免因为参数不同而统计多条sql语句;开启慢sql记录
+      connect-properties: config.stat.mergeSql=true;config.stat.slowSqlMillis=500
+      use-global-data-source-stat: true # 合并多个DruidDataSource的监控数据
+
 
 
 mybatis:

+ 369 - 0
common/src/main/java/com/alvin/common/util/HttpUtil.java

@@ -0,0 +1,369 @@
+package com.alvin.common.util;
+
+import com.google.gson.Gson;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.http.*;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.cookie.Cookie;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.BasicCookieStore;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.impl.cookie.BasicClientCookie;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import java.io.BufferedOutputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 我的utils封装
+ * 读取设置:url、cookies、params
+ * 读取:response
+ * 设置 proxy、header、超时时间
+ *
+ * @author Mark
+ */
+
+@Data
+@Accessors(chain = true)
+public class HttpUtil {
+
+
+    /** 代理  */
+    private HttpHost proxy;
+
+    /** 超时时间 5秒  */
+    private Integer connectTimeout = 5000;
+
+    /** header  */
+    private HashMap<String, String> headerMap;
+
+    /** urlStr  */
+    private String urlStr;
+
+    private BasicCookieStore cookieStore = new BasicCookieStore();
+
+    private RequestConfig config;
+
+    private HttpResponse httpResponse;
+    /**
+     * params参数
+     */
+    private List<NameValuePair> nameValuePairs = new ArrayList<>();
+
+    public HttpUtil(String urlStr) {
+        // 5秒
+        this.urlStr = urlStr;
+    }
+
+    /**
+     * 给url设置参数
+     *
+     * @param paramsMap
+     * @throws URISyntaxException
+     */
+    public HttpUtil setParams(HashMap<String, String> paramsMap){
+        for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
+            nameValuePairs.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
+        }
+        return this;
+    }
+
+    /**
+     * 获取get请求结果
+     *
+     * @return
+     * @throws IOException
+     */
+    public String get() throws Exception {
+        return getExecuteResult(getHttpGet());
+    }
+
+    /**
+     * 获取post请求结果
+     *
+     * @param dataMap
+     * @return
+     * @throws IOException
+     */
+    public String post(HashMap<String, String> dataMap) throws Exception {
+        HttpPost httpPost = getHttpPost();
+
+        //解决中文乱码
+        httpPost.setHeader("Content-Type", "text/html; charset=UTF-8");
+        // 添加data
+        if (dataMap != null) {
+            List<NameValuePair> nameValuePairs = new ArrayList<>();
+            for (Map.Entry<String, String> entry : dataMap.entrySet()) {
+                nameValuePairs.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
+            }
+            UrlEncodedFormEntity urlEncodedFormEntity = new UrlEncodedFormEntity(nameValuePairs, "utf-8");
+            httpPost.setEntity(urlEncodedFormEntity);
+        }
+        return getExecuteResult(httpPost);
+    }
+
+    /**
+     * 发送json请求
+     * @param object
+     * @return
+     * @throws Exception
+     */
+    public String postJson(Object object) throws Exception {
+        HttpPost httpPost = getHttpPost();
+        //解决中文乱码
+        httpPost.setHeader("Content-Type", "application/json;charset=UTF-8");
+        if (object != null) {
+            StringEntity entity = new StringEntity(new Gson().toJson(object), "utf-8");
+            httpPost.setEntity(entity);
+        }
+        return getExecuteResult(httpPost);
+    }
+
+    /**
+     * 处理get和post请求,返回html
+     *
+     * @param httpUriRequest
+     * @return
+     * @throws IOException
+     */
+    private String getExecuteResult(HttpUriRequest httpUriRequest) throws IOException {
+        String returnStr;
+        //获取一个链接
+        CloseableHttpClient httpClient = HttpClients.custom()
+                //.setConnectionManager(connectionManager)
+                .setDefaultCookieStore(cookieStore).build();
+
+        //设置header
+        httpUriRequest.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36");
+        if (headerMap != null) {
+            for (Map.Entry<String, String> entry : headerMap.entrySet()) {
+                httpUriRequest.setHeader(entry.getKey(), entry.getValue());
+            }
+        }
+
+        httpResponse = httpClient.execute(httpUriRequest);
+        //获取返回结果中的实体
+        HttpEntity entity = httpResponse.getEntity();
+        //判断是否失败
+        if (httpResponse.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
+            returnStr = null;
+        } else {
+            //查看页面内容结果
+            String rawHTMLContent = EntityUtils.toString(entity, "utf-8");
+            returnStr = decodeUnicode(rawHTMLContent);
+        }
+        //关闭HttpEntity流
+        EntityUtils.consume(entity);
+        return returnStr;
+    }
+
+    /**
+     * 设置cookies
+     *
+     * @param cookieMap
+     */
+    public void setCookies(HashMap<String, String> cookieMap) {
+        for (Map.Entry<String, String> entry : cookieMap.entrySet()) {
+            BasicClientCookie clientCookie = new BasicClientCookie(entry.getKey(), entry.getValue());
+            cookieStore.addCookie(clientCookie);
+        }
+    }
+
+    /**
+     * 获取cookies
+     *
+     * @return
+     */
+    public List<Cookie> getCookies() {
+        return cookieStore.getCookies();
+    }
+
+    private HttpGet getHttpGet() throws Exception {
+        URIBuilder uriBuilder = new URIBuilder(urlStr);
+        if (nameValuePairs.size() > 0) {
+            uriBuilder.addParameters(nameValuePairs);
+        }
+        URI uri = uriBuilder.build();
+        HttpGet httpGet = new HttpGet(uri);
+
+        httpGet.setConfig(getConfig());
+        return httpGet;
+    }
+
+    private HttpPost getHttpPost() throws Exception {
+        URIBuilder uriBuilder = new URIBuilder(urlStr);
+        if (nameValuePairs.size() > 0) {
+            uriBuilder.addParameters(nameValuePairs);
+        }
+        URI uri = uriBuilder.build();
+        HttpPost httpPost = new HttpPost(uri);
+        httpPost.setConfig(getConfig());
+        return httpPost;
+    }
+
+    public boolean getDownLoad(String filePath) throws Exception {
+        return downLoadFile(getHttpGet(), filePath);
+    }
+    public boolean PostDownLoad(String filePath) throws Exception {
+        return downLoadFile(getHttpPost(), filePath);
+    }
+    /**
+     * 下载文件到指定路径
+     *
+     * @param httpUriRequest
+     * @param filePath
+     * @return
+     */
+    private boolean downLoadFile(HttpUriRequest httpUriRequest, String filePath) throws IOException {
+        CloseableHttpClient httpClient = HttpClients.custom()
+                //.setConnectionManager(connectionManager)
+                .setDefaultCookieStore(cookieStore).build();
+
+        HttpResponse httpResponse = httpClient.execute(httpUriRequest);
+        //判断是否失败
+        if (httpResponse.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
+            return false;
+        }
+        //获取返回结果中的实体
+        HttpEntity entity = httpResponse.getEntity();
+
+        //存储
+        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath));
+        entity.writeTo(bos);
+
+        bos.close();
+        //关闭HttpEntity流
+        EntityUtils.consume(entity);
+        return true;
+    }
+
+
+
+    /**
+     * 设置代理服务器
+     *
+     * @param ip
+     * @param port
+     * @param httpType
+     */
+    public HttpUtil setProxy(String ip, int port, String httpType) {
+        this.proxy = new HttpHost(ip, port, httpType);
+        return this;
+    }
+
+    private RequestConfig getConfig() {
+        RequestConfig.Builder custom = RequestConfig.custom();
+        if (proxy != null) {
+            custom.setProxy(proxy);
+        }
+        /**
+         * 设置超时时间
+         */
+        custom.setConnectTimeout(connectTimeout)
+                .setSocketTimeout(connectTimeout)
+                .setConnectionRequestTimeout(connectTimeout);
+
+        return custom.build();
+    }
+
+    /**
+     * 解析string里面的字符串,因为只有部分需要解析,所有需要判断
+     *
+     * @param s 字符串
+     * @return
+     */
+    public String decodeUnicode(String s) {
+        char aChar;
+        int len = s.length();
+        StringBuffer outBuffer = new StringBuffer(len);
+        for (int x = 0; x < len; ) {
+            aChar = s.charAt(x++);
+            if (aChar == '\\') {
+                aChar = s.charAt(x++);
+                if (aChar == 'u') {
+                    // Read the xxxx
+                    int value = 0;
+                    for (int i = 0; i < 4; i++) {
+                        aChar = s.charAt(x++);
+                        switch (aChar) {
+                            case '0':
+                            case '1':
+                            case '2':
+                            case '3':
+                            case '4':
+                            case '5':
+                            case '6':
+                            case '7':
+                            case '8':
+                            case '9':
+                                value = (value << 4) + aChar - '0';
+                                break;
+                            case 'a':
+                            case 'b':
+                            case 'c':
+                            case 'd':
+                            case 'e':
+                            case 'f':
+                                value = (value << 4) + 10 + aChar - 'a';
+                                break;
+                            case 'A':
+                            case 'B':
+                            case 'C':
+                            case 'D':
+                            case 'E':
+                            case 'F':
+                                value = (value << 4) + 10 + aChar - 'A';
+                                break;
+                            default:
+                                throw new IllegalArgumentException(
+                                        "Malformed   \\uxxxx   encoding.");
+                        }
+
+                    }
+                    outBuffer.append((char) value);
+                } else {
+                    switch (aChar) {
+                        case 't':
+                            aChar = '\t';
+                            break;
+                        case 'r':
+                            aChar = '\r';
+                            break;
+                        case 'n':
+                            aChar = '\n';
+                            break;
+                        case 'f':
+                            aChar = '\f';
+                            break;
+                        default:
+                            break;
+                    }
+                    outBuffer.append(aChar);
+                }
+            } else {
+                outBuffer.append(aChar);
+            }
+        }
+        return outBuffer.toString();
+    }
+
+    public static void main(String[] args) throws Exception {
+        String s = new HttpUtil("https://www.baidu.com").get();
+        System.out.println(s);
+    }
+}

+ 11 - 21
dao/pom.xml

@@ -12,10 +12,19 @@
     <artifactId>dao</artifactId>
 
     <dependencies>
+
+        <!--mybatis-->
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>1.3.2</version>
+        </dependency>
         <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter</artifactId>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.1.10</version>
         </dependency>
+
         <!--common-->
         <dependency>
             <groupId>com.alvin</groupId>
@@ -28,25 +37,6 @@
             <artifactId>mysql-connector-java</artifactId>
             <version>8.0.16</version>
         </dependency>
-        <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>druid</artifactId>
-            <version>1.0.26</version>
-        </dependency>
-
-        <!--mybatis-generate-->
-        <dependency>
-            <groupId>org.mybatis.generator</groupId>
-            <artifactId>mybatis-generator-core</artifactId>
-            <version>1.3.7</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.mybatis</groupId>
-            <artifactId>mybatis</artifactId>
-            <version>3.5.3</version>
-            <scope>compile</scope>
-        </dependency>
     </dependencies>
     <build>
         <plugins>

+ 38 - 38
dao/src/main/java/com/alvin/dao/entity/Similar.java

@@ -13,7 +13,7 @@ public class Similar implements Serializable {
      * This field was generated by MyBatis Generator.
      * This field corresponds to the database column similar.id
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     private Long id;
 
@@ -22,7 +22,7 @@ public class Similar implements Serializable {
      * This field was generated by MyBatis Generator.
      * This field corresponds to the database column similar.file_name
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     private String fileName;
 
@@ -31,7 +31,7 @@ public class Similar implements Serializable {
      * This field was generated by MyBatis Generator.
      * This field corresponds to the database column similar.line_num
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     private Integer lineNum;
 
@@ -40,7 +40,7 @@ public class Similar implements Serializable {
      * This field was generated by MyBatis Generator.
      * This field corresponds to the database column similar.txt
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     private String txt;
 
@@ -49,7 +49,7 @@ public class Similar implements Serializable {
      * This field was generated by MyBatis Generator.
      * This field corresponds to the database column similar.similar_txt
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     private String similarTxt;
 
@@ -58,7 +58,7 @@ public class Similar implements Serializable {
      * This field was generated by MyBatis Generator.
      * This field corresponds to the database column similar.commit_time
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     private Date commitTime;
 
@@ -67,7 +67,7 @@ public class Similar implements Serializable {
      * This field was generated by MyBatis Generator.
      * This field corresponds to the database column similar.txt_option
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     private String txtOption;
 
@@ -75,7 +75,7 @@ public class Similar implements Serializable {
      * This field was generated by MyBatis Generator.
      * This field corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     private static final long serialVersionUID = 1L;
 
@@ -83,7 +83,7 @@ public class Similar implements Serializable {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public static Similar.Builder builder() {
         return new Similar.Builder();
@@ -93,14 +93,14 @@ public class Similar implements Serializable {
      * This class was generated by MyBatis Generator.
      * This class corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public static class Builder {
         /**
          * This field was generated by MyBatis Generator.
          * This field corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         private Similar obj;
 
@@ -108,7 +108,7 @@ public class Similar implements Serializable {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public Builder() {
             this.obj = new Similar();
@@ -120,7 +120,7 @@ public class Similar implements Serializable {
          *
          * @param id the value for similar.id
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public Builder id(Long id) {
             obj.setId(id);
@@ -133,7 +133,7 @@ public class Similar implements Serializable {
          *
          * @param fileName the value for similar.file_name
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public Builder fileName(String fileName) {
             obj.setFileName(fileName);
@@ -146,7 +146,7 @@ public class Similar implements Serializable {
          *
          * @param lineNum the value for similar.line_num
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public Builder lineNum(Integer lineNum) {
             obj.setLineNum(lineNum);
@@ -159,7 +159,7 @@ public class Similar implements Serializable {
          *
          * @param txt the value for similar.txt
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public Builder txt(String txt) {
             obj.setTxt(txt);
@@ -172,7 +172,7 @@ public class Similar implements Serializable {
          *
          * @param txtOption the value for similar.txt_option
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public Builder txtOption(String txtOption) {
             obj.setTxtOption(txtOption);
@@ -185,7 +185,7 @@ public class Similar implements Serializable {
          *
          * @param similarTxt the value for similar.similar_txt
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public Builder similarTxt(String similarTxt) {
             obj.setSimilarTxt(similarTxt);
@@ -198,7 +198,7 @@ public class Similar implements Serializable {
          *
          * @param commitTime the value for similar.commit_time
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public Builder commitTime(Date commitTime) {
             obj.setCommitTime(commitTime);
@@ -209,7 +209,7 @@ public class Similar implements Serializable {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public Similar build() {
             return this.obj;
@@ -220,7 +220,7 @@ public class Similar implements Serializable {
      * This enum was generated by MyBatis Generator.
      * This enum corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public enum Column {
         id("id", "id", "BIGINT", false),
@@ -235,7 +235,7 @@ public class Similar implements Serializable {
          * This field was generated by MyBatis Generator.
          * This field corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         private static final String BEGINNING_DELIMITER = "\"";
 
@@ -243,7 +243,7 @@ public class Similar implements Serializable {
          * This field was generated by MyBatis Generator.
          * This field corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         private static final String ENDING_DELIMITER = "\"";
 
@@ -251,7 +251,7 @@ public class Similar implements Serializable {
          * This field was generated by MyBatis Generator.
          * This field corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         private final String column;
 
@@ -259,7 +259,7 @@ public class Similar implements Serializable {
          * This field was generated by MyBatis Generator.
          * This field corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         private final boolean isColumnNameDelimited;
 
@@ -267,7 +267,7 @@ public class Similar implements Serializable {
          * This field was generated by MyBatis Generator.
          * This field corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         private final String javaProperty;
 
@@ -275,7 +275,7 @@ public class Similar implements Serializable {
          * This field was generated by MyBatis Generator.
          * This field corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         private final String jdbcType;
 
@@ -283,7 +283,7 @@ public class Similar implements Serializable {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public String value() {
             return this.column;
@@ -293,7 +293,7 @@ public class Similar implements Serializable {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public String getValue() {
             return this.column;
@@ -303,7 +303,7 @@ public class Similar implements Serializable {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public String getJavaProperty() {
             return this.javaProperty;
@@ -313,7 +313,7 @@ public class Similar implements Serializable {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public String getJdbcType() {
             return this.jdbcType;
@@ -323,7 +323,7 @@ public class Similar implements Serializable {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
             this.column = column;
@@ -336,7 +336,7 @@ public class Similar implements Serializable {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public String desc() {
             return this.getEscapedColumnName() + " DESC";
@@ -346,7 +346,7 @@ public class Similar implements Serializable {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public String asc() {
             return this.getEscapedColumnName() + " ASC";
@@ -356,7 +356,7 @@ public class Similar implements Serializable {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public static Column[] excludes(Column ... excludes) {
             ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
@@ -370,7 +370,7 @@ public class Similar implements Serializable {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public static Column[] all() {
             return Column.values();
@@ -380,7 +380,7 @@ public class Similar implements Serializable {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public String getEscapedColumnName() {
             if (this.isColumnNameDelimited) {
@@ -394,7 +394,7 @@ public class Similar implements Serializable {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public String getAliasedEscapedColumnName() {
             return this.getEscapedColumnName();

+ 40 - 40
dao/src/main/java/com/alvin/dao/entity/example/SimilarExample.java

@@ -10,7 +10,7 @@ public class SimilarExample {
      * This field was generated by MyBatis Generator.
      * This field corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     protected String orderByClause;
 
@@ -18,7 +18,7 @@ public class SimilarExample {
      * This field was generated by MyBatis Generator.
      * This field corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     protected boolean distinct;
 
@@ -26,7 +26,7 @@ public class SimilarExample {
      * This field was generated by MyBatis Generator.
      * This field corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     protected List<Criteria> oredCriteria;
 
@@ -34,7 +34,7 @@ public class SimilarExample {
      * This field was generated by MyBatis Generator.
      * This field corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     protected Integer offset;
 
@@ -42,7 +42,7 @@ public class SimilarExample {
      * This field was generated by MyBatis Generator.
      * This field corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     protected Integer rows;
 
@@ -50,7 +50,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public SimilarExample() {
         oredCriteria = new ArrayList<Criteria>();
@@ -60,7 +60,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public void setOrderByClause(String orderByClause) {
         this.orderByClause = orderByClause;
@@ -70,7 +70,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public String getOrderByClause() {
         return orderByClause;
@@ -80,7 +80,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public void setDistinct(boolean distinct) {
         this.distinct = distinct;
@@ -90,7 +90,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public boolean isDistinct() {
         return distinct;
@@ -100,7 +100,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public List<Criteria> getOredCriteria() {
         return oredCriteria;
@@ -110,7 +110,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public void or(Criteria criteria) {
         oredCriteria.add(criteria);
@@ -120,7 +120,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public Criteria or() {
         Criteria criteria = createCriteriaInternal();
@@ -132,7 +132,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public SimilarExample orderBy(String orderByClause) {
         this.setOrderByClause(orderByClause);
@@ -143,7 +143,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public SimilarExample orderBy(String ... orderByClauses) {
         StringBuffer sb = new StringBuffer();
@@ -161,7 +161,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public Criteria createCriteria() {
         Criteria criteria = createCriteriaInternal();
@@ -175,7 +175,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     protected Criteria createCriteriaInternal() {
         Criteria criteria = new Criteria(this);
@@ -186,7 +186,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public void clear() {
         oredCriteria.clear();
@@ -200,7 +200,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public void setOffset(Integer offset) {
         this.offset = offset;
@@ -210,7 +210,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public Integer getOffset() {
         return this.offset;
@@ -220,7 +220,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public void setRows(Integer rows) {
         this.rows = rows;
@@ -230,7 +230,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public Integer getRows() {
         return this.rows;
@@ -240,7 +240,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public SimilarExample limit(Integer rows) {
         this.rows = rows;
@@ -251,7 +251,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public SimilarExample limit(Integer offset, Integer rows) {
         this.offset = offset;
@@ -263,7 +263,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public SimilarExample page(Integer page, Integer pageSize) {
         this.offset = page * pageSize;
@@ -275,7 +275,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public static Criteria newAndCreateCriteria() {
         SimilarExample example = new SimilarExample();
@@ -286,7 +286,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public SimilarExample when(boolean condition, IExampleWhen then) {
         if (condition) {
@@ -299,7 +299,7 @@ public class SimilarExample {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public SimilarExample when(boolean condition, IExampleWhen then, IExampleWhen otherwise) {
         if (condition) {
@@ -314,7 +314,7 @@ public class SimilarExample {
      * This class was generated by MyBatis Generator.
      * This class corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     protected abstract static class GeneratedCriteria {
         protected List<Criterion> criteria;
@@ -1032,14 +1032,14 @@ public class SimilarExample {
      * This class was generated by MyBatis Generator.
      * This class corresponds to the database table similar
      *
-     * @mbg.generated do_not_delete_during_merge Wed May 27 15:17:38 CST 2020
+     * @mbg.generated do_not_delete_during_merge Thu Aug 20 14:29:45 CST 2020
      */
     public static class Criteria extends GeneratedCriteria {
         /**
          * This field was generated by MyBatis Generator.
          * This field corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         private SimilarExample example;
 
@@ -1047,7 +1047,7 @@ public class SimilarExample {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         protected Criteria(SimilarExample example) {
             super();
@@ -1058,7 +1058,7 @@ public class SimilarExample {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public SimilarExample example() {
             return this.example;
@@ -1068,7 +1068,7 @@ public class SimilarExample {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         @Deprecated
         public Criteria andIf(boolean ifAdd, ICriteriaAdd add) {
@@ -1082,7 +1082,7 @@ public class SimilarExample {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public Criteria when(boolean condition, ICriteriaWhen then) {
             if (condition) {
@@ -1095,7 +1095,7 @@ public class SimilarExample {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         public Criteria when(boolean condition, ICriteriaWhen then, ICriteriaWhen otherwise) {
             if (condition) {
@@ -1112,7 +1112,7 @@ public class SimilarExample {
              * This method was generated by MyBatis Generator.
              * This method corresponds to the database table similar
              *
-             * @mbg.generated Wed May 27 15:17:38 CST 2020
+             * @mbg.generated Thu Aug 20 14:29:45 CST 2020
              */
             Criteria add(Criteria add);
         }
@@ -1122,7 +1122,7 @@ public class SimilarExample {
      * This class was generated by MyBatis Generator.
      * This class corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     public static class Criterion {
         private String condition;
@@ -1215,7 +1215,7 @@ public class SimilarExample {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         void criteria(Criteria criteria);
     }
@@ -1225,7 +1225,7 @@ public class SimilarExample {
          * This method was generated by MyBatis Generator.
          * This method corresponds to the database table similar
          *
-         * @mbg.generated Wed May 27 15:17:38 CST 2020
+         * @mbg.generated Thu Aug 20 14:29:45 CST 2020
          */
         void example(com.alvin.dao.entity.example.SimilarExample example);
     }

+ 55 - 16
dao/src/main/java/com/alvin/dao/mapper/SimilarMapper.java

@@ -2,12 +2,11 @@ package com.alvin.dao.mapper;
 
 import com.alvin.dao.entity.Similar;
 import com.alvin.dao.entity.example.SimilarExample;
+import java.util.List;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
-import java.util.List;
-
 @Mapper
 @Repository
 public interface SimilarMapper {
@@ -15,7 +14,7 @@ public interface SimilarMapper {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     long countByExample(SimilarExample example);
 
@@ -23,7 +22,7 @@ public interface SimilarMapper {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     int deleteByExample(SimilarExample example);
 
@@ -31,7 +30,15 @@ public interface SimilarMapper {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
+     */
+    int deleteByPrimaryKey(Long id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table similar
+     *
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     int insert(Similar record);
 
@@ -39,7 +46,7 @@ public interface SimilarMapper {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     int insertSelective(@Param("record") Similar record, @Param("selective") Similar.Column ... selective);
 
@@ -47,7 +54,7 @@ public interface SimilarMapper {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     Similar selectOneByExample(SimilarExample example);
 
@@ -55,7 +62,7 @@ public interface SimilarMapper {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     Similar selectOneByExampleSelective(@Param("example") SimilarExample example, @Param("selective") Similar.Column ... selective);
 
@@ -63,7 +70,7 @@ public interface SimilarMapper {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     List<Similar> selectByExampleSelective(@Param("example") SimilarExample example, @Param("selective") Similar.Column ... selective);
 
@@ -71,7 +78,7 @@ public interface SimilarMapper {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     List<Similar> selectByExample(SimilarExample example);
 
@@ -79,7 +86,23 @@ public interface SimilarMapper {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
+     */
+    Similar selectByPrimaryKeySelective(@Param("id") Long id, @Param("selective") Similar.Column ... selective);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table similar
+     *
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
+     */
+    Similar selectByPrimaryKey(Long id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table similar
+     *
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     int updateByExampleSelective(@Param("record") Similar record, @Param("example") SimilarExample example, @Param("selective") Similar.Column ... selective);
 
@@ -87,7 +110,7 @@ public interface SimilarMapper {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     int updateByExample(@Param("record") Similar record, @Param("example") SimilarExample example);
 
@@ -95,7 +118,23 @@ public interface SimilarMapper {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
+     */
+    int updateByPrimaryKeySelective(@Param("record") Similar record, @Param("selective") Similar.Column ... selective);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table similar
+     *
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
+     */
+    int updateByPrimaryKey(Similar record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table similar
+     *
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     int batchInsert(@Param("list") List<Similar> list);
 
@@ -103,7 +142,7 @@ public interface SimilarMapper {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     int batchInsertSelective(@Param("list") List<Similar> list, @Param("selective") Similar.Column ... selective);
 
@@ -111,7 +150,7 @@ public interface SimilarMapper {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     int upsert(Similar record);
 
@@ -119,7 +158,7 @@ public interface SimilarMapper {
      * This method was generated by MyBatis Generator.
      * This method corresponds to the database table similar
      *
-     * @mbg.generated Wed May 27 15:17:38 CST 2020
+     * @mbg.generated Thu Aug 20 14:29:45 CST 2020
      */
     int upsertSelective(@Param("record") Similar record, @Param("selective") Similar.Column ... selective);
 }

+ 166 - 53
dao/src/main/resources/mapper/SimilarMapper.xml

@@ -5,9 +5,9 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
-    <result column="id" jdbcType="BIGINT" property="id" />
+    <id column="id" jdbcType="BIGINT" property="id" />
     <result column="file_name" jdbcType="VARCHAR" property="fileName" />
     <result column="line_num" jdbcType="INTEGER" property="lineNum" />
     <result column="txt" jdbcType="VARCHAR" property="txt" />
@@ -19,7 +19,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
     <where>
       <foreach collection="oredCriteria" item="criteria" separator="or">
@@ -53,7 +53,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
     <where>
       <foreach collection="example.oredCriteria" item="criteria" separator="or">
@@ -87,7 +87,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
     id, file_name, line_num, txt, similar_txt, commit_time, txt_option
   </sql>
@@ -95,7 +95,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
     select
     <if test="distinct">
@@ -122,7 +122,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
     select
     <if test="example != null and example.distinct">
@@ -154,11 +154,51 @@
       </if>
     </if>
   </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from similar
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
+    -->
+    select
+    <choose>
+      <when test="selective != null and selective.length &gt; 0">
+        <foreach collection="selective" item="column" separator=",">
+          ${column.aliasedEscapedColumnName}
+        </foreach>
+      </when>
+      <otherwise>
+        <include refid="Base_Column_List" />
+      </otherwise>
+    </choose>
+    from similar
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
+    -->
+    delete from similar
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
   <delete id="deleteByExample" parameterType="com.alvin.dao.entity.example.SimilarExample">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
     delete from similar
     <if test="_parameter != null">
@@ -169,21 +209,27 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
-    insert into similar (id, file_name, line_num, 
-      txt, similar_txt, commit_time, 
-      txt_option)
-    values (#{id,jdbcType=BIGINT}, #{fileName,jdbcType=VARCHAR}, #{lineNum,jdbcType=INTEGER}, 
-      #{txt,jdbcType=VARCHAR}, #{similarTxt,jdbcType=VARCHAR}, #{commitTime,jdbcType=TIMESTAMP}, 
-      #{txtOption,jdbcType=VARCHAR})
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into similar (file_name, line_num, txt, 
+      similar_txt, commit_time, txt_option
+      )
+    values (#{fileName,jdbcType=VARCHAR}, #{lineNum,jdbcType=INTEGER}, #{txt,jdbcType=VARCHAR}, 
+      #{similarTxt,jdbcType=VARCHAR}, #{commitTime,jdbcType=TIMESTAMP}, #{txtOption,jdbcType=VARCHAR}
+      )
   </insert>
   <insert id="insertSelective" parameterType="map">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
+    <selectKey keyProperty="record.id" order="AFTER" resultType="java.lang.Long">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
     insert into similar
     <choose>
       <when test="selective != null and selective.length &gt; 0">
@@ -193,9 +239,6 @@
       </when>
       <otherwise>
         <trim prefix="(" suffix=")" suffixOverrides=",">
-          <if test="record.id != null">
-            id,
-          </if>
           <if test="record.fileName != null">
             file_name,
           </if>
@@ -227,9 +270,6 @@
       </when>
       <otherwise>
         <trim prefix="(" suffix=")" suffixOverrides=",">
-          <if test="record.id != null">
-            #{record.id,jdbcType=BIGINT},
-          </if>
           <if test="record.fileName != null">
             #{record.fileName,jdbcType=VARCHAR},
           </if>
@@ -256,7 +296,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
     select count(*) from similar
     <if test="_parameter != null">
@@ -267,7 +307,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
     update similar
     SET
@@ -311,7 +351,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
     update similar
     set id = #{record.id,jdbcType=BIGINT},
@@ -325,11 +365,65 @@
       <include refid="Update_By_Example_Where_Clause" />
     </if>
   </update>
+  <update id="updateByPrimaryKeySelective" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
+    -->
+    update similar
+    SET
+    <choose>
+      <when test="selective != null and selective.length &gt; 0">
+        <foreach collection="selective" item="column" separator=",">
+          ${column.escapedColumnName} = #{record.${column.javaProperty},jdbcType=${column.jdbcType}}
+        </foreach>
+      </when>
+      <otherwise>
+        <trim suffixOverrides=",">
+          <if test="record.fileName != null">
+            file_name = #{record.fileName,jdbcType=VARCHAR},
+          </if>
+          <if test="record.lineNum != null">
+            line_num = #{record.lineNum,jdbcType=INTEGER},
+          </if>
+          <if test="record.txt != null">
+            txt = #{record.txt,jdbcType=VARCHAR},
+          </if>
+          <if test="record.similarTxt != null">
+            similar_txt = #{record.similarTxt,jdbcType=VARCHAR},
+          </if>
+          <if test="record.commitTime != null">
+            commit_time = #{record.commitTime,jdbcType=TIMESTAMP},
+          </if>
+          <if test="record.txtOption != null">
+            txt_option = #{record.txtOption,jdbcType=VARCHAR},
+          </if>
+        </trim>
+      </otherwise>
+    </choose>
+    where id = #{record.id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.alvin.dao.entity.Similar">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
+    -->
+    update similar
+    set file_name = #{fileName,jdbcType=VARCHAR},
+      line_num = #{lineNum,jdbcType=INTEGER},
+      txt = #{txt,jdbcType=VARCHAR},
+      similar_txt = #{similarTxt,jdbcType=VARCHAR},
+      commit_time = #{commitTime,jdbcType=TIMESTAMP},
+      txt_option = #{txtOption,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
   <select id="selectOneByExample" parameterType="com.alvin.dao.entity.example.SimilarExample" resultMap="BaseResultMap">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
     select
     <include refid="Base_Column_List" />
@@ -346,7 +440,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
     select
     <choose>
@@ -368,26 +462,26 @@
     </if>
     limit 1
   </select>
-  <insert id="batchInsert" parameterType="map">
+  <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
     insert into similar
-    (id, file_name, line_num, txt, similar_txt, commit_time, txt_option)
+    (file_name, line_num, txt, similar_txt, commit_time, txt_option)
     values
     <foreach collection="list" item="item" separator=",">
-      (#{item.id,jdbcType=BIGINT}, #{item.fileName,jdbcType=VARCHAR}, #{item.lineNum,jdbcType=INTEGER}, 
-        #{item.txt,jdbcType=VARCHAR}, #{item.similarTxt,jdbcType=VARCHAR}, #{item.commitTime,jdbcType=TIMESTAMP}, 
-        #{item.txtOption,jdbcType=VARCHAR})
+      (#{item.fileName,jdbcType=VARCHAR}, #{item.lineNum,jdbcType=INTEGER}, #{item.txt,jdbcType=VARCHAR}, 
+        #{item.similarTxt,jdbcType=VARCHAR}, #{item.commitTime,jdbcType=TIMESTAMP}, #{item.txtOption,jdbcType=VARCHAR}
+        )
     </foreach>
   </insert>
-  <insert id="batchInsertSelective" parameterType="map">
+  <insert id="batchInsertSelective" keyColumn="id" keyProperty="list.id" parameterType="map" useGeneratedKeys="true">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
     insert into similar (
     <foreach collection="selective" item="column" separator=",">
@@ -398,9 +492,6 @@
     <foreach collection="list" item="item" separator=",">
       (
       <foreach collection="selective" item="column" separator=",">
-        <if test="'id'.toString() == column.value">
-          #{item.id,jdbcType=BIGINT}
-        </if>
         <if test="'file_name'.toString() == column.value">
           #{item.fileName,jdbcType=VARCHAR}
         </if>
@@ -423,11 +514,11 @@
       )
     </foreach>
   </insert>
-  <insert id="upsertSelective" parameterType="map">
+  <insert id="upsertSelective" keyColumn="id" keyProperty="record.id" parameterType="map" useGeneratedKeys="true">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
     insert into similar
     <choose>
@@ -530,25 +621,47 @@
       </otherwise>
     </choose>
   </insert>
-  <insert id="upsert" parameterType="com.alvin.dao.entity.Similar">
+  <insert id="upsert" keyColumn="id" keyProperty="id" parameterType="com.alvin.dao.entity.Similar" useGeneratedKeys="true">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Wed May 27 15:17:38 CST 2020.
+      This element was generated on Thu Aug 20 14:29:45 CST 2020.
     -->
     insert into similar
-    (id, file_name, line_num, txt, similar_txt, commit_time, txt_option)
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      file_name,
+      line_num,
+      txt,
+      similar_txt,
+      commit_time,
+      txt_option,
+    </trim>
     values
-    (#{id,jdbcType=BIGINT}, #{fileName,jdbcType=VARCHAR}, #{lineNum,jdbcType=INTEGER}, 
-      #{txt,jdbcType=VARCHAR}, #{similarTxt,jdbcType=VARCHAR}, #{commitTime,jdbcType=TIMESTAMP}, 
-      #{txtOption,jdbcType=VARCHAR})
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=BIGINT},
+      </if>
+      #{fileName,jdbcType=VARCHAR},
+      #{lineNum,jdbcType=INTEGER},
+      #{txt,jdbcType=VARCHAR},
+      #{similarTxt,jdbcType=VARCHAR},
+      #{commitTime,jdbcType=TIMESTAMP},
+      #{txtOption,jdbcType=VARCHAR},
+    </trim>
     on duplicate key update 
-    id = #{id,jdbcType=BIGINT}, 
-    file_name = #{fileName,jdbcType=VARCHAR}, 
-    line_num = #{lineNum,jdbcType=INTEGER}, 
-    txt = #{txt,jdbcType=VARCHAR}, 
-    similar_txt = #{similarTxt,jdbcType=VARCHAR}, 
-    commit_time = #{commitTime,jdbcType=TIMESTAMP}, 
-    txt_option = #{txtOption,jdbcType=VARCHAR}
+    <trim suffixOverrides=",">
+      <if test="id != null">
+        id = #{id,jdbcType=BIGINT},
+      </if>
+      file_name = #{fileName,jdbcType=VARCHAR},
+      line_num = #{lineNum,jdbcType=INTEGER},
+      txt = #{txt,jdbcType=VARCHAR},
+      similar_txt = #{similarTxt,jdbcType=VARCHAR},
+      commit_time = #{commitTime,jdbcType=TIMESTAMP},
+      txt_option = #{txtOption,jdbcType=VARCHAR},
+    </trim>
   </insert>
 </mapper>