erga hai 11 meses
pai
achega
d90883a8e2
Modificáronse 75 ficheiros con 3264 adicións e 0 borrados
  1. 11 0
      Web/.editorconfig
  2. 194 0
      Web/.gitattributes
  3. 6 0
      Web/.gitignore
  4. 8 0
      Web/.idea/.gitignore
  5. 5 0
      Web/.idea/misc.xml
  6. 8 0
      Web/.idea/modules.xml
  7. 62 0
      Web/404.html
  8. 19 0
      Web/LICENSE.txt
  9. 247 0
      Web/css/style.css
  10. 67 0
      Web/day01/demo01.html
  11. 31 0
      Web/day01/demo02.html
  12. 43 0
      Web/day01/demo03.html
  13. 65 0
      Web/day01/demo04.html
  14. 79 0
      Web/day01/demo05.html
  15. 19 0
      Web/day01/demo06.html
  16. 61 0
      Web/day02/demo01.html
  17. 50 0
      Web/day02/demo010.html
  18. 36 0
      Web/day02/demo011.html
  19. 30 0
      Web/day02/demo02.html
  20. 74 0
      Web/day02/demo03.html
  21. 96 0
      Web/day02/demo04.html
  22. 74 0
      Web/day02/demo05.html
  23. 89 0
      Web/day02/demo06.html
  24. 83 0
      Web/day02/demo07.html
  25. 32 0
      Web/day02/demo08.html
  26. 21 0
      Web/day02/demo09.html
  27. BIN=BIN
      Web/favicon.ico
  28. BIN=BIN
      Web/icon.png
  29. 1 0
      Web/icon.svg
  30. 0 0
      Web/img/.gitkeep
  31. BIN=BIN
      Web/img/1.jpg
  32. BIN=BIN
      Web/img/2.jpg
  33. BIN=BIN
      Web/img/3.jpg
  34. BIN=BIN
      Web/img/logo.png
  35. 33 0
      Web/index.html
  36. 6 0
      Web/js/a.js
  37. 0 0
      Web/js/app.js
  38. 0 0
      Web/js/vendor/.gitkeep
  39. 24 0
      Web/package.json
  40. 5 0
      Web/robots.txt
  41. 12 0
      Web/site.webmanifest
  42. 12 0
      Web/webpack.common.js
  43. 13 0
      Web/webpack.config.dev.js
  44. 26 0
      Web/webpack.config.prod.js
  45. 38 0
      mybatis/mybatis02/.gitignore
  46. 8 0
      mybatis/mybatis02/.idea/.gitignore
  47. 7 0
      mybatis/mybatis02/.idea/encodings.xml
  48. 14 0
      mybatis/mybatis02/.idea/misc.xml
  49. 124 0
      mybatis/mybatis02/.idea/uiDesigner.xml
  50. 49 0
      mybatis/mybatis02/pom.xml
  51. 19 0
      mybatis/mybatis02/src/main/java/com/lc/mybatis/entity/Dept.java
  52. 23 0
      mybatis/mybatis02/src/main/java/com/lc/mybatis/entity/User.java
  53. 15 0
      mybatis/mybatis02/src/main/java/com/lc/mybatis/mapper/DeptMapper.java
  54. 17 0
      mybatis/mybatis02/src/main/java/com/lc/mybatis/mapper/UserMapper.java
  55. 40 0
      mybatis/mybatis02/src/main/java/com/lc/mybatis/test/TestDeptResultMap.java
  56. 61 0
      mybatis/mybatis02/src/main/java/com/lc/mybatis/test/TestMybatis.java
  57. 78 0
      mybatis/mybatis02/src/main/java/com/lc/mybatis/test/TestUserResultMap.java
  58. 45 0
      mybatis/mybatis02/src/main/resources/com/lc/mybatis/mapper/DeptMapper.xml
  59. 111 0
      mybatis/mybatis02/src/main/resources/com/lc/mybatis/mapper/UserMapper.xml
  60. 4 0
      mybatis/mybatis02/src/main/resources/jdbc.properties
  61. 8 0
      mybatis/mybatis02/src/main/resources/log4j.properties
  62. 69 0
      mybatis/mybatis02/src/main/resources/mybatis-config.xml
  63. 38 0
      mybatis/mybatis03/.gitignore
  64. 8 0
      mybatis/mybatis03/.idea/.gitignore
  65. 7 0
      mybatis/mybatis03/.idea/encodings.xml
  66. 12 0
      mybatis/mybatis03/.idea/misc.xml
  67. 124 0
      mybatis/mybatis03/.idea/uiDesigner.xml
  68. 67 0
      mybatis/mybatis03/pom.xml
  69. 19 0
      mybatis/mybatis03/src/main/java/com/lc/mybatis/entity/User.java
  70. 21 0
      mybatis/mybatis03/src/main/java/com/lc/mybatis/mapper/UserMapper.java
  71. 301 0
      mybatis/mybatis03/src/main/java/com/lc/mybatis/test/TestUser.java
  72. 206 0
      mybatis/mybatis03/src/main/resources/com/lc/mybatis/mapper/UserMapper.xml
  73. 4 0
      mybatis/mybatis03/src/main/resources/jdbc.properties
  74. 8 0
      mybatis/mybatis03/src/main/resources/log4j.properties
  75. 77 0
      mybatis/mybatis03/src/main/resources/mybatis-config.xml

+ 11 - 0
Web/.editorconfig

@@ -0,0 +1,11 @@
+# editorconfig.org
+
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+indent_size = 2
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true

+ 194 - 0
Web/.gitattributes

@@ -0,0 +1,194 @@
+## GITATTRIBUTES FOR WEB PROJECTS
+#
+# These settings are for any web project.
+#
+# Details per file setting:
+#   text    These files should be normalized (i.e. convert CRLF to LF).
+#   binary  These files are binary and should be left untouched.
+#
+# Note that binary is a macro for -text -diff.
+######################################################################
+
+## AUTO-DETECT
+##   Handle line endings automatically for files detected as
+##   text and leave all files detected as binary untouched.
+##   This will handle all files NOT defined below.
+* text=auto
+
+## SOURCE CODE
+*.bat      text eol=crlf
+*.coffee   text
+*.css      text
+*.htm      text
+*.html     text
+*.inc      text
+*.ini      text
+*.js       text
+*.json     text
+*.jsx      text
+*.less     text
+*.od       text
+*.onlydata text
+*.php      text
+*.pl       text
+*.py       text
+*.rb       text
+*.sass     text
+*.scm      text
+*.scss     text
+*.sh       text eol=lf
+*.sql      text
+*.styl     text
+*.tag      text
+*.ts       text
+*.tsx      text
+*.xml      text
+*.xhtml    text
+
+## DOCKER
+*.dockerignore text
+Dockerfile     text
+
+## DOCUMENTATION
+*.markdown   text
+*.md         text
+*.mdwn       text
+*.mdown      text
+*.mkd        text
+*.mkdn       text
+*.mdtxt      text
+*.mdtext     text
+*.txt        text
+AUTHORS      text
+CHANGELOG    text
+CHANGES      text
+CONTRIBUTING text
+COPYING      text
+copyright    text
+*COPYRIGHT*  text
+INSTALL      text
+license      text
+LICENSE      text
+NEWS         text
+readme       text
+*README*     text
+TODO         text
+
+## TEMPLATES
+*.dot        text
+*.ejs        text
+*.haml       text
+*.handlebars text
+*.hbs        text
+*.hbt        text
+*.jade       text
+*.latte      text
+*.mustache   text
+*.njk        text
+*.phtml      text
+*.tmpl       text
+*.tpl        text
+*.twig       text
+
+## LINTERS
+.babelrc      text
+.csslintrc    text
+.eslintrc     text
+.htmlhintrc   text
+.jscsrc       text
+.jshintrc     text
+.jshintignore text
+.prettierrc   text
+.stylelintrc  text
+
+## CONFIGS
+*.bowerrc       text
+*.cnf           text
+*.conf          text
+*.config        text
+.browserslistrc text
+.editorconfig   text
+.gitattributes  text
+.gitconfig      text
+.gitignore      text
+.htaccess       text
+*.npmignore     text
+*.yaml          text
+*.yml           text
+browserslist    text
+Makefile        text
+makefile        text
+
+## HEROKU
+Procfile    text
+.slugignore text
+
+## GRAPHICS
+*.ai   binary
+*.bmp  binary
+*.eps  binary
+*.gif  binary
+*.ico  binary
+*.jng  binary
+*.jp2  binary
+*.jpg  binary
+*.jpeg binary
+*.jpx  binary
+*.jxr  binary
+*.pdf  binary
+*.png  binary
+*.psb  binary
+*.psd  binary
+*.svg  text
+*.svgz binary
+*.tif  binary
+*.tiff binary
+*.wbmp binary
+*.webp binary
+
+## AUDIO
+*.kar  binary
+*.m4a  binary
+*.mid  binary
+*.midi binary
+*.mp3  binary
+*.ogg  binary
+*.ra   binary
+
+## VIDEO
+*.3gpp binary
+*.3gp  binary
+*.as   binary
+*.asf  binary
+*.asx  binary
+*.fla  binary
+*.flv  binary
+*.m4v  binary
+*.mng  binary
+*.mov  binary
+*.mp4  binary
+*.mpeg binary
+*.mpg  binary
+*.ogv  binary
+*.swc  binary
+*.swf  binary
+*.webm binary
+
+## ARCHIVES
+*.7z  binary
+*.gz  binary
+*.jar binary
+*.rar binary
+*.tar binary
+*.zip binary
+
+## FONTS
+*.ttf   binary
+*.eot   binary
+*.otf   binary
+*.woff  binary
+*.woff2 binary
+
+## EXECUTABLES
+*.exe binary
+*.pyc binary

+ 6 - 0
Web/.gitignore

@@ -0,0 +1,6 @@
+# Include your project-specific ignores in this file
+# Read about how to use .gitignore: https://help.github.com/articles/ignoring-files
+# Useful .gitignore templates: https://github.com/github/gitignore
+node_modules
+dist
+.cache

+ 8 - 0
Web/.idea/.gitignore

@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 5 - 0
Web/.idea/misc.xml

@@ -0,0 +1,5 @@
+<project version="4">
+  <component name="ProjectRootManager">
+    <output url="file://$PROJECT_DIR$/out" />
+  </component>
+</project>

+ 8 - 0
Web/.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/../Web.iml" filepath="$PROJECT_DIR$/../Web.iml" />
+    </modules>
+  </component>
+</project>

+ 62 - 0
Web/404.html

@@ -0,0 +1,62 @@
+<!doctype html>
+<html lang="en">
+
+<head>
+  <meta charset="utf-8">
+  <title>Page Not Found</title>
+  <meta name="viewport" content="width=device-width, initial-scale=1">
+  <style>
+    * {
+      line-height: 1.2;
+      margin: 0;
+    }
+
+    html {
+      color: #888;
+      display: table;
+      font-family: sans-serif;
+      height: 100%;
+      text-align: center;
+      width: 100%;
+    }
+
+    body {
+      display: table-cell;
+      vertical-align: middle;
+      margin: 2em auto;
+    }
+
+    h1 {
+      color: #555;
+      font-size: 2em;
+      font-weight: 400;
+    }
+
+    p {
+      margin: 0 auto;
+      width: 280px;
+    }
+
+    @media only screen and (max-width: 280px) {
+
+      body,
+      p {
+        width: 95%;
+      }
+
+      h1 {
+        font-size: 1.5em;
+        margin: 0 0 0.3em;
+      }
+
+    }
+  </style>
+</head>
+
+<body>
+  <h1>Page Not Found</h1>
+  <p>Sorry, but the page you were trying to view does not exist.</p>
+</body>
+
+</html>
+<!-- IE needs 512+ bytes: https://docs.microsoft.com/archive/blogs/ieinternals/friendly-http-error-pages -->

+ 19 - 0
Web/LICENSE.txt

@@ -0,0 +1,19 @@
+Copyright (c) HTML5 Boilerplate
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 247 - 0
Web/css/style.css

@@ -0,0 +1,247 @@
+/*! HTML5 Boilerplate v9.0.1 | MIT License | https://html5boilerplate.com/ */
+
+/* main.css 3.0.0 | MIT License | https://github.com/h5bp/main.css#readme */
+/*
+ * What follows is the result of much research on cross-browser styling.
+ * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
+ * Kroc Camen, and the H5BP dev community and team.
+ */
+
+/* ==========================================================================
+   Base styles: opinionated defaults
+   ========================================================================== */
+
+html {
+  color: #222;
+  font-size: 1em;
+  line-height: 1.4;
+}
+
+/*
+ * Remove text-shadow in selection highlight:
+ * https://twitter.com/miketaylr/status/12228805301
+ *
+ * Customize the background color to match your design.
+ */
+
+::-moz-selection {
+  background: #b3d4fc;
+  text-shadow: none;
+}
+
+::selection {
+  background: #b3d4fc;
+  text-shadow: none;
+}
+
+/*
+ * A better looking default horizontal rule
+ */
+
+hr {
+  display: block;
+  height: 1px;
+  border: 0;
+  border-top: 1px solid #ccc;
+  margin: 1em 0;
+  padding: 0;
+}
+
+/*
+ * Remove the gap between audio, canvas, iframes,
+ * images, videos and the bottom of their containers:
+ * https://github.com/h5bp/html5-boilerplate/issues/440
+ */
+
+audio,
+canvas,
+iframe,
+img,
+svg,
+video {
+  vertical-align: middle;
+}
+
+/*
+ * Remove default fieldset styles.
+ */
+
+fieldset {
+  border: 0;
+  margin: 0;
+  padding: 0;
+}
+
+/*
+ * Allow only vertical resizing of textareas.
+ */
+
+textarea {
+  resize: vertical;
+}
+
+/* ==========================================================================
+   Author's custom styles
+   ========================================================================== */
+
+/* ==========================================================================
+   Helper classes
+   ========================================================================== */
+
+/*
+ * Hide visually and from screen readers
+ */
+
+.hidden,
+[hidden] {
+  display: none !important;
+}
+
+/*
+ * Hide only visually, but have it available for screen readers:
+ * https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
+ *
+ * 1. For long content, line feeds are not interpreted as spaces and small width
+ *    causes content to wrap 1 word per line:
+ *    https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
+ */
+
+.visually-hidden {
+  border: 0;
+  clip: rect(0, 0, 0, 0);
+  height: 1px;
+  margin: -1px;
+  overflow: hidden;
+  padding: 0;
+  position: absolute;
+  white-space: nowrap;
+  width: 1px;
+  /* 1 */
+}
+
+/*
+ * Extends the .visually-hidden class to allow the element
+ * to be focusable when navigated to via the keyboard:
+ * https://www.drupal.org/node/897638
+ */
+
+.visually-hidden.focusable:active,
+.visually-hidden.focusable:focus {
+  clip: auto;
+  height: auto;
+  margin: 0;
+  overflow: visible;
+  position: static;
+  white-space: inherit;
+  width: auto;
+}
+
+/*
+ * Hide visually and from screen readers, but maintain layout
+ */
+
+.invisible {
+  visibility: hidden;
+}
+
+/*
+ * Clearfix: contain floats
+ *
+ * The use of `table` rather than `block` is only necessary if using
+ * `::before` to contain the top-margins of child elements.
+ */
+
+.clearfix::before,
+.clearfix::after {
+  content: "";
+  display: table;
+}
+
+.clearfix::after {
+  clear: both;
+}
+
+/* ==========================================================================
+   EXAMPLE Media Queries for Responsive Design.
+   These examples override the primary ('mobile first') styles.
+   Modify as content requires.
+   ========================================================================== */
+
+@media only screen and (min-width: 35em) {
+  /* Style adjustments for viewports that meet the condition */
+}
+
+@media print,
+  (-webkit-min-device-pixel-ratio: 1.25),
+  (min-resolution: 1.25dppx),
+  (min-resolution: 120dpi) {
+  /* Style adjustments for high resolution devices */
+}
+
+/* ==========================================================================
+   Print styles.
+   Inlined to avoid the additional HTTP request:
+   https://www.phpied.com/delay-loading-your-print-css/
+   ========================================================================== */
+
+@media print {
+  *,
+  *::before,
+  *::after {
+    background: #fff !important;
+    color: #000 !important;
+    /* Black prints faster */
+    box-shadow: none !important;
+    text-shadow: none !important;
+  }
+
+  a,
+  a:visited {
+    text-decoration: underline;
+  }
+
+  a[href]::after {
+    content: " (" attr(href) ")";
+  }
+
+  abbr[title]::after {
+    content: " (" attr(title) ")";
+  }
+
+  /*
+   * Don't show links that are fragment identifiers,
+   * or use the `javascript:` pseudo protocol
+   */
+  a[href^="#"]::after,
+  a[href^="javascript:"]::after {
+    content: "";
+  }
+
+  pre {
+    white-space: pre-wrap !important;
+  }
+
+  pre,
+  blockquote {
+    border: 1px solid #999;
+    page-break-inside: avoid;
+  }
+
+  tr,
+  img {
+    page-break-inside: avoid;
+  }
+
+  p,
+  h2,
+  h3 {
+    orphans: 3;
+    widows: 3;
+  }
+
+  h2,
+  h3 {
+    page-break-after: avoid;
+  }
+}
+

+ 67 - 0
Web/day01/demo01.html

@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>标题</title>
+</head>
+<body>
+
+<hr color="red" size="5" >
+
+<!-- b -->
+
+  <center>
+    <b>
+      随着我国综合国力不断提升
+    </b>
+  </center>
+  <i>
+    随着我国综合国力不断提升
+  </i>
+  <u>
+    随着我国综合国力不断提升
+  </u>
+
+<!--段落 p  -->
+  <p>
+    随着我国综合国力不断提升,国际合作交流项目逐渐增多,一些国内专家学者因工作需要经常赴境外考察、开展实地调研,努力拓宽研究渠道,谋求共同发展。与此同时,境外间谍情报机关高度关注我专家学者出国(境)情况,甚至伺机以威胁恐吓等卑劣手段进行拉拢策反,妄图窃取我国家秘密。
+  </p>
+  <p>
+    123
+  </p>
+
+  <!--换行-->
+  李某是我国某领域专家,在该领域拥有多项高端科研成果,著述颇丰,享誉海内外。
+  <br>一次,李某因工作需要,持护照赴某国开展实地调研,却没想到原以为十分正常的公务出行竟落入了境外间谍情报机关的窃密“陷阱”。
+
+
+  <!--字体标签
+      属性
+        size
+        color
+    -->
+<!--  <font size="5" >随着我国综合国力不断提升</font>-->
+<!--  <font size="10" >随着我国综合国力不断提升</font>-->
+<!--  <font size="10" color="red" face="楷体" >随着我国综合国力不断提升</font>-->
+
+
+
+ <!-- 标题标签 h1
+    换行
+   -->
+
+ <h1>你好123</h1>
+ <h2>你好123</h2>
+ <h3>你好123</h3>
+ <h4>你好123</h4>
+ <h5>你好123</h5>
+ <h6>你好123</h6>
+ <h7>你好123</h7>
+ <h100>你好123</h100>
+ 你好123
+
+
+
+
+</body>
+</html>

+ 31 - 0
Web/day01/demo02.html

@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>标题</title>
+</head>
+<body>
+  <!--
+    img 标签
+        src 属性 用于指定图片的路径
+        alt 属性 用于指定图片加载失败时的提示文本
+
+        路径问题
+          据对路径:从 /出发  ,win D C  linux  根目录/
+              src="C:\Users\cc\Desktop\VIPQ\Code\Web\img\logo.png">
+              服务其的根目录 / 根目录
+          相对路径
+              当前文件 位置
+              目标文件 位置
+              当前目录 ./
+              上一级目录  ../
+              src="img/logo.png"
+
+   -->
+  <img src="/1Web/img/logo.png" alt="文字提示">
+  <!-- 相对路径 -->
+  <img src="../img/logo.png"  height="100"  width="20" >
+
+
+</body>
+</html>

+ 43 - 0
Web/day01/demo03.html

@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>标题</title>
+</head>
+<body>
+  <!--
+    a 标签
+      href 链接地址
+      target 打开方式
+        _self 当前窗口
+        _blank        新窗口
+   -->
+
+  <a href="demo02.html" target="_blank">demo02</a>
+
+  <a href="https://www.baidu.com">百度一下</a>
+
+
+
+  <!-- 列表  -->
+  <ol type="a" >
+    <li>北京</li>
+    <li>上海</li>
+    <li>杭州</li>
+  </ol>
+
+  <ul type="square" >
+    <li>苹果</li>
+    <li>西红柿</li>
+    <li>香蕉</li>
+  </ul>
+
+  <!-- 布局标签 -->
+  <div style=" height: 100px ; width: 100px ; border: 1px solid red " >123</div>
+  <div>456</div>
+
+  <span>678</span>
+  <span>789</span>
+
+</body>
+</html>

+ 65 - 0
Web/day01/demo04.html

@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>标题</title>
+</head>
+<body>
+  <!--
+    <table> 标签定义了 HTML 表格。
+
+    一个 HTML 表格由一个 <table> 元素和一个或多个 <tr>、<th> 和 <td> 元素组成:
+
+    <tr> 元素 定义表格行
+    <th> 元素 定义表格标题
+    <td> 元素 定义表格单元格
+   -->
+  <table border="1" width="50%" align="center" >
+    <tr>
+      <th>id</th>
+      <th>name</th>
+      <th>age</th>
+      <th>头像</th>
+      <th>address</th>
+      <th>操作</th>
+    </tr>
+    <tr>
+      <td>1</td>
+      <td>zs</td>
+      <td>22</td>
+      <td>
+        <img src="../img/logo.png" width="20px" ></img>
+      </td>
+      <td>北京</td>
+      <td>
+        <a href="" target="_blank">删除</a>
+        <a href="" target="_blank">修改</a>
+      </td>
+    </tr>
+  </table>
+
+
+  <hr>
+  <!--
+    colspan 列合并
+    rowspan 行合并
+  -->
+  <!-- ---------------------------  -->
+  <table border="1" width="50%" align="center" cellpadding="0" cellspacing="0" >
+    <tr>
+      <td colspan="2" >1</td>
+      <td rowspan="2">22</td>
+    </tr>
+    <tr>
+      <td rowspan="2" >2</td>
+      <td>lisi</td>
+    </tr>
+    <tr>
+      <td colspan="2" >lisi</td>
+    </tr>
+  </table>
+
+
+
+</body>
+</html>

+ 79 - 0
Web/day01/demo05.html

@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>标题</title>
+</head>
+<body>
+
+  <!-- 表单标签
+      action 表单的地址。表单项的数据信息提交的地址。 服务器(接收递交的数据)
+      method 表单的提交方式。
+        get   地址栏中显示。提交数据大小 有限制。
+        post  post 不会显示在地址栏中。  没有限制  文件
+
+      表单项
+        input type = text 文本  (用户名)
+              value 表示 提交的值           value  = zhagnsan
+              name 表示 提交数据的名称   key ~ name  = username
+              获取 根据 name 的值 获取
+
+              type = submit 提交
+              type = password 密码
+              type = radio 单选 默认选中 checked
+
+
+
+
+        http://localhost:63342/Web/day01/hello?username=zhangsan 根据username获取
+
+-->
+  <form action="hello" method="post" >
+    <!-- 表单项 -->
+    名称: <input type="text" name="username" ><br>
+    <!-- 密码 -->
+    密码: <input type="password" name="password" ><br>
+    <!-- 单选 -->
+    性别:
+    <input type="radio" value="1" checked name="gender" >男
+    <input type="radio" value="0" name="gender" >女<br>
+
+    复选框:
+    <input type="checkbox" value="篮球" name="hobby" >篮球
+    <input type="checkbox" value="足球" name="hobby" >足球
+    <input type="checkbox" value="水球" name="hobby" >水球<br>
+
+    邮箱:<input type="email" name="email" ><br>
+    数字:<input type="number" name="number" ><br>
+
+    日期:<input type="date" name="date" ><br>
+
+    文件:<input type="file" name="file" ><br>
+
+    <!--
+      下拉框
+        select
+          name 提交key
+
+          option value
+       -->
+    城市:
+    <select name="city" id="" >
+      <option value="0" >北京</option>
+      <option value="1" selected >上海</option>
+      <option value="2" >天津</option>
+    </select><br>
+
+    <!-- 文本域 -->
+    信息:
+    <textarea name="desc"  rows="5" cols="20" >abc</textarea><br>
+
+    <!-- 隐藏域 -->
+    <input type="hidden" name="id" value="123123123" ><br >
+
+    <input type="reset" value="重置">
+    <input type="submit" value="提交">
+  </form>
+
+</body>
+</html>

+ 19 - 0
Web/day01/demo06.html

@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>标题</title>
+</head>
+<body>
+
+  <!--
+  button
+-->
+  <a href="demo05.html">
+    <button>按钮</button>
+  </a>
+
+
+
+</body>
+</html>

+ 61 - 0
Web/day02/demo01.html

@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>Title</title>
+  <style>
+    #div1 {
+      background-color: red;
+      border-style: solid;
+      border-width: 5px;
+      height: 200px;
+      width: 200px;
+    }
+
+    p{
+      text-indent: 50px;
+      text-align: justify;
+      letter-spacing: 3px;
+    }
+
+    .sp{
+      display: block;
+      height: 200px;
+      width: 200px;
+      background-color: yellow;
+    }
+
+
+
+  </style>
+</head>
+<!--
+  css 使用
+    1. 文件内样式
+    2. 外部样式
+        <link rel="stylesheet" href="demo01.css">
+-->
+<body>
+
+  <div id="div1" >123</div>
+
+  <p>123</p>
+  <p>123</p>
+  <p>123</p>
+  <p>123</p>
+  <p>123</p>
+
+  <span class="sp" >456</span>
+  <span class="sp" >456</span>
+  <span class="sp" >456</span>
+  <span class="sp" >456</span>
+  <span class="sp" >456</span>
+  <span class="sp" >456</span>
+  <span class="sp" >456</span>
+
+  <span >123</span>
+  <span >123</span>
+
+
+</body>
+</html>

+ 50 - 0
Web/day02/demo010.html

@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>Title</title>
+</head>
+<body>
+
+
+  <button id="all" >全选</button>
+  <button id="fx" >反选</button>
+
+  <input class="cbx"   name="cb"  type="checkbox"   > 1
+  <input class="cbx"  name="cb" type="checkbox"   > 2
+  <input class="cbx"  name="cb" type="checkbox"   > 3
+  <input class="cbx"  type="checkbox"   > 4
+
+</body>
+<script>
+  //点击按钮出发的函数
+  document.getElementById("all").onclick = function (){
+
+    //`getElementsByTagName()`:根据标签名称获取,返回Element对象数组
+    //let insArr = document.getElementsByTagName("input");
+    //`getElementsByName()`:根据name属性值获取,返回Element对象数组
+    //let insArr = document.getElementsByName("cb");
+    //`getElementsByClassName()`:根据class属性值获取,返回Element对象数组
+    let insArr = document.getElementsByClassName("cbx");
+    //console.log(insArr)
+
+    for (let i = 0; i < insArr.length ; i++) {
+        //选中 属性 checked  true
+        insArr[i].checked = true;
+    }
+  }
+
+  //点击按钮出发的函数
+  document.getElementById("fx").onclick = function (){
+
+
+    let insArr = document.getElementsByClassName("cbx");
+    //console.log(insArr)
+
+    for (let i = 0; i < insArr.length ; i++) {
+      //选中 属性 checked  true
+      insArr[i].checked = !insArr[i].checked;
+    }
+  }
+
+</script>

+ 36 - 0
Web/day02/demo011.html

@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>Title</title>
+</head>
+<body>
+
+
+  <button id="pre" >上一张</button>
+
+  <img height="300px" src="" alt="图片">
+
+  <button id="next" >下一张</button>
+
+</body>
+<script>
+
+  //图片的名称
+  let imgArr = ["1.jpg","2.jpg","3.jpg"];
+  //索引
+  let index = 0;
+
+  //默认展示第一张图片
+  document.getElementsByTagName("img")[0].src = "../img/"+imgArr[index];
+
+  //下一张
+  document.getElementById("next").onclick = function (){
+    index++;
+    index = index % imgArr.length;
+    document.getElementsByTagName("img")[0].src = "../img/"+imgArr[index];
+  }
+
+  //上一张
+
+</script>

+ 30 - 0
Web/day02/demo02.html

@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>Title</title>
+  <!-- js 使用
+    1. 内部
+      加script 标签
+    2. 外部
+      <script src="../js/a.js"></script>
+ -->
+
+</head>
+
+<body>
+
+  <button id="btn1" >你好</button>
+
+</body>
+<!--&lt;!&ndash; 引入 中间不能包含js代码 &ndash;&gt;-->
+<!--<script src="../js/a.js"></script>-->
+</html>
+<script>
+  //js代码
+  let btn = document.getElementById("btn1");
+
+  btn.onclick = function (){
+    alert("hello world");
+  }
+</script>

+ 74 - 0
Web/day02/demo03.html

@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>Title</title>
+</head>
+
+<body>
+</body>
+<script>
+  //注释
+
+  //变量 弱类型语言 不强制要求类型。
+  var a = 10
+  var b = "100"
+
+  //输出语句
+
+  //弹出内容  alert()
+  //alert("hello world")
+
+  //在控制台输出
+  //console.log("hello world")  //= sout  *** 推荐使用
+
+  //页面
+  //document.write("hello world")
+
+
+
+  //变量
+
+  //格式 var 关键字。
+
+  //规则
+  /*
+  - 组成字符可以是任何字母、数字、下划线(_)或美元符号($)
+  - 数字不能开头
+  - 建议使用驼峰命名
+   */
+
+  var a = 123;
+  var a = 456; //覆盖
+
+  console.log(a)
+
+  // {} 作用域
+  {
+    var b  =  1000;
+  }
+  console.log(b)
+
+  // 声明变量 let
+  {
+    let c = 2000
+    console.log(c)
+  }
+  // c is not defined
+  //console.log(c)
+
+  //常量
+  const PI = 3.14
+
+  //PI = 5.13
+
+  console.log(PI)
+
+
+
+
+
+
+
+
+</script>

+ 96 - 0
Web/day02/demo04.html

@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>Title</title>
+</head>
+
+<body>
+</body>
+<script>
+  // js数据类型
+  /*
+    五种
+    number 数字
+    null 空
+    string
+    boolean 布尔值
+    undefined 未定义
+
+   */
+
+  let num = 10;
+  console.log( typeof num )
+
+  let s1 = "10";
+  console.log( typeof s1 )
+
+  let f2 = 1.23456;
+  console.log( typeof f2 )
+
+  let n3 = null;
+  console.log( typeof n3 )
+
+  console.log( typeof d4 )
+
+
+  // == 和 ===
+
+  let  n1 = 10;
+  let  n2 = "10";
+
+  //字面量转换   == 检验值是否相等
+  console.log(n1 == n2)
+
+  //检验类型 是否相对。
+  console.log(n1 === n2)
+
+  // 数据类型转换
+  //其他类型转为number
+  let s3 = +"10";
+  s3 += 20;
+  console.log(s3)
+
+  //字符串转换数字  字面值转换 第一个不可以转换 NaN
+  let p1 = parseInt("a10abc") // NaN 不是一个数字
+  console.log( p1)
+  console.log( typeof p1)
+
+  //布尔 转数字  true = 1  false = 0
+  console.log(true+1);
+
+
+
+  //其他类型转为boolean
+  // string 类型转换为 boolean 类型:空字符串转为false,其他的字符串转为true
+  let c = "";
+  if ( c ){
+    console.log("true")
+  }else {
+    console.log("false")
+  }
+
+
+  // number 类型转换为 boolean 类型:0和NaN转为false,其他的数字转为true
+  let d = 0;
+  if ( d ){
+    console.log("true")
+  }else {
+    console.log("false")
+  }
+
+  /*
+  * null类型转换为 boolean 类型是 false
+  * undefined 转换为 boolean 类型是 false
+   */
+
+  let o1 =  null//{age :20};
+
+  if ( o1 ){
+    console.log("true")
+  }else {
+    console.log("false")
+  }
+
+
+</script>

+ 74 - 0
Web/day02/demo05.html

@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>Title</title>
+</head>
+
+<body>
+</body>
+<script>
+  // js 函数
+  //函数 = 方法  完成功能
+  //分析 参数  返回值
+
+  //注意 返回类型 不需声明。
+
+  //定义方式1
+  // 无返回值  无参数
+  function m1(){
+    console.log("m1");
+  }
+  // 有返回值  无参数
+  function m2(){
+    return "hello world";
+  }
+
+  // 有返回值  无参数 没有声明类型
+  function m3( a = 3 ){
+    console.log("a:"+a)
+  }
+
+  function m33( a = 3 , b , c ){
+    console.log("a:"+a)
+    console.log("b:"+b )
+    console.log("c:"+c)
+  }
+
+  function m4( a ){
+    return a
+  }
+
+  //调用  方法名称
+  let mm1 = m1();
+  console.log(mm1)
+
+  //m2
+  let mm2 = m2()
+  console.log(mm2)
+
+  //m3
+  m33(10,20,30)
+
+
+  //方式2 函数
+  let m5 = function(){
+    console.log("m5")
+  }
+
+  let m6 = m5(); // 加 () 将m5调用之后的返回值 赋值给m6  , 不加 将m5 函数 复制给 m6
+
+  console.log(m6)
+
+  //方式3 箭头函数
+  // let m7 = ()=>{
+  //   console.log("m7")
+  // }
+
+
+
+
+
+
+
+</script>

+ 89 - 0
Web/day02/demo06.html

@@ -0,0 +1,89 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>Title</title>
+</head>
+
+<body>
+</body>
+<script>
+  // 数组对象
+  /*
+  forEach()
+  indexOf()
+  join()
+  push()
+  slice()
+   */
+
+  let arr = [1, 2, 3, 4, 5];
+
+  for (let i = arr.length - 1; i >= 0; i--) {
+    console.log(arr[i])
+  }
+
+  console.log("-------------------------")
+  //函数
+  // item 元素
+  // index 索引
+  arr.forEach((item, index) => {
+    console.log("元素:"+item+",索引:"+index)
+  })
+
+  let number = arr.indexOf(3);
+  console.log(number);
+
+
+  //mybatis 根据 id 删除 集合。
+
+  //数组 变成字符串  传递。
+  let s1 =  arr.join(",");
+  console.log(s1)  // 根据 ","
+
+
+  let arr2 = new Array();
+  //添加元素
+  arr2.push("a")
+  arr2.push("b")
+  arr2.push("c")
+  arr2.push("d")
+
+  console.log(arr2)
+
+
+  // splice()
+  /*
+    替代添加
+    替代删除
+    修改
+   */
+  /*
+      第一个 位置
+      第二个 删除的数量
+      第三 添加的元素
+   */
+  //添加
+  //arr2.splice(4,0,"e","f")
+
+  //删除
+  //arr2.splice(0,1)
+
+  //修改
+  arr2.splice(0,1,"aaa")
+
+  console.log(arr2)
+
+
+  //filter
+  var ages = [32, 33, 16, 40];
+  let arr3 = ages.filter(( item ) =>{
+    //判断
+    return item > 30;
+  })
+
+  console.log(arr3)
+
+
+
+</script>

+ 83 - 0
Web/day02/demo07.html

@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>Title</title>
+</head>
+<a href="aaa?name=张三">aaa</a>
+<body>
+</body>
+<script>
+  // 时间对象
+
+  let t1 = new Date();
+  console.log(t1)
+
+  let fullYear = t1.getFullYear();
+  let month = t1.getMonth();
+  let date = t1.getDate();
+
+  console.log( fullYear, month, date )
+
+  //全局属性
+  /*
+  parseFloat()	解析字符串并返回浮点数。
+  parseInt()	解析字符串并返回整数。
+  decodeURI()	解码 URI。
+  encodeURI()	对 URI 进行编码。
+   */
+
+  let number = parseInt("123456789");
+  console.log(number)
+  let number1 = parseFloat("1.234");
+  console.log(number1)
+
+
+  let s1 = "你好";
+  let e1 =  encodeURI(s1);
+  console.log(e1)
+
+  let s2 = decodeURI(e1);
+  console.log(s2)
+
+
+  //eval
+  //eval("alert('hello')")
+
+
+  //Math 对象
+
+  //js 对象
+  let person = {
+    name: "zs",
+    age: 18,
+    gender: "男",
+    sayHello : function (){
+      console.log("hello")
+    }
+    ,
+    getAge(){
+      return this.age;
+    }
+  }
+
+  console.log(person.name)
+  console.log(person.age)
+  console.log(person.gender)
+  person.sayHello()
+  console.log(person.getAge());
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</script>

+ 32 - 0
Web/day02/demo08.html

@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>Title</title>
+</head>
+
+<!-- input
+  获取input里面的输入的内容。
+  修改内容 :"请输入密码"
+ -->
+<input id="inp1" type="text"   >
+
+<!-- 按钮-->
+<button id="btn1">修改input内容</button>
+
+<body>
+</body>
+<script>
+  document.getElementById("btn1").onclick = function (){
+    //js代码
+
+    //获取
+    let inp1 = document.getElementById("inp1");
+    //获取属性
+    let inp1Value = inp1.value
+    console.log(inp1Value)
+    //修改
+    inp1.value = "请输入密码"
+
+  }
+</script>

+ 21 - 0
Web/day02/demo09.html

@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>Title</title>
+</head>
+<body>
+
+  <input id="inp1" type="text"   >
+  <!-- 按钮-->
+  <button id="btn1">交换内容</button>
+  <input id="inp2" type="text"   >
+
+</body>
+<script>
+  //点击按钮出发的函数
+  document.getElementById("btn1").onclick = function (){
+
+  }
+
+</script>

BIN=BIN
Web/favicon.ico


BIN=BIN
Web/icon.png


+ 1 - 0
Web/icon.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 192 192"><path fill="#e08524" d="M75.3 73.4H18.4l45.3 34.3L48.3 163l46.1-32.3 48.2 34.6-16.9-58.3 44.9-33.6H115l-20.5-55-19.2 55z"/><path d="m96.7 18.8 18.2 8.2 16.5 44.3h-15.1L96.7 18.8zm-47 146 18.7 9.9 42.6-29.9-16.5-11.4-44.8 31.4zm79.1-56.8 17.4 9.4 18.6 60.1-19.7-11.3-16.3-58.2z"/><path d="m173.1 74.3 17.8 9.2-44.7 34-17.4-9.4 44.3-33.8z"/></svg>

+ 0 - 0
Web/img/.gitkeep


BIN=BIN
Web/img/1.jpg


BIN=BIN
Web/img/2.jpg


BIN=BIN
Web/img/3.jpg


BIN=BIN
Web/img/logo.png


+ 33 - 0
Web/index.html

@@ -0,0 +1,33 @@
+<!doctype html>
+<html class="no-js" lang="">
+
+<head>
+  <meta charset="utf-8">
+  <meta name="viewport" content="width=device-width, initial-scale=1">
+  <title></title>
+  <link rel="stylesheet" href="css/style.css">
+  <meta name="description" content="">
+
+  <meta property="og:title" content="">
+  <meta property="og:type" content="">
+  <meta property="og:url" content="">
+  <meta property="og:image" content="">
+  <meta property="og:image:alt" content="">
+
+  <link rel="icon" href="/favicon.ico" sizes="any">
+  <link rel="icon" href="/icon.svg" type="image/svg+xml">
+  <link rel="apple-touch-icon" href="icon.png">
+
+  <link rel="manifest" href="site.webmanifest">
+  <meta name="theme-color" content="#fafafa">
+</head>
+
+<body>
+
+  <!-- Add your site or application content here -->
+  <p>Hello world! This is HTML5 Boilerplate.</p>
+  <script src="js/app.js"></script>
+
+</body>
+
+</html>

+ 6 - 0
Web/js/a.js

@@ -0,0 +1,6 @@
+//js代码
+let btn = document.getElementById("btn1");
+
+btn.onclick = function (){
+  alert("hello world 123");
+}

+ 0 - 0
Web/js/app.js


+ 0 - 0
Web/js/vendor/.gitkeep


+ 24 - 0
Web/package.json

@@ -0,0 +1,24 @@
+{
+  "name": " ",
+  "version": "0.0.1",
+  "description": "",
+  "private": true,
+  "keywords": [
+    ""
+  ],
+  "license": "",
+  "author": "",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "start": "webpack serve --open --config webpack.config.dev.js",
+    "build": "webpack --config webpack.config.prod.js"
+  },
+  "devDependencies": {
+    "copy-webpack-plugin": "^11.0.0",
+    "html-webpack-plugin": "^5.6.0",
+    "webpack": "^5.91.0",
+    "webpack-cli": "^5.1.4",
+    "webpack-dev-server": "^5.0.4",
+    "webpack-merge": "^5.10.0"
+  }
+}

+ 5 - 0
Web/robots.txt

@@ -0,0 +1,5 @@
+# www.robotstxt.org/
+
+# Allow crawling of all content
+User-agent: *
+Disallow:

+ 12 - 0
Web/site.webmanifest

@@ -0,0 +1,12 @@
+{
+  "short_name": "",
+  "name": "",
+  "icons": [{
+    "src": "icon.png",
+    "type": "image/png",
+    "sizes": "192x192"
+  }],
+  "start_url": "/?utm_source=homescreen",
+  "background_color": "#fafafa",
+  "theme_color": "#fafafa"
+}

+ 12 - 0
Web/webpack.common.js

@@ -0,0 +1,12 @@
+const path = require('path');
+
+module.exports = {
+  entry: {
+    app: './js/app.js',
+  },
+  output: {
+    path: path.resolve(__dirname, 'dist'),
+    clean: true,
+    filename: './js/app.js',
+  },
+};

+ 13 - 0
Web/webpack.config.dev.js

@@ -0,0 +1,13 @@
+const { merge } = require('webpack-merge');
+const common = require('./webpack.common.js');
+
+module.exports = merge(common, {
+  mode: 'development',
+  devtool: 'inline-source-map',
+  devServer: {
+    liveReload: true,
+    hot: true,
+    open: true,
+    static: ['./'],
+  },
+});

+ 26 - 0
Web/webpack.config.prod.js

@@ -0,0 +1,26 @@
+const { merge } = require('webpack-merge');
+const common = require('./webpack.common.js');
+const HtmlWebpackPlugin = require('html-webpack-plugin');
+const CopyPlugin = require('copy-webpack-plugin');
+
+module.exports = merge(common, {
+  mode: 'production',
+  plugins: [
+    new HtmlWebpackPlugin({
+      template: './index.html',
+    }),
+    new CopyPlugin({
+      patterns: [
+        { from: 'img', to: 'img' },
+        { from: 'css', to: 'css' },
+        { from: 'js/vendor', to: 'js/vendor' },
+        { from: 'icon.svg', to: 'icon.svg' },
+        { from: 'favicon.ico', to: 'favicon.ico' },
+        { from: 'robots.txt', to: 'robots.txt' },
+        { from: 'icon.png', to: 'icon.png' },
+        { from: '404.html', to: '404.html' },
+        { from: 'site.webmanifest', to: 'site.webmanifest' },
+      ],
+    }),
+  ],
+});

+ 38 - 0
mybatis/mybatis02/.gitignore

@@ -0,0 +1,38 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store

+ 8 - 0
mybatis/mybatis02/.idea/.gitignore

@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 7 - 0
mybatis/mybatis02/.idea/encodings.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding">
+    <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
+  </component>
+</project>

+ 14 - 0
mybatis/mybatis02/.idea/misc.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ExternalStorageConfigurationManager" enabled="true" />
+  <component name="MavenProjectsManager">
+    <option name="originalFiles">
+      <list>
+        <option value="$PROJECT_DIR$/pom.xml" />
+      </list>
+    </option>
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/out" />
+  </component>
+</project>

+ 124 - 0
mybatis/mybatis02/.idea/uiDesigner.xml

@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Palette2">
+    <group name="Swing">
+      <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+      </item>
+      <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
+        <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+        <initial-values>
+          <property name="text" value="Button" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="RadioButton" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="CheckBox" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="Label" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+          <preferred-size width="200" height="200" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+          <preferred-size width="200" height="200" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+          <preferred-size width="-1" height="20" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+      </item>
+    </group>
+  </component>
+</project>

+ 49 - 0
mybatis/mybatis02/pom.xml

@@ -0,0 +1,49 @@
+<?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.lc</groupId>
+    <artifactId>mybatis02</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>RELEASE</version>
+            <scope>compile</scope>
+        </dependency>
+        <!-- mysql驱动 -->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>8.0.26</version>
+        </dependency>
+        <!--导入MyBatis的jar包-->
+        <dependency>
+            <groupId>org.mybatis</groupId>
+            <artifactId>mybatis</artifactId>
+            <version>3.5.6</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>compile</scope>
+        </dependency>
+        <!-- log4j -->
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>1.2.17</version>
+        </dependency>
+
+    </dependencies>
+</project>

+ 19 - 0
mybatis/mybatis02/src/main/java/com/lc/mybatis/entity/Dept.java

@@ -0,0 +1,19 @@
+package com.lc.mybatis.entity;
+
+import lombok.Data;
+import lombok.ToString;
+
+import java.util.List;
+
+@Data
+@ToString
+public class Dept {
+
+    private Integer id;
+    private String dname;
+    private String ddesc;
+
+    //集合
+    private List<User> userList;
+
+}

+ 23 - 0
mybatis/mybatis02/src/main/java/com/lc/mybatis/entity/User.java

@@ -0,0 +1,23 @@
+package com.lc.mybatis.entity;
+
+
+import lombok.Data;
+import lombok.ToString;
+
+@Data
+@ToString
+public class User {
+
+    private  Integer id;
+    private  String username;
+    private  String password;
+    private  String gender;
+    private  String address;
+
+    //部门类
+    private Dept dept;
+
+    //部门id
+    private Integer dId;
+
+}

+ 15 - 0
mybatis/mybatis02/src/main/java/com/lc/mybatis/mapper/DeptMapper.java

@@ -0,0 +1,15 @@
+package com.lc.mybatis.mapper;
+
+import com.lc.mybatis.entity.Dept;
+import com.lc.mybatis.entity.User;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface DeptMapper {
+
+    /* 查询  */
+    public Dept getDeptById(Integer id);
+    public Dept getDeptByIdStep(Integer id);
+
+}

+ 17 - 0
mybatis/mybatis02/src/main/java/com/lc/mybatis/mapper/UserMapper.java

@@ -0,0 +1,17 @@
+package com.lc.mybatis.mapper;
+
+import com.lc.mybatis.entity.User;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface UserMapper {
+    //添加接口
+    public int addUser( User user );
+
+    //查询
+    public List<User> getUserList( @Param("filed") String filed, @Param("orderType") String orderType );
+    public User getUserById( Integer id );
+
+    public User getUserByIdStep( Integer id );
+}

+ 40 - 0
mybatis/mybatis02/src/main/java/com/lc/mybatis/test/TestDeptResultMap.java

@@ -0,0 +1,40 @@
+package com.lc.mybatis.test;
+
+import com.lc.mybatis.entity.Dept;
+import com.lc.mybatis.entity.User;
+import com.lc.mybatis.mapper.DeptMapper;
+import com.lc.mybatis.mapper.UserMapper;
+import org.apache.ibatis.io.Resources;
+import org.apache.ibatis.session.SqlSession;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.apache.ibatis.session.SqlSessionFactoryBuilder;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+public class TestDeptResultMap {
+
+
+
+
+    @Test
+    public void test01() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory  = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession = sqlSessionFactory.openSession(true);
+
+        //执行sql
+        DeptMapper mapper = sqlSession.getMapper(DeptMapper.class);
+        Dept dept = mapper.getDeptById(1);
+
+        System.out.println("部门信息:"+dept);
+
+        //释放
+        sqlSession.close();
+    }
+
+
+}

+ 61 - 0
mybatis/mybatis02/src/main/java/com/lc/mybatis/test/TestMybatis.java

@@ -0,0 +1,61 @@
+package com.lc.mybatis.test;
+
+import com.lc.mybatis.entity.User;
+import com.lc.mybatis.mapper.UserMapper;
+import org.apache.ibatis.io.Resources;
+import org.apache.ibatis.session.SqlSession;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.apache.ibatis.session.SqlSessionFactoryBuilder;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+public class TestMybatis {
+
+
+
+
+    @Test
+    public void test01() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory  = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession = sqlSessionFactory.openSession(true);
+        //获取接口  jdk动态代理 UserMapper 代理类 反射技术
+        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
+        //调用
+        User user = new User();
+        user.setUsername("zs01");
+        user.setPassword("123456");
+        user.setGender("m");
+        user.setAddress("北京");
+
+        mapper.addUser(user);
+
+        Integer id = user.getId();
+        System.out.println("主键:"+id);
+
+        //释放
+        sqlSession.close();
+    }
+
+    @Test
+    public void test02() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession = sqlSessionFactory.openSession(true);
+        //获取接口  jdk动态代理 UserMapper 代理类 反射技术
+        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
+        //调用
+        List<User> userList = mapper.getUserList("id","desc");
+
+        userList.forEach(System.out::println);
+
+    }
+
+}

+ 78 - 0
mybatis/mybatis02/src/main/java/com/lc/mybatis/test/TestUserResultMap.java

@@ -0,0 +1,78 @@
+package com.lc.mybatis.test;
+
+import com.lc.mybatis.entity.User;
+import com.lc.mybatis.mapper.UserMapper;
+import org.apache.ibatis.io.Resources;
+import org.apache.ibatis.session.SqlSession;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.apache.ibatis.session.SqlSessionFactoryBuilder;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+public class TestUserResultMap {
+
+
+
+
+    @Test
+    public void test01() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory  = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession = sqlSessionFactory.openSession(true);
+        //获取接口  jdk动态代理 UserMapper 代理类 反射技术
+        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
+
+        User user = mapper.getUserById(3);
+
+        System.out.println("用户信息:"+user);
+
+        //释放
+        sqlSession.close();
+    }
+
+
+
+    @Test
+    public void test02() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory  = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession = sqlSessionFactory.openSession(true);
+        //获取接口  jdk动态代理 UserMapper 代理类 反射技术
+        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
+
+        User user = mapper.getUserByIdStep(3);
+
+        System.out.println("用户信息:"+user);
+
+        //释放
+        sqlSession.close();
+    }
+
+
+    @Test
+    public void test03() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory  = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession = sqlSessionFactory.openSession(true);
+        //获取接口  jdk动态代理 UserMapper 代理类 反射技术
+        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
+
+        User user = mapper.getUserByIdStep(3);
+
+        System.out.println("用户名:"+user.getUsername());
+
+        System.out.println("==================");
+
+        System.out.println("部门名:"+user.getDept().getDname());
+        //释放
+        sqlSession.close();
+    }
+}

+ 45 - 0
mybatis/mybatis02/src/main/resources/com/lc/mybatis/mapper/DeptMapper.xml

@@ -0,0 +1,45 @@
+<?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.lc.mybatis.mapper.DeptMapper">
+
+    <!-- 部门查询  resultMap -->
+    <resultMap id="deptResultMap" type="com.lc.mybatis.entity.Dept"  >
+        <!-- 部门属性 省略 -->
+        <result column="id" property="id"/>
+        <result column="dname" property="dname"/>
+        <result column="ddesc" property="ddesc"/>
+        <!--
+            collection 一对多映射
+            用户属性 ofType 全路径名称  userList的 类型-->
+        <collection property="userList" ofType="com.lc.mybatis.entity.User"   >
+            <id column="uid" property="id"/>
+            <result column="username" property="username"/>
+            <result column="password" property="password"/>
+            <result column="gender" property="gender"/>
+        </collection>
+    </resultMap>
+
+    <!-- 部门查询 -->
+    <select id="getDeptById" resultMap="deptResultMap" >
+        SELECT
+            d.* ,
+            u.id uid,
+            u.username username,
+            u.password password,
+            u.gender gender
+        FROM
+            t_dept d
+                LEFT JOIN  t_user u ON d.id = u.d_id
+        WHERE
+            d.id = #{id}
+    </select>
+
+    <!-- getDeptByIdStep -->
+    <select id="getDeptByIdStep" resultType="com.lc.mybatis.entity.Dept">
+        SELECT * FROM t_dept WHERE id = #{id}
+    </select>
+
+</mapper>

+ 111 - 0
mybatis/mybatis02/src/main/resources/com/lc/mybatis/mapper/UserMapper.xml

@@ -0,0 +1,111 @@
+<?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.lc.mybatis.mapper.UserMapper">
+
+    <!--
+        useGeneratedKeys 获取自增主键
+        keyProperty 接收自增主键的属性
+     -->
+    <insert id="addUser"
+        useGeneratedKeys="true"
+        keyProperty="id"
+    >
+        INSERT INTO`t_user` (  `username`, `password`, `gender`, `address` )
+        VALUES
+            (  #{username}, #{password}, #{gender}, #{address} );
+    </insert>
+
+    <!-- 查询
+       - #{} 底层执行SQL语句的对象,使用**PreparedStatementd**,预编译SQL,防止SQL注入安全隐患,相对比较安全。
+        - ${} 底层执行SQL语句的对象使用**Statement**对象,未解决SQL注入安全隐患,相对不安全。
+       -->
+    <select id="getUserList"  resultType="com.lc.mybatis.entity.User" >
+        SELECT * FROM `t_user` order by ${filed} ${orderType};
+    </select>
+
+    <!-- resultMap
+        autoMapping="true" 自动映射
+     -->
+    <resultMap id="userResultMap" type="com.lc.mybatis.entity.User" >
+        <!--
+            id 标签 表示主键
+                column 属性 表示数据库中的字段名
+                property 属性 表示实体类中的属性名
+            result 非主键
+        -->
+        <id column="id" property="id"/>
+        <result column="username" property="username"/>
+        <result column="password" property="password"/>
+        <result column="gender" property="gender"/>
+
+        <!-- 部门属性  级联映射
+        <result column="dept_id" property="dept.id"/>
+        <result column="dname" property="dept.dname"/>
+        <result column="ddesc" property="dept.ddesc"/>
+         -->
+
+        <!-- 部门属性 关联方式 association 一对一的管理
+            property 用户中的部门属性
+            javaType 类型 全路经名称
+        -->
+        <association property="dept" javaType="com.lc.mybatis.entity.Dept">
+            <result column="dept_id" property="id"/>
+            <result column="dname" property="dname"/>
+            <result column="ddesc" property="ddesc"/>
+        </association>
+
+    </resultMap>
+
+    <select id="getUserById"  resultMap="userResultMap" >
+        SELECT
+            u.* ,
+            d.id dept_id,
+            d.dname dname,
+            d.ddesc ddesc
+        FROM
+            `t_user` u
+                LEFT JOIN t_dept d ON u.d_id = d.id
+        WHERE
+            u.id = #{id}
+    </select>
+
+    <!-- ################## 分步查询 ################################### -->
+    
+    <resultMap id="userResultMapStep" type="com.lc.mybatis.entity.User">
+        <id column="id" property="id"/>
+        <result column="username" property="username"/>
+        <result column="password" property="password"/>
+        <result column="gender" property="gender"/>
+        <result column="gender" property="gender"/>
+
+        <!--
+            select 查询方法 接口 + 方法名称
+            column 查询需要的条件 字段的值 传递到select的方法中
+         -->
+        <association
+                property="dept"
+                javaType="com.lc.mybatis.entity.Dept"
+                select="com.lc.mybatis.mapper.DeptMapper.getDeptByIdStep"
+                fetchType="lazy"
+                column="d_id"
+        ></association>
+
+    </resultMap>
+
+    <select id="getUserByIdStep"  resultMap="userResultMapStep" >
+        SELECT
+           *
+        FROM
+            `t_user`
+        WHERE
+            id = #{id}
+    </select>
+
+
+
+
+
+</mapper>

+ 4 - 0
mybatis/mybatis02/src/main/resources/jdbc.properties

@@ -0,0 +1,4 @@
+driver=com.mysql.jdbc.Driver
+url=jdbc:mysql://192.168.18.22:3306/vip33
+username=vip33
+password=123456

+ 8 - 0
mybatis/mybatis02/src/main/resources/log4j.properties

@@ -0,0 +1,8 @@
+# ??????
+log4j.rootLogger=ERROR, stdout
+# MyBatis ????
+log4j.logger.com.lc=DEBUG  #???
+# ?????
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

+ 69 - 0
mybatis/mybatis02/src/main/resources/mybatis-config.xml

@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE configuration
+        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-config.dtd">
+<configuration>
+    <!--
+        properties 加载配置文件
+        resource 配置文件路径  不需要加classpath
+        通过 ${key}
+     -->
+    <properties resource="jdbc.properties"></properties>
+
+    <!-- setting 设置 -->
+    <settings>
+        <!-- 是否开启驼峰命名自动映射,即从经典数据库列名 A_COLUMN 映射到经典
+            java 属性 和  表总字段
+            loginName     login_name
+         -->
+        <setting name="mapUnderscoreToCamelCase" value="true"/>
+        <!-- 延迟加载 -->
+        <setting name="lazyLoadingEnabled" value="true"/>
+    </settings>
+
+
+    <!-- 别名 -->
+    <typeAliases>
+        <!-- 包路径别名配置 在当前表下面 都进行别名配置
+            配置规则
+                User 类名   别名  user
+         -->
+        <package name="com.lc.mybatis.entity"/>
+    </typeAliases>
+
+
+    <!--
+        环境配置
+        default 默认
+
+        environment id = default
+        transactionManager 事务管理器  type = JDBC – 这个配置直接使用了 JDBC 的提交和回滚设施
+        dataSource  数据源
+            type 连接池  使用连接池 POOLED
+            property 标签 设置 数据源的 key以及 value
+    -->
+    <environments default="development">
+        <environment id="development">
+            <transactionManager type="JDBC"/>
+            <dataSource type="POOLED">
+                <property name="driver" value="${driver}"/>
+                <property name="url" value="${url}"/>
+                <property name="username" value="${username}"/>
+                <property name="password" value="${password}"/>
+            </dataSource>
+        </environment>
+    </environments>
+
+    <!-- 导入xml文件  -->
+    <mappers>
+        <!-- 加载mapper映射文件 -->
+        <!-- 包管理方式
+            name 包路径
+            默认规则 mapper接口位置 和  xml位置必须相同
+            编译之后的路径
+         -->
+        <package name="com.lc.mybatis.mapper"/>
+
+
+    </mappers>
+</configuration>

+ 38 - 0
mybatis/mybatis03/.gitignore

@@ -0,0 +1,38 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store

+ 8 - 0
mybatis/mybatis03/.idea/.gitignore

@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 7 - 0
mybatis/mybatis03/.idea/encodings.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding">
+    <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
+  </component>
+</project>

+ 12 - 0
mybatis/mybatis03/.idea/misc.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ExternalStorageConfigurationManager" enabled="true" />
+  <component name="MavenProjectsManager">
+    <option name="originalFiles">
+      <list>
+        <option value="$PROJECT_DIR$/pom.xml" />
+      </list>
+    </option>
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK" />
+</project>

+ 124 - 0
mybatis/mybatis03/.idea/uiDesigner.xml

@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Palette2">
+    <group name="Swing">
+      <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+      </item>
+      <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
+        <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+        <initial-values>
+          <property name="text" value="Button" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="RadioButton" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="CheckBox" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="Label" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+          <preferred-size width="200" height="200" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+          <preferred-size width="200" height="200" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+          <preferred-size width="-1" height="20" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+      </item>
+    </group>
+  </component>
+</project>

+ 67 - 0
mybatis/mybatis03/pom.xml

@@ -0,0 +1,67 @@
+<?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.lc</groupId>
+    <artifactId>mybatis03</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>RELEASE</version>
+            <scope>compile</scope>
+        </dependency>
+        <!-- mysql驱动 -->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>8.0.26</version>
+        </dependency>
+        <!--导入MyBatis的jar包-->
+        <dependency>
+            <groupId>org.mybatis</groupId>
+            <artifactId>mybatis</artifactId>
+            <version>3.5.6</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>compile</scope>
+        </dependency>
+        <!-- log4j -->
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>1.2.17</version>
+        </dependency>
+        <!-- 分页 -->
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper</artifactId>
+            <version>5.1.2</version>
+        </dependency>
+
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>9</source>
+                    <target>9</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 19 - 0
mybatis/mybatis03/src/main/java/com/lc/mybatis/entity/User.java

@@ -0,0 +1,19 @@
+package com.lc.mybatis.entity;
+
+
+import lombok.Data;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+@Data
+@ToString
+public class User implements Serializable {
+
+    private  Integer id;
+    private  String username;
+    private  String password;
+    private  String gender;
+    private  String address;
+
+}

+ 21 - 0
mybatis/mybatis03/src/main/java/com/lc/mybatis/mapper/UserMapper.java

@@ -0,0 +1,21 @@
+package com.lc.mybatis.mapper;
+
+import com.lc.mybatis.entity.User;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface UserMapper {
+
+    public List<User> getByUser( User user );
+    public List<User> getByUserChoose( User user );
+    public List<User> getByUserWhere( User user );
+    public List<User> getByUserTrim01( User user );
+    public void updateUserSet(User user );
+    public void updateUserTrim02(User user );
+    public void insertBatch(@Param("userList") List<User> userList );
+    public void deleteByIds(@Param("ids") List<Integer> ids );
+    public User getById( Integer id );
+    public List<User> getUserList();
+
+}

+ 301 - 0
mybatis/mybatis03/src/main/java/com/lc/mybatis/test/TestUser.java

@@ -0,0 +1,301 @@
+package com.lc.mybatis.test;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.lc.mybatis.entity.User;
+import com.lc.mybatis.mapper.UserMapper;
+import org.apache.ibatis.io.Resources;
+import org.apache.ibatis.session.SqlSession;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.apache.ibatis.session.SqlSessionFactoryBuilder;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+public class TestUser {
+
+
+
+
+    @Test
+    public void test01() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory  = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession = sqlSessionFactory.openSession(true);
+        //获取接口  jdk动态代理 UserMapper 代理类 反射技术
+        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
+
+        User user = new User();
+
+        user.setUsername("zs");
+        //user.setGender("男");
+        user.setAddress("北京");
+
+        List<User> userList = mapper.getByUser(user);
+
+        System.out.println("用户信息:"+userList);
+
+        //释放
+        sqlSession.close();
+    }
+
+
+    @Test
+    public void test02() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory  = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession = sqlSessionFactory.openSession(true);
+        //获取接口  jdk动态代理 UserMapper 代理类 反射技术
+        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
+
+        User user = new User();
+
+        //user.setUsername("zs");
+        //user.setGender("男");
+        user.setAddress("北京");
+
+        List<User> userList = mapper.getByUserChoose(user);
+
+        System.out.println("用户信息:"+userList);
+
+        //释放
+        sqlSession.close();
+    }
+
+
+
+    @Test
+    public void test03() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory  = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession = sqlSessionFactory.openSession(true);
+        //获取接口  jdk动态代理 UserMapper 代理类 反射技术
+        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
+
+        User user = new User();
+
+        //user.setUsername("zs");
+        user.setGender("男");
+        user.setAddress("北京");
+
+        List<User> userList = mapper.getByUserWhere(user);
+
+        System.out.println("用户信息:"+userList);
+
+        //释放
+        sqlSession.close();
+    }
+
+
+
+    @Test
+    public void test04() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory  = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession = sqlSessionFactory.openSession(true);
+        //获取接口  jdk动态代理 UserMapper 代理类 反射技术
+        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
+
+        User user = new User();
+
+        user.setUsername("zs");
+        user.setGender("男");
+        user.setAddress("北京");
+
+        List<User> userList = mapper.getByUserTrim01(user);
+
+        System.out.println("用户信息:"+userList);
+
+        //释放
+        sqlSession.close();
+    }
+
+
+    @Test
+    public void test05() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory  = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession = sqlSessionFactory.openSession(true);
+        //获取接口  jdk动态代理 UserMapper 代理类 反射技术
+        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
+
+        User user = new User();
+        user.setId(1);
+        //user.setUsername("zs1");
+        user.setGender("女");
+        user.setAddress("天津");
+
+        mapper.updateUserSet(user);
+
+        //释放
+        sqlSession.close();
+    }
+
+
+    @Test
+    public void test06() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory  = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession = sqlSessionFactory.openSession(true);
+        //获取接口  jdk动态代理 UserMapper 代理类 反射技术
+        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
+
+        User user = new User();
+        user.setId(1);
+        //user.setUsername("zs1");
+        user.setGender("女");
+        user.setAddress("上海");
+
+        mapper.updateUserTrim02(user);
+
+        //释放
+        sqlSession.close();
+    }
+
+
+    @Test
+    public void test07() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory  = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession = sqlSessionFactory.openSession(true);
+        //获取接口  jdk动态代理 UserMapper 代理类 反射技术
+        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
+
+        List<User> userList = new ArrayList<>();
+
+        for (int i = 0; i < 3; i++) {
+            User user = new User();
+            user.setId(7+i);
+            user.setUsername("zs1");
+            user.setPassword("123456");
+            user.setGender("女");
+            user.setAddress("上海");
+
+            userList.add(user);
+        }
+
+        mapper.insertBatch(userList);
+
+        //释放
+        sqlSession.close();
+    }
+
+    @Test
+    public void test08() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory  = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession = sqlSessionFactory.openSession(true);
+        //获取接口  jdk动态代理 UserMapper 代理类 反射技术
+        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
+
+
+        ArrayList<Integer> ids = new ArrayList<>();
+        ids.add(7);
+        ids.add(8);
+        ids.add(9);
+        mapper.deleteByIds(ids);
+
+        //释放
+        sqlSession.close();
+    }
+
+
+    @Test
+    public void test09() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory  = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession = sqlSessionFactory.openSession(true);
+        //获取接口  jdk动态代理 UserMapper 代理类 反射技术
+        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
+
+        User user1 = mapper.getById(2);
+        //清空
+        sqlSession.clearCache();
+        System.out.println("........................");
+        User user2 = mapper.getById(2);
+
+        //释放
+        sqlSession.close();
+    }
+
+
+
+    @Test
+    public void test010() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory  = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession1 = sqlSessionFactory.openSession(true);
+        SqlSession sqlSession2 = sqlSessionFactory.openSession(true);
+
+        UserMapper mapper1 = sqlSession1.getMapper(UserMapper.class);
+        UserMapper mapper2 = sqlSession2.getMapper(UserMapper.class);
+
+        User user = mapper1.getById(4);
+        //释放
+        sqlSession1.close();
+
+        User user2 = mapper2.getById(4);
+        User user3 = mapper2.getById(4);
+        User user4 = mapper2.getById(4);
+
+        sqlSession2.close();
+    }
+
+
+    @Test
+    public void test011() throws IOException {
+        //构建sqlSessionfactory
+        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
+        SqlSessionFactory sqlSessionFactory  = new SqlSessionFactoryBuilder().build(is);
+        //获取 SqlSession
+        SqlSession sqlSession = sqlSessionFactory.openSession(true);
+        //获取接口  jdk动态代理 UserMapper 代理类 反射技术
+        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
+
+        //page 当前页
+        //size 每页显示条数
+        //PageHelper.startPage(page,size);
+        PageHelper.startPage(1,2);
+        //list
+        List<User> userList = mapper.getUserList();
+
+        PageInfo<User> pageInfo = new PageInfo<>(userList);
+
+        List<User> list = pageInfo.getList();
+
+        //list 集合
+        list.forEach(System.out::println);
+
+        System.out.println("集合:"+list.getClass());
+        System.out.println("页码:"+pageInfo.getPages());
+        System.out.println("上一页:"+pageInfo.getPrePage());
+        System.out.println("数量:"+pageInfo.getTotal());
+
+        //释放
+        sqlSession.close();
+    }
+}

+ 206 - 0
mybatis/mybatis03/src/main/resources/com/lc/mybatis/mapper/UserMapper.xml

@@ -0,0 +1,206 @@
+<?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.lc.mybatis.mapper.UserMapper">
+
+    <!--
+        定义sql片段
+        使用 include 引用refid sql片段id
+     -->
+    <sql id="userColumns">
+        id,username,password,gender,address
+    </sql>
+
+    <!--
+        if
+         属性 test 返回 布尔类型。 true 执行  false 不执行
+        test "el 表达式"  使用 属性  方法。
+    -->
+    <select id="getByUser"  resultType="com.lc.mybatis.entity.User" >
+        SELECT
+            <include refid="userColumns"></include>
+        FROM
+            `t_user`
+
+        where 1=1
+
+        <if test=" username != null and username != ''  ">
+            and  username = #{username}
+        </if>
+        <if test=" gender != null and gender != ''  ">
+            and  gender = #{gender}
+        </if>
+        <if test=" address != null and address != ''  ">
+            and  address = #{address}
+        </if>
+
+
+    </select>
+
+
+    <!--
+        choose、when、otherwise 语句
+        choose 包裹
+            when 判断 注意 执行其中一个。
+            otherwise 默认执行
+     -->
+    <select id="getByUserChoose"  resultType="com.lc.mybatis.entity.User" >
+        SELECT
+        *
+        FROM
+        `t_user`
+
+        where 1=1
+
+        <choose>
+            <when test=" username != null and username != '' ">
+                and  username = #{username}
+            </when>
+            <when test=" gender != null and gender != '' ">
+                and  gender = #{gender}
+            </when>
+            <otherwise>
+                and address = #{address}
+            </otherwise>
+        </choose>
+    </select>
+
+    <!--  where 标签  去除and 和 添加 where  -->
+    <select id="getByUserWhere"  resultType="com.lc.mybatis.entity.User" >
+        SELECT
+        *
+        FROM
+        `t_user`
+
+        <where>
+            <if test=" username != null and username != ''  ">
+                username = #{username}
+            </if>
+            <if test=" gender != null and gender != ''  ">
+                and  gender = #{gender}
+            </if>
+            <if test=" address != null and address != ''  ">
+                and  address = #{address}
+            </if>
+        </where>
+
+    </select>
+
+    <!--
+      trim 替换
+        prefix 前缀
+        prefixOverrides 覆盖前缀
+        suffix 后缀
+        suffixOverrides 覆盖后缀
+     -->
+
+    <select id="getByUserTrim01"  resultType="com.lc.mybatis.entity.User" >
+        SELECT
+        *
+        FROM
+        `t_user`
+        <trim prefix="where" prefixOverrides="and"  >
+            <if test=" username != null and username != ''  ">
+               and username = #{username}
+            </if>
+            <if test=" gender != null and gender != ''  ">
+                and  gender = #{gender}
+            </if>
+            <if test=" address != null and address != ''  ">
+                and  address = #{address}
+            </if>
+        </trim>
+
+    </select>
+
+
+    <!--
+        set 添加 set 去除 ,
+           修改
+     -->
+    <update id="updateUserSet">
+
+        update t_user
+        <set>
+            <if test=" username != null and username != ''  ">
+                username = #{username} ,
+            </if>
+            <if test=" gender != null and gender != ''  ">
+                gender = #{gender} ,
+            </if>
+            <if test=" address != null and address != ''  ">
+                address = #{address} ,
+            </if>
+            <if test=" password != null and password != ''  ">
+                password = #{password} ,
+            </if>
+        </set>
+
+        where id = #{id}
+    </update>
+
+    <update id="updateUserTrim02">
+
+        update t_user
+
+        <trim prefix="set"  suffixOverrides=","  >
+            <if test=" username != null and username != ''  ">
+                username = #{username} ,
+            </if>
+            <if test=" gender != null and gender != ''  ">
+                gender = #{gender} ,
+            </if>
+            <if test=" address != null and address != ''  ">
+                address = #{address} ,
+            </if>
+            <if test=" password != null and password != ''  ">
+                password = #{password} ,
+            </if>
+        </trim>
+
+        where id = #{id}
+    </update>
+
+    <!--
+        foreach
+            collection 集合名称
+            open="" 开始符号
+            separator="" 分隔符号
+            close="" 关闭符号
+            index=""  索引
+            item=""  元素
+     -->
+    <insert id="insertBatch">
+        INSERT INTO `vip33`.`t_user`
+        VALUES
+        <foreach collection="userList"  item="user"  separator=",">
+            ( #{user.id}, null, #{user.username}, #{user.username},#{user.gender}, #{user.address} )
+        </foreach>
+
+    </insert>
+
+    <delete id="deleteByIds">
+        delete from  t_user
+        where id in
+        <foreach collection="ids" open="(" item="id"  separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <!-- 二级缓存 -->
+    <cache ></cache>
+
+    <!-- getById -->
+    <select id="getById" resultType="com.lc.mybatis.entity.User">
+        select  * from  t_user where id= #{id}
+    </select>
+
+
+    <!-- 查询分页  -->
+    <select id="getUserList"  resultType="com.lc.mybatis.entity.User">
+        select  * from  t_user
+    </select>
+
+</mapper>

+ 4 - 0
mybatis/mybatis03/src/main/resources/jdbc.properties

@@ -0,0 +1,4 @@
+driver=com.mysql.jdbc.Driver
+url=jdbc:mysql://192.168.18.22:3306/vip33
+username=vip33
+password=123456

+ 8 - 0
mybatis/mybatis03/src/main/resources/log4j.properties

@@ -0,0 +1,8 @@
+# ??????
+log4j.rootLogger=ERROR, stdout
+# MyBatis ????
+log4j.logger.com.lc=DEBUG  #???
+# ?????
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

+ 77 - 0
mybatis/mybatis03/src/main/resources/mybatis-config.xml

@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE configuration
+        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-config.dtd">
+<configuration>
+    <!--
+        properties 加载配置文件
+        resource 配置文件路径  不需要加classpath
+        通过 ${key}
+     -->
+    <properties resource="jdbc.properties"></properties>
+
+    <!-- setting 设置 -->
+    <settings>
+        <!-- 是否开启驼峰命名自动映射,即从经典数据库列名 A_COLUMN 映射到经典
+            java 属性 和  表总字段
+            loginName     login_name
+         -->
+        <setting name="mapUnderscoreToCamelCase" value="true"/>
+        <!-- 延迟加载 -->
+        <setting name="lazyLoadingEnabled" value="true"/>
+
+        <!-- 二级缓存 -->
+        <setting name="cacheEnabled" value="true"/>
+    </settings>
+    
+
+
+    <!-- 别名 -->
+    <typeAliases>
+        <!-- 包路径别名配置 在当前表下面 都进行别名配置
+            配置规则
+                User 类名   别名  user
+         -->
+        <package name="com.lc.mybatis.entity"/>
+    </typeAliases>
+
+    <!-- 分页插件 -->
+    <plugins>
+        <plugin interceptor="com.github.pagehelper.PageInterceptor"></plugin>
+    </plugins>
+
+    <!--
+        环境配置
+        default 默认
+
+        environment id = default
+        transactionManager 事务管理器  type = JDBC – 这个配置直接使用了 JDBC 的提交和回滚设施
+        dataSource  数据源
+            type 连接池  使用连接池 POOLED
+            property 标签 设置 数据源的 key以及 value
+    -->
+    <environments default="development">
+        <environment id="development">
+            <transactionManager type="JDBC"/>
+            <dataSource type="POOLED">
+                <property name="driver" value="${driver}"/>
+                <property name="url" value="${url}"/>
+                <property name="username" value="${username}"/>
+                <property name="password" value="${password}"/>
+            </dataSource>
+        </environment>
+    </environments>
+
+    <!-- 导入xml文件  -->
+    <mappers>
+        <!-- 加载mapper映射文件 -->
+        <!-- 包管理方式
+            name 包路径
+            默认规则 mapper接口位置 和  xml位置必须相同
+            编译之后的路径
+         -->
+        <package name="com.lc.mybatis.mapper"/>
+
+
+    </mappers>
+</configuration>