From 815843348facb71a2a01a3e1866cd461f2f1e775 Mon Sep 17 00:00:00 2001 From: Mth Zhang Date: Sat, 30 Dec 2023 20:50:05 +0800 Subject: [PATCH] 2023 1330 20:49 commit --- LICENSE | 73 ---------- README.md | 3 - mybatis_all/.idea/compiler.xml | 2 + mybatis_all/.idea/encodings.xml | 1 + .../libraries/Maven__log4j_log4j_1_2_16.xml | 13 ++ .../Maven__org_slf4j_slf4j_api_1_6_1.xml | 13 ++ .../Maven__org_slf4j_slf4j_log4j12_1_6_1.xml | 13 ++ mybatis_all/.idea/misc.xml | 1 + mybatis_all/.idea/modules.xml | 1 + mybatis_all/.idea/vcs.xml | 6 + mybatis_all/mybatisTest01/log/test.log | Bin 98512 -> 0 bytes .../com/zhangzeyuan/mapper/DeptMapper.java | 2 +- .../com/zhangzeyuan/mapper/EmpMapper2.java | 11 ++ .../com/zhangzeyuan/mapper/EmpMapper3.java | 18 +++ .../com/zhangzeyuan/mapper/ProjectMapper.java | 16 +++ .../main/java/com/zhangzeyuan/pojo/Dept.java | 11 +- .../main/java/com/zhangzeyuan/pojo/Emp.java | 14 +- .../java/com/zhangzeyuan/pojo/Project.java | 23 ++++ .../com/zhangzeyuan/pojo/ProjectRecord.java | 21 +++ .../com/zhangzeyuan/mapper/EmpMapper2.xml | 125 ++++++++++++++++++ .../com/zhangzeyuan/mapper/EmpMapper3.xml | 56 ++++++++ .../com/zhangzeyuan/mapper/ProjectMapper.xml | 35 +++++ .../src/main/resources/log4j2.xml | 4 +- .../src/main/resources/sqlMapConfig.xml | 5 + .../test/TestEmpDynamicSelect.java | 99 ++++++++++++++ .../com/zhangzeyuan/test/TestEmpMapper3.java | 98 ++++++++++++++ .../zhangzeyuan/test/TestProjectMapper.java | 86 ++++++++++++ .../META-INF/mybatisTest01.kotlin_module | Bin 16 -> 0 bytes .../classes/com/zhangzeyuan/pojo/Dept.class | Bin 2479 -> 3542 bytes .../classes/com/zhangzeyuan/pojo/Emp.class | Bin 4866 -> 5837 bytes .../mybatisTest01/target/classes/log4j2.xml | 4 +- .../target/classes/sqlMapConfig.xml | 5 + .../META-INF/mybatisTest01.kotlin_module | Bin 16 -> 0 bytes mybatis_all/reverse/.idea/.gitignore | 2 + ...m_google_protobuf_protobuf_java_3_11_4.xml | 13 ++ .../libraries/Maven__log4j_log4j_1_2_16.xml | 13 ++ ...ven__mysql_mysql_connector_java_8_0_28.xml | 13 ++ ...generator_mybatis_generator_core_1_3_5.xml | 13 ++ .../Maven__org_slf4j_slf4j_api_1_6_1.xml | 13 ++ .../Maven__org_slf4j_slf4j_log4j12_1_6_1.xml | 13 ++ mybatis_all/reverse/.idea/modules.xml | 8 ++ mybatis_all/reverse/.idea/vcs.xml | 6 + mybatis_all/reverse/pom.xml | 38 ++++++ .../gennerator/GeneratorSqlmap.java | 37 ++++++ .../src/main/resources/generatorConfig.xml | 59 +++++++++ .../src/main/resources/log4j.properties | 11 ++ springboot_all/springboot01/pom.xml | 89 +++++++++++++ .../zhangzeyuan/SpringBoot01Application.java | 18 +++ .../zhangzeyuan/controller/EmpController.java | 27 ++++ .../controller/FreemarkerController.java | 49 +++++++ .../zhangzeyuan/controller/MyController.java | 35 +++++ .../controller/ThymeleafController.java | 20 +++ .../com/zhangzeyuan/mapper/EmpMapper.java | 16 +++ .../com/zhangzeyuan/mapper/UserMapper.java | 17 +++ .../main/java/com/zhangzeyuan/pojo/Emp.java | 30 +++++ .../main/java/com/zhangzeyuan/pojo/User.java | 22 +++ .../com/zhangzeyuan/service/EmpService.java | 16 +++ .../com/zhangzeyuan/service/UserService.java | 14 ++ .../service/impl/EmpServiceImpl.java | 49 +++++++ .../service/impl/UserServiceImpl.java | 29 ++++ .../src/main/resources/application.yml | 54 ++++++++ .../src/main/resources/logback.xml | 56 ++++++++ .../src/main/resources/mybatis/EmpMapper.xml | 11 ++ .../src/main/resources/mybatis/UserMapper.xml | 11 ++ .../src/main/resources/templates/index.html | 12 ++ .../src/main/resources/templates/show.ftlh | 14 ++ .../src/main/resources/templates/showEmp.ftlh | 55 ++++++++ .../main/resources/templates/showEmpMap.ftlh | 49 +++++++ 68 files changed, 1608 insertions(+), 83 deletions(-) delete mode 100644 LICENSE delete mode 100644 README.md create mode 100644 mybatis_all/.idea/libraries/Maven__log4j_log4j_1_2_16.xml create mode 100644 mybatis_all/.idea/libraries/Maven__org_slf4j_slf4j_api_1_6_1.xml create mode 100644 mybatis_all/.idea/libraries/Maven__org_slf4j_slf4j_log4j12_1_6_1.xml create mode 100644 mybatis_all/.idea/vcs.xml delete mode 100644 mybatis_all/mybatisTest01/log/test.log create mode 100644 mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/mapper/EmpMapper3.java create mode 100644 mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/mapper/ProjectMapper.java create mode 100644 mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/pojo/Project.java create mode 100644 mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/pojo/ProjectRecord.java create mode 100644 mybatis_all/mybatisTest01/src/main/resources/com/zhangzeyuan/mapper/EmpMapper2.xml create mode 100644 mybatis_all/mybatisTest01/src/main/resources/com/zhangzeyuan/mapper/EmpMapper3.xml create mode 100644 mybatis_all/mybatisTest01/src/main/resources/com/zhangzeyuan/mapper/ProjectMapper.xml create mode 100644 mybatis_all/mybatisTest01/src/test/java/com/zhangzeyuan/test/TestEmpDynamicSelect.java create mode 100644 mybatis_all/mybatisTest01/src/test/java/com/zhangzeyuan/test/TestEmpMapper3.java create mode 100644 mybatis_all/mybatisTest01/src/test/java/com/zhangzeyuan/test/TestProjectMapper.java delete mode 100644 mybatis_all/mybatisTest01/target/classes/META-INF/mybatisTest01.kotlin_module delete mode 100644 mybatis_all/mybatisTest01/target/test-classes/META-INF/mybatisTest01.kotlin_module create mode 100644 mybatis_all/reverse/.idea/.gitignore create mode 100644 mybatis_all/reverse/.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_11_4.xml create mode 100644 mybatis_all/reverse/.idea/libraries/Maven__log4j_log4j_1_2_16.xml create mode 100644 mybatis_all/reverse/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_28.xml create mode 100644 mybatis_all/reverse/.idea/libraries/Maven__org_mybatis_generator_mybatis_generator_core_1_3_5.xml create mode 100644 mybatis_all/reverse/.idea/libraries/Maven__org_slf4j_slf4j_api_1_6_1.xml create mode 100644 mybatis_all/reverse/.idea/libraries/Maven__org_slf4j_slf4j_log4j12_1_6_1.xml create mode 100644 mybatis_all/reverse/.idea/modules.xml create mode 100644 mybatis_all/reverse/.idea/vcs.xml create mode 100644 mybatis_all/reverse/pom.xml create mode 100644 mybatis_all/reverse/src/main/java/com/zhangzeyuan/gennerator/GeneratorSqlmap.java create mode 100644 mybatis_all/reverse/src/main/resources/generatorConfig.xml create mode 100644 mybatis_all/reverse/src/main/resources/log4j.properties create mode 100644 springboot_all/springboot01/pom.xml create mode 100644 springboot_all/springboot01/src/main/java/com/zhangzeyuan/SpringBoot01Application.java create mode 100644 springboot_all/springboot01/src/main/java/com/zhangzeyuan/controller/EmpController.java create mode 100644 springboot_all/springboot01/src/main/java/com/zhangzeyuan/controller/FreemarkerController.java create mode 100644 springboot_all/springboot01/src/main/java/com/zhangzeyuan/controller/MyController.java create mode 100644 springboot_all/springboot01/src/main/java/com/zhangzeyuan/controller/ThymeleafController.java create mode 100644 springboot_all/springboot01/src/main/java/com/zhangzeyuan/mapper/EmpMapper.java create mode 100644 springboot_all/springboot01/src/main/java/com/zhangzeyuan/mapper/UserMapper.java create mode 100644 springboot_all/springboot01/src/main/java/com/zhangzeyuan/pojo/Emp.java create mode 100644 springboot_all/springboot01/src/main/java/com/zhangzeyuan/pojo/User.java create mode 100644 springboot_all/springboot01/src/main/java/com/zhangzeyuan/service/EmpService.java create mode 100644 springboot_all/springboot01/src/main/java/com/zhangzeyuan/service/UserService.java create mode 100644 springboot_all/springboot01/src/main/java/com/zhangzeyuan/service/impl/EmpServiceImpl.java create mode 100644 springboot_all/springboot01/src/main/java/com/zhangzeyuan/service/impl/UserServiceImpl.java create mode 100644 springboot_all/springboot01/src/main/resources/application.yml create mode 100644 springboot_all/springboot01/src/main/resources/logback.xml create mode 100644 springboot_all/springboot01/src/main/resources/mybatis/EmpMapper.xml create mode 100644 springboot_all/springboot01/src/main/resources/mybatis/UserMapper.xml create mode 100644 springboot_all/springboot01/src/main/resources/templates/index.html create mode 100644 springboot_all/springboot01/src/main/resources/templates/show.ftlh create mode 100644 springboot_all/springboot01/src/main/resources/templates/showEmp.ftlh create mode 100644 springboot_all/springboot01/src/main/resources/templates/showEmpMap.ftlh diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 137069b..0000000 --- a/LICENSE +++ /dev/null @@ -1,73 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - - (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. - - You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - -To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/README.md b/README.md deleted file mode 100644 index ca0f502..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# test_Res - -所有练习 \ No newline at end of file diff --git a/mybatis_all/.idea/compiler.xml b/mybatis_all/.idea/compiler.xml index df268c2..15d0deb 100644 --- a/mybatis_all/.idea/compiler.xml +++ b/mybatis_all/.idea/compiler.xml @@ -8,10 +8,12 @@ + + \ No newline at end of file diff --git a/mybatis_all/.idea/encodings.xml b/mybatis_all/.idea/encodings.xml index c2bae49..6390bd5 100644 --- a/mybatis_all/.idea/encodings.xml +++ b/mybatis_all/.idea/encodings.xml @@ -1,6 +1,7 @@ + \ No newline at end of file diff --git a/mybatis_all/.idea/libraries/Maven__log4j_log4j_1_2_16.xml b/mybatis_all/.idea/libraries/Maven__log4j_log4j_1_2_16.xml new file mode 100644 index 0000000..056b664 --- /dev/null +++ b/mybatis_all/.idea/libraries/Maven__log4j_log4j_1_2_16.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/mybatis_all/.idea/libraries/Maven__org_slf4j_slf4j_api_1_6_1.xml b/mybatis_all/.idea/libraries/Maven__org_slf4j_slf4j_api_1_6_1.xml new file mode 100644 index 0000000..fb6127c --- /dev/null +++ b/mybatis_all/.idea/libraries/Maven__org_slf4j_slf4j_api_1_6_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/mybatis_all/.idea/libraries/Maven__org_slf4j_slf4j_log4j12_1_6_1.xml b/mybatis_all/.idea/libraries/Maven__org_slf4j_slf4j_log4j12_1_6_1.xml new file mode 100644 index 0000000..1cc6743 --- /dev/null +++ b/mybatis_all/.idea/libraries/Maven__org_slf4j_slf4j_log4j12_1_6_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/mybatis_all/.idea/misc.xml b/mybatis_all/.idea/misc.xml index 2340d62..c5c73fd 100644 --- a/mybatis_all/.idea/misc.xml +++ b/mybatis_all/.idea/misc.xml @@ -7,6 +7,7 @@ diff --git a/mybatis_all/.idea/modules.xml b/mybatis_all/.idea/modules.xml index 0fad2be..0ec370b 100644 --- a/mybatis_all/.idea/modules.xml +++ b/mybatis_all/.idea/modules.xml @@ -4,6 +4,7 @@ + \ No newline at end of file diff --git a/mybatis_all/.idea/vcs.xml b/mybatis_all/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/mybatis_all/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/mybatis_all/mybatisTest01/log/test.log b/mybatis_all/mybatisTest01/log/test.log deleted file mode 100644 index 35a445ffc938d838932f276d1886a2cea4de9020..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 98512 zcmeHQTW=dlcIE&BI8KnC5TG*%F!sWxx|%5kSJihupXAAE6%@DY>V7y| zb=eOh#pc7kc+7r&xDMKnSxG7AKS|G$%e-Vir!cnLA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mP*0FYd5ps+GxYWDr0(Xz6F)C-p)Lf%NiqA zGq9Show3$cQ@gjl*HRlHR!MiO&qlaxc0NbW7;Gg6&~}!QTQS4?4SM&C!O;S7By`3G zN5dX_@IUio6v!}uN#l&g@mVjLrW1J67#u03HCCIAz#6M^cH@Dod&Zzjw^Qgm?m}7WY zZ{`@D-jO*5gZn!hg_%u8U7$wN_{*3q9K;*&ZRAejdx zohC}vVg(Fq1t2?B%rW`!Y0v1aXTY$5$tz=sOQ|qU%rRIw8zEQK!rB}ofW*pRqbDIE zNDQ5uWBa6}<`|q_e{^JXDh8YnkV7IQBqn&UEvnWWla8<^B6ccHJ09BzYRxgrp!zte zSd>XwiFwopQoT7QtpVjx+X+CdlL4<1m}Byh(^4roc@+hYHIhk_gZQr#471-_1OrQ&Cch@9D}Xo0NTznaw}%QNq?=|#@J}N zhoJ#+WMYoNumGlSa|}YFG{cdRB9)p;HL86rNbQvs5=WAbUDlr2`kuvP%NQ^6gp z89wbPo%IYDHZXZ*3~?zH#)UhERL(}pRkg5n$0#7NGFS*o1Q8^LuHCVH(kZ1ohD@(N zIfAB;q}N15&c*4+V;e!8J7ybHA14)yGAS!DkJ>=0b;sm2pgd|j z0f==n;8nOgRx@&1Dg_6x-OPS#qYV$MjN$qDHdM-bJM&O3Ym8XUz-rPwn0i@9yCc`` zRqwUYMu=6$-DyN-?qA$x;W2wxwD zgat5Z+^$}K5=LP^0=I%8keJ&Q6TLsIKAU^DYn`)u)N^$&n0ySiZkOQK|9+L`?Db&( zn6l^R^?U63dB?|J2HOv)-28j+_1D=notIg81zygk6M1`@v7-ijaAph;UJo@0-WFw& qBd7)i*n%LO8+0(Xed;5R8{mZfd diff --git a/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/mapper/DeptMapper.java b/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/mapper/DeptMapper.java index 8beba43..61b31b8 100644 --- a/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/mapper/DeptMapper.java +++ b/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/mapper/DeptMapper.java @@ -10,5 +10,5 @@ import java.util.List; * @Version 1.0 */ public interface DeptMapper { - List findEmpByDeptnoAndSal(Integer deptno, Double sal); + List findEmpByDeptnoAndSal(Integer deptno,Double sal); } diff --git a/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/mapper/EmpMapper2.java b/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/mapper/EmpMapper2.java index 2739125..cb61a60 100644 --- a/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/mapper/EmpMapper2.java +++ b/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/mapper/EmpMapper2.java @@ -1,9 +1,20 @@ package com.zhangzeyuan.mapper; +import com.zhangzeyuan.pojo.Emp; + +import java.util.List; + /** * @Author ZZY_1 * @Date 2023/12/27 23:15 * @Version 1.0 */ public interface EmpMapper2 { + List findByCondition(Emp emp); + + List findByCondition2(Emp emp); + int updateEmpByCondtion(Emp emp); + int updateEmpByCondtion2(Emp emp); + List findByEname(String ename); + List findByEmpnoList(List empnos ); } diff --git a/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/mapper/EmpMapper3.java b/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/mapper/EmpMapper3.java new file mode 100644 index 0000000..fd799cd --- /dev/null +++ b/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/mapper/EmpMapper3.java @@ -0,0 +1,18 @@ +package com.zhangzeyuan.mapper; + +import com.zhangzeyuan.pojo.Dept; +import com.zhangzeyuan.pojo.Emp; + +import java.util.List; + +/** + * @Author ZZY_1 + * @Date 2023/12/28 22:58 + * @Version 1.0 + */ +public interface EmpMapper3 { + List listAll(); + List listOneAndMore(); + List findEmpsByDeptno(int deptno); + Dept findDeptByDeptno(int deptno); +} diff --git a/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/mapper/ProjectMapper.java b/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/mapper/ProjectMapper.java new file mode 100644 index 0000000..d4e27eb --- /dev/null +++ b/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/mapper/ProjectMapper.java @@ -0,0 +1,16 @@ +package com.zhangzeyuan.mapper; + +import com.zhangzeyuan.pojo.Dept; +import com.zhangzeyuan.pojo.Project; + +import java.util.List; + +/** + * @Author ZZY_1 + * @Date 2023/12/28 23:40 + * @Version 1.0 + */ +public interface ProjectMapper { + + List listMoreAndMore(int pid); +} diff --git a/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/pojo/Dept.java b/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/pojo/Dept.java index 7e3e7e7..3c76ce7 100644 --- a/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/pojo/Dept.java +++ b/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/pojo/Dept.java @@ -4,6 +4,9 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import java.io.Serializable; +import java.util.List; + /** * @Author ZZY_1 * @Date 2023/12/26 22:14 @@ -12,8 +15,14 @@ import lombok.NoArgsConstructor; @Data @NoArgsConstructor @AllArgsConstructor -public class Dept { +public class Dept implements Serializable { private Integer deptno; private String dname; private String loc; + private List emps; + public Dept(Integer deptno, String dname, String loc) { + this.deptno = deptno; + this.dname = dname; + this.loc = loc; + } } diff --git a/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/pojo/Emp.java b/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/pojo/Emp.java index 0784db2..6a05b10 100644 --- a/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/pojo/Emp.java +++ b/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/pojo/Emp.java @@ -4,6 +4,7 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import java.io.Serializable; import java.util.Date; /** @@ -14,7 +15,7 @@ import java.util.Date; @Data @NoArgsConstructor @AllArgsConstructor -public class Emp { +public class Emp implements Serializable { private Integer empno ; private String ename ; private String job ; @@ -23,5 +24,16 @@ public class Emp { private Double sal ; private Double comm ; private Integer deptno ; + private Dept dept; + public Emp(Integer empno, String ename, String job, Integer mgr, Date hiredate, Double sal, Double comm, Integer deptno) { + this.empno = empno; + this.ename = ename; + this.job = job; + this.mgr = mgr; + this.hiredate = hiredate; + this.sal = sal; + this.comm = comm; + this.deptno = deptno; + } } diff --git a/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/pojo/Project.java b/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/pojo/Project.java new file mode 100644 index 0000000..c361913 --- /dev/null +++ b/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/pojo/Project.java @@ -0,0 +1,23 @@ +package com.zhangzeyuan.pojo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author ZZY_1 + * @Date 2023/12/28 23:36 + * @Version 1.0 + */ +@NoArgsConstructor +@AllArgsConstructor +@Data +public class Project implements Serializable { + private Integer pid; + private String pname; + private Integer money; + private List recordList; +} diff --git a/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/pojo/ProjectRecord.java b/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/pojo/ProjectRecord.java new file mode 100644 index 0000000..c05f668 --- /dev/null +++ b/mybatis_all/mybatisTest01/src/main/java/com/zhangzeyuan/pojo/ProjectRecord.java @@ -0,0 +1,21 @@ +package com.zhangzeyuan.pojo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Author ZZY_1 + * @Date 2023/12/28 23:34 + * @Version 1.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ProjectRecord implements Serializable { + private Integer empno; + private Integer pid; + private Emp emp; +} diff --git a/mybatis_all/mybatisTest01/src/main/resources/com/zhangzeyuan/mapper/EmpMapper2.xml b/mybatis_all/mybatisTest01/src/main/resources/com/zhangzeyuan/mapper/EmpMapper2.xml new file mode 100644 index 0000000..d7646e6 --- /dev/null +++ b/mybatis_all/mybatisTest01/src/main/resources/com/zhangzeyuan/mapper/EmpMapper2.xml @@ -0,0 +1,125 @@ + + + + + emp.EMPNO, + emp.ENAME, + emp.JOB, + emp.MGR, + emp.HIREDATE, + emp.SAL, + emp.COMM, + emp.DEPTNO + + + + update emp + + + , EMPNO =#{empno} + + + , ENAME =#{ename} + + + , job =#{job} + + + , MGR =#{mgr} + + + , HIREDATE =#{hiredate} + + + , SAL =#{sal} + + + , COMM =#{comm} + + + where empno =#{empno}; + + + + update emp + + + , EMPNO =#{empno} + + + , ENAME =#{ename} + + + , job =#{job} + + + , MGR =#{mgr} + + + , HIREDATE =#{hiredate} + + + , SAL =#{sal} + + + , COMM =#{comm} + + + where empno =#{empno}; + + + + + + + + + + + \ No newline at end of file diff --git a/mybatis_all/mybatisTest01/src/main/resources/com/zhangzeyuan/mapper/EmpMapper3.xml b/mybatis_all/mybatisTest01/src/main/resources/com/zhangzeyuan/mapper/EmpMapper3.xml new file mode 100644 index 0000000..06c7b9c --- /dev/null +++ b/mybatis_all/mybatisTest01/src/main/resources/com/zhangzeyuan/mapper/EmpMapper3.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mybatis_all/mybatisTest01/src/main/resources/com/zhangzeyuan/mapper/ProjectMapper.xml b/mybatis_all/mybatisTest01/src/main/resources/com/zhangzeyuan/mapper/ProjectMapper.xml new file mode 100644 index 0000000..0d03a0b --- /dev/null +++ b/mybatis_all/mybatisTest01/src/main/resources/com/zhangzeyuan/mapper/ProjectMapper.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mybatis_all/mybatisTest01/src/main/resources/log4j2.xml b/mybatis_all/mybatisTest01/src/main/resources/log4j2.xml index 322503c..850024a 100644 --- a/mybatis_all/mybatisTest01/src/main/resources/log4j2.xml +++ b/mybatis_all/mybatisTest01/src/main/resources/log4j2.xml @@ -1,5 +1,5 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/mybatis_all/mybatisTest01/src/main/resources/sqlMapConfig.xml b/mybatis_all/mybatisTest01/src/main/resources/sqlMapConfig.xml index b7d63df..78cffd2 100644 --- a/mybatis_all/mybatisTest01/src/main/resources/sqlMapConfig.xml +++ b/mybatis_all/mybatisTest01/src/main/resources/sqlMapConfig.xml @@ -7,6 +7,11 @@ + + + + + diff --git a/mybatis_all/mybatisTest01/src/test/java/com/zhangzeyuan/test/TestEmpDynamicSelect.java b/mybatis_all/mybatisTest01/src/test/java/com/zhangzeyuan/test/TestEmpDynamicSelect.java new file mode 100644 index 0000000..ada130e --- /dev/null +++ b/mybatis_all/mybatisTest01/src/test/java/com/zhangzeyuan/test/TestEmpDynamicSelect.java @@ -0,0 +1,99 @@ +package com.zhangzeyuan.test; + +import com.zhangzeyuan.mapper.EmpCurdMapper; +import com.zhangzeyuan.mapper.EmpMapper2; +import com.zhangzeyuan.pojo.Emp; +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.After; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; +import java.io.InputStream; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * @Author ZZY_1 + * @Date 2023/12/26 22:16 + * @Version 1.0 + */ +public class TestEmpDynamicSelect { + SqlSession sqlSession ; + //在之前运行 + @Before + public void init() { + SqlSessionFactoryBuilder ssfb = new SqlSessionFactoryBuilder(); + InputStream resourceAsStream = null; + try { + resourceAsStream = Resources.getResourceAsStream("sqlMapConfig.xml"); + } catch (IOException e) { + e.printStackTrace(); + } + SqlSessionFactory factory = ssfb.build(resourceAsStream); + sqlSession = factory.openSession(); + + } + + @Test + public void dynamic() throws ParseException { + EmpMapper2 mapper = sqlSession.getMapper(EmpMapper2.class); + Date parse = new SimpleDateFormat("yyyy-MM-dd").parse("2023-12-27"); + Emp emp =new Emp(null,"按住啦Baby","SALESMAN",7839,parse,3100.0, 200.0,10 ); + // List emps = mapper.findByCondition( emp); + List emps = mapper.findByCondition2( emp); + sqlSession.commit(); + System.out.println(emps); + + } + + @Test + public void testSetTrim() throws ParseException { + EmpMapper2 mapper = sqlSession.getMapper(EmpMapper2.class); + // Date parse = new SimpleDateFormat("yyyy-MM-dd").parse("2023-12-27"); + Emp emp =new Emp( ); + emp.setEmpno(2); + emp.setEname("小凤仙"); + emp.setJob("CLERK"); + // List emps = mapper.findByCondition( emp); + int i= mapper.updateEmpByCondtion2( emp); + sqlSession.commit(); + System.out.println(i); + + } + + @Test + public void testBind() throws ParseException { + EmpMapper2 mapper = sqlSession.getMapper(EmpMapper2.class); + // Date parse = new SimpleDateFormat("yyyy-MM-dd").parse("2023-12-27"); + // List emps = mapper.findByCondition( emp); + List emps= mapper.findByEname( "凤仙"); + sqlSession.commit(); + System.out.println(emps); + + } + @Test + public void testForeach() throws ParseException { + EmpMapper2 mapper = sqlSession.getMapper(EmpMapper2.class); + // Date parse = new SimpleDateFormat("yyyy-MM-dd").parse("2023-12-27"); + // List emps = mapper.findByCondition( emp); + ArrayList integers = new ArrayList(); + integers.add(1); + integers.add(2); + integers.add(3); + integers.add(4); + List emps= mapper.findByEmpnoList(integers); + sqlSession.commit(); + System.out.println(emps); + + } + @After + public void close() { + sqlSession.close(); + + } +} diff --git a/mybatis_all/mybatisTest01/src/test/java/com/zhangzeyuan/test/TestEmpMapper3.java b/mybatis_all/mybatisTest01/src/test/java/com/zhangzeyuan/test/TestEmpMapper3.java new file mode 100644 index 0000000..05713a9 --- /dev/null +++ b/mybatis_all/mybatisTest01/src/test/java/com/zhangzeyuan/test/TestEmpMapper3.java @@ -0,0 +1,98 @@ +package com.zhangzeyuan.test; + +import com.zhangzeyuan.mapper.DeptMapper; +import com.zhangzeyuan.mapper.EmpMapper3; +import com.zhangzeyuan.pojo.Dept; +import com.zhangzeyuan.pojo.Emp; +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.After; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * @Author ZZY_1 + * @Date 2023/12/26 22:16 + * @Version 1.0 + * + * 测试一对一,一对多,多对多 + */ +public class TestEmpMapper3 { + SqlSession sqlSession ; + //在之前运行 + @Before + public void init() { + SqlSessionFactoryBuilder ssfb = new SqlSessionFactoryBuilder(); + InputStream resourceAsStream = null; + try { + resourceAsStream = Resources.getResourceAsStream("sqlMapConfig.xml"); + } catch (IOException e) { + e.printStackTrace(); + } + SqlSessionFactory factory = ssfb.build(resourceAsStream); + sqlSession = factory.openSession(); + + } + + @Test + public void findAll() { + EmpMapper3 mapper = sqlSession.getMapper(EmpMapper3.class); + List emps = mapper.listAll(); + sqlSession.commit(); + emps.forEach(emp -> { + System.out.println(emp); + }); + + } + + + @Test + public void findOneAndMore() { + EmpMapper3 mapper = sqlSession.getMapper(EmpMapper3.class); + List emps = mapper.listOneAndMore(); + sqlSession.commit(); + emps.forEach(dept -> { + System.out.println(dept); + }); + + + + } + + /** + * 测试级联查询 + */ + @Test + public void testJoinSelect() { + EmpMapper3 mapper = sqlSession.getMapper(EmpMapper3.class); + Dept deptByDeptno = mapper.findDeptByDeptno(30); + /* System.out.println(deptByDeptno.getDeptno()); + System.out.println(deptByDeptno.getDname()); + System.out.println(deptByDeptno.getLoc());*/ + // System.out.println(deptByDeptno); + //lazy延迟加载只有在有get的情况下才会查询 + //sqlSession.commit(); + // System.out.println(deptByDeptno.getEmps()); + } + @Test + public void testArgs() { + } + //测试对象作为参数 + @Test + public void testObjArgs() { + } + @After + public void close() { + sqlSession.close(); + + } +} diff --git a/mybatis_all/mybatisTest01/src/test/java/com/zhangzeyuan/test/TestProjectMapper.java b/mybatis_all/mybatisTest01/src/test/java/com/zhangzeyuan/test/TestProjectMapper.java new file mode 100644 index 0000000..2fe59c1 --- /dev/null +++ b/mybatis_all/mybatisTest01/src/test/java/com/zhangzeyuan/test/TestProjectMapper.java @@ -0,0 +1,86 @@ +package com.zhangzeyuan.test; + +import com.zhangzeyuan.mapper.EmpMapper3; +import com.zhangzeyuan.mapper.ProjectMapper; +import com.zhangzeyuan.pojo.Dept; +import com.zhangzeyuan.pojo.Emp; +import com.zhangzeyuan.pojo.Project; +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.After; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; + +/** + * @Author ZZY_1 + * @Date 2023/12/26 22:16 + * @Version 1.0 + * + * 测试一对一,一对多,多对多 + */ +public class TestProjectMapper { + SqlSession sqlSession ; + //在之前运行 + @Before + public void init() { + SqlSessionFactoryBuilder ssfb = new SqlSessionFactoryBuilder(); + InputStream resourceAsStream = null; + try { + resourceAsStream = Resources.getResourceAsStream("sqlMapConfig.xml"); + } catch (IOException e) { + e.printStackTrace(); + } + SqlSessionFactory factory = ssfb.build(resourceAsStream); + sqlSession = factory.openSession(); + + } + + @Test + public void findAll() { + ProjectMapper mapper = sqlSession.getMapper(ProjectMapper.class); + List projects = mapper.listMoreAndMore(1); + //sqlSession.commit(); + for (Project project : projects) { + System.out.println(project); + } + } + + + + @Test + public void findOneAndMore() { + + + } + + /** + * mybatis参数传递的三种方式 + * 1 单个基础数据类型作为参数 + * 2 多个基础数据类型的map 集合作为参数 + * 3 引用类型作为参数 + */ + @Test + public void testSingleArg() { + } + @Test + public void testMapArgs() { + } + @Test + public void testArgs() { + } + //测试对象作为参数 + @Test + public void testObjArgs() { + } + @After + public void close() { + sqlSession.close(); + + } +} diff --git a/mybatis_all/mybatisTest01/target/classes/META-INF/mybatisTest01.kotlin_module b/mybatis_all/mybatisTest01/target/classes/META-INF/mybatisTest01.kotlin_module deleted file mode 100644 index a49347afef10a9b5f95305e1058ba36adec7d6dd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16 RcmZQzU|?ooU|@t|0RRA102TlM diff --git a/mybatis_all/mybatisTest01/target/classes/com/zhangzeyuan/pojo/Dept.class b/mybatis_all/mybatisTest01/target/classes/com/zhangzeyuan/pojo/Dept.class index a079b6d944dabe017022bfff5ca7a3bddf6315ae..e8781043085122037a5e5f88b001498714c9bdfb 100644 GIT binary patch literal 3542 zcmb_e?{8CO6n<`df3>@?-(wx91Ey|WOBE5N+Yo^P!wrz(6z~Uk-DT_O+S0Wo5aUPV zClf!JnD|u^!v`g9B$^ogf{A~Vh|jt2ZF|>s=m(SSz2~0yIqx~=Ip;mMfByaRuK!k7fD9!i_ket}Kg!%89fjizmxX(Jfn8iDNge+sMmvRhC;e3O3ek z6m675QMPc~LPdkQAv0%1r~rEdXfr+m4iFV$ z@@~1#W~LSX%*cJ8-tC%OAQfAJy12ON<*E~7*EDG4Jlu%E7Q3`mUGdn=9a6!OdPh6H zw(%NQn=0>)U{Af-{+8d(F}0y&U#;3ZuJr0<*L>B@-I{aDe&_I7@-~syoLiih6ezB^ z>np1HqN8IojPTOsnYn4EK-sK#>$O6a#c#xBjs*8iAMrgKBg&CoEvcgLvW*Hy=fm}? zcU-6mcf1Y?v$b|N|EI(LwX*T~QmvBn&gA9p#pL=Nl40ZEAQl`9VXuRIc+SD|vb=y{ z4T-kXK`b4-gGmQTj60YRDTTCyL$YM>ii26qY1q@8Wr~rLwR~YoTEvkvMpcVUIamh| zTt|&1OAY%qm|}ra!>j@YD>W>2prnmCcn@igx#r2L{WSFXs(dLk?{S_K^7qt?G2L?6 zD=ukBhiR_gv28UABIJnKg0Hv#j(F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{!;2SM;E*>xOn)mWuh$12)(Tj*q!Ix6;>w;GY1GLX`l;cpN`Z<8T zKx+k)3A{*O0tmn$lY>4Lq&*!RIUU^HHkit{367o)PPPqx1+Rv|c^)ewJkyy&s9)$s z(B$m~(R~^b@|H7+AadN-Fx)OrBImXjG%%p#U zX&hw!g7G8F=t1UB7z?B6BbdREj%c^_gFSstSo-(!re65%Z? zvA?p6O{0L<>G6*Wvv`A^i3PlmtMn|CiGGuwjT$?1oSuWXxMv2g?fi=_8*e{BpN)6; zbJP=D(r&EPWolk@ts-x>3TkhPe8T>`=4dpvwD%bIm16K&&}q~d<19wsO-xK0Q-S0I ziHRZwcM_R>*x4h*zmj<;Z^%N*2v-~_gI1 zlT#tgYJoM8r)LQ!O}>6wJKQH#MKa^RqvPHqxXI2VbcuvVxR6X}pB>hf?ACrv{3Oj0 zE}ni2^mW$H(0C|~lJ_~>tNDgKLeJ^D*V*EDN;GBB^ diff --git a/mybatis_all/mybatisTest01/target/classes/com/zhangzeyuan/pojo/Emp.class b/mybatis_all/mybatisTest01/target/classes/com/zhangzeyuan/pojo/Emp.class index e7c688d3a0e6295ac8f34d489e92418b8127bb67..c4b6d301122a4a81c74156f1afb49fc65dbfa688 100644 GIT binary patch literal 5837 zcmc&&-E$jP75}ZY+FeO&Tb67mo3Fa9(%Q0JLn*{;l0urKX+oTax&&HisbZ_P5?OL> zxzJE3&;q4=w1q-Tf%2X35opU`cYqE950n|6c*qmHz#qU1!wka=CH&64yV6?OIA(?! zCYigxz2|q1?z!h<@AdEh{fl1#xCuYa;CeisMi!rz;RzW&Bg1E9_?!%%m*Ghno|55d z8(+xq`9&F?5%n(#`mzkq%J7^FUy_<@5TI{1;u&)fL1jh`4uRpuA!4FiRvr^*kO$7|*K?D*k&voc#* z+%3|2dA?#GACXQq7pwJI3X`WACppf~E*fy=s*9DGa+BPg<}Np@webU-5$004w${jj z#`4LUh|KB6{Ja5crn1nKb(jJSY(2{P@iTK=&Y8+X%jNp`LgQ3p`~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t93Q1a8uJ((D;?Ij zAe=X7%#+hAy;0*K!Ee%-hox5<*LYa)jl?@RGI;UPR~LOpZH7H;$Ug>Qp4|)XE4XR! z`&Wp)HFfZbP<(}xOmmV)D-^4nQ)PM^iOS42k`>R~hFS5fZC;+e)HbhHp1lpb;yK&6 z=1W^tzx0rfwtEmA4R2Wd1$CR3bL^=6f5n|3NbV`7LUPlv6q36_N+J2$+X~6|+F{P0 J - + @@ -16,7 +16,7 @@ - + diff --git a/mybatis_all/mybatisTest01/target/classes/sqlMapConfig.xml b/mybatis_all/mybatisTest01/target/classes/sqlMapConfig.xml index b7d63df..78cffd2 100644 --- a/mybatis_all/mybatisTest01/target/classes/sqlMapConfig.xml +++ b/mybatis_all/mybatisTest01/target/classes/sqlMapConfig.xml @@ -7,6 +7,11 @@ + + + + + diff --git a/mybatis_all/mybatisTest01/target/test-classes/META-INF/mybatisTest01.kotlin_module b/mybatis_all/mybatisTest01/target/test-classes/META-INF/mybatisTest01.kotlin_module deleted file mode 100644 index a49347afef10a9b5f95305e1058ba36adec7d6dd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16 RcmZQzU|?ooU|@t|0RRA102TlM diff --git a/mybatis_all/reverse/.idea/.gitignore b/mybatis_all/reverse/.idea/.gitignore new file mode 100644 index 0000000..5c98b42 --- /dev/null +++ b/mybatis_all/reverse/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/mybatis_all/reverse/.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_11_4.xml b/mybatis_all/reverse/.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_11_4.xml new file mode 100644 index 0000000..cf24073 --- /dev/null +++ b/mybatis_all/reverse/.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_11_4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/mybatis_all/reverse/.idea/libraries/Maven__log4j_log4j_1_2_16.xml b/mybatis_all/reverse/.idea/libraries/Maven__log4j_log4j_1_2_16.xml new file mode 100644 index 0000000..056b664 --- /dev/null +++ b/mybatis_all/reverse/.idea/libraries/Maven__log4j_log4j_1_2_16.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/mybatis_all/reverse/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_28.xml b/mybatis_all/reverse/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_28.xml new file mode 100644 index 0000000..b427b86 --- /dev/null +++ b/mybatis_all/reverse/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_28.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/mybatis_all/reverse/.idea/libraries/Maven__org_mybatis_generator_mybatis_generator_core_1_3_5.xml b/mybatis_all/reverse/.idea/libraries/Maven__org_mybatis_generator_mybatis_generator_core_1_3_5.xml new file mode 100644 index 0000000..7c572d4 --- /dev/null +++ b/mybatis_all/reverse/.idea/libraries/Maven__org_mybatis_generator_mybatis_generator_core_1_3_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/mybatis_all/reverse/.idea/libraries/Maven__org_slf4j_slf4j_api_1_6_1.xml b/mybatis_all/reverse/.idea/libraries/Maven__org_slf4j_slf4j_api_1_6_1.xml new file mode 100644 index 0000000..fb6127c --- /dev/null +++ b/mybatis_all/reverse/.idea/libraries/Maven__org_slf4j_slf4j_api_1_6_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/mybatis_all/reverse/.idea/libraries/Maven__org_slf4j_slf4j_log4j12_1_6_1.xml b/mybatis_all/reverse/.idea/libraries/Maven__org_slf4j_slf4j_log4j12_1_6_1.xml new file mode 100644 index 0000000..1cc6743 --- /dev/null +++ b/mybatis_all/reverse/.idea/libraries/Maven__org_slf4j_slf4j_log4j12_1_6_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/mybatis_all/reverse/.idea/modules.xml b/mybatis_all/reverse/.idea/modules.xml new file mode 100644 index 0000000..f07066d --- /dev/null +++ b/mybatis_all/reverse/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/mybatis_all/reverse/.idea/vcs.xml b/mybatis_all/reverse/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/mybatis_all/reverse/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/mybatis_all/reverse/pom.xml b/mybatis_all/reverse/pom.xml new file mode 100644 index 0000000..8811aa0 --- /dev/null +++ b/mybatis_all/reverse/pom.xml @@ -0,0 +1,38 @@ + + + 4.0.0 + + org.zhangzeyuan + reverse + 1.0-SNAPSHOT + + + + + + mysql + mysql-connector-java + 8.0.28 + + + + + org.slf4j + slf4j-log4j12 + 1.6.1 + + + + + + org.mybatis.generator + mybatis-generator-core + 1.3.5 + + + + + + \ No newline at end of file diff --git a/mybatis_all/reverse/src/main/java/com/zhangzeyuan/gennerator/GeneratorSqlmap.java b/mybatis_all/reverse/src/main/java/com/zhangzeyuan/gennerator/GeneratorSqlmap.java new file mode 100644 index 0000000..bb23fd4 --- /dev/null +++ b/mybatis_all/reverse/src/main/java/com/zhangzeyuan/gennerator/GeneratorSqlmap.java @@ -0,0 +1,37 @@ +package com.zhangzeyuan.gennerator; +import org.mybatis.generator.api.MyBatisGenerator; +import org.mybatis.generator.config.Configuration; +import org.mybatis.generator.config.xml.ConfigurationParser; +import org.mybatis.generator.internal.DefaultShellCallback; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +/** + * @Author ZZY_1 + * @Date 2023/12/29 15:16 + * @Version 1.0 + */ +public class GeneratorSqlmap { + public void generator() throws Exception{ + List warnings = new ArrayList(); + boolean overwrite = true; + + File configFile = new File("D:\\ideaWork\\test_Res\\mybatis_all\\reverse\\target\\classes\\generatorConfig.xml"); + ConfigurationParser cp = new ConfigurationParser(warnings); + Configuration config = cp.parseConfiguration(configFile); + DefaultShellCallback callback = new DefaultShellCallback(overwrite); + MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, + callback, warnings); + myBatisGenerator.generate(null); + + } + public static void main(String[] args) throws Exception { + try { + GeneratorSqlmap generatorSqlmap = new GeneratorSqlmap(); + generatorSqlmap.generator(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/mybatis_all/reverse/src/main/resources/generatorConfig.xml b/mybatis_all/reverse/src/main/resources/generatorConfig.xml new file mode 100644 index 0000000..81c7828 --- /dev/null +++ b/mybatis_all/reverse/src/main/resources/generatorConfig.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
\ No newline at end of file diff --git a/mybatis_all/reverse/src/main/resources/log4j.properties b/mybatis_all/reverse/src/main/resources/log4j.properties new file mode 100644 index 0000000..d72505d --- /dev/null +++ b/mybatis_all/reverse/src/main/resources/log4j.properties @@ -0,0 +1,11 @@ +log4j.rootLogger=debug,stdout +log4j.appender.file.encoding=UTF-8 + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.err +log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout + +log4j.appender.logfile=org.apache.log4j.FileAppender +log4j.appender.logfile.File=D:/ideaWork/test_Res/mybatis_all/reverse/log/log4j.log +log4j.appender.logfile.layout=org.apache.log4j.PatternLayout +log4j.appender.logfile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %l %F %p %m%n \ No newline at end of file diff --git a/springboot_all/springboot01/pom.xml b/springboot_all/springboot01/pom.xml new file mode 100644 index 0000000..d4f4eb1 --- /dev/null +++ b/springboot_all/springboot01/pom.xml @@ -0,0 +1,89 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.4.2 + + org.zhangzeyuan + springboot01 + 1.0-SNAPSHOT + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.1.3 + + + mysql + mysql-connector-java + 8.0.28 + + + org.projectlombok + lombok + 1.18.12 + provided + + + com.github.pagehelper + pagehelper-spring-boot-starter + 1.2.12 + + + mybatis-spring-boot-starter + org.mybatis.spring.boot + + + + + + com.alibaba + druid-spring-boot-starter + 1.1.10 + + + + + + org.attoparser + attoparser + 2.0.5.RELEASE + + + + + org.springframework.boot + spring-boot-starter-thymeleaf + 2.4.5 + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/springboot_all/springboot01/src/main/java/com/zhangzeyuan/SpringBoot01Application.java b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/SpringBoot01Application.java new file mode 100644 index 0000000..3e4d4c5 --- /dev/null +++ b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/SpringBoot01Application.java @@ -0,0 +1,18 @@ +package com.zhangzeyuan; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.stereotype.Component; + +/** + * @Author ZZY_1 + * @Date 2023/12/29 16:36 + * @Version 1.0 + */ +@SpringBootApplication +//@Component("com.zhangzeyuan.mapper") +public class SpringBoot01Application { + public static void main(String[] args) { + SpringApplication.run(SpringBoot01Application.class, args); + } +} diff --git a/springboot_all/springboot01/src/main/java/com/zhangzeyuan/controller/EmpController.java b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/controller/EmpController.java new file mode 100644 index 0000000..bbeafe0 --- /dev/null +++ b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/controller/EmpController.java @@ -0,0 +1,27 @@ +package com.zhangzeyuan.controller; + +import com.github.pagehelper.PageInfo; +import com.zhangzeyuan.pojo.Emp; +import com.zhangzeyuan.service.EmpService; +import org.springframework.stereotype.Controller; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import java.util.List; +/** + * @Author ZZY_1 + * @Date 2023/12/30 12:07 + * @Version 1.0 + */ +@Controller("/emp") +public class EmpController { + @Autowired + private EmpService empService; + @RequestMapping("/findByPage/{pageNum}/{pageSize}") + @ResponseBody + public PageInfo findByPage(@PathVariable("pageNum") Integer pageNum, @PathVariable("pageSize") Integer pageSize){ + return empService.findByPage(pageNum,pageSize); + } +} diff --git a/springboot_all/springboot01/src/main/java/com/zhangzeyuan/controller/FreemarkerController.java b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/controller/FreemarkerController.java new file mode 100644 index 0000000..feddeaa --- /dev/null +++ b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/controller/FreemarkerController.java @@ -0,0 +1,49 @@ +package com.zhangzeyuan.controller; + +import com.zhangzeyuan.pojo.Emp; +import com.zhangzeyuan.service.EmpService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Author ZZY_1 + * @Date 2023/12/30 17:37 + * @Version 1.0 + */ +@Controller +public class FreemarkerController { + @Autowired + private EmpService empService; + + @RequestMapping("/show") + public String freemarger(Map map) { + map.put("name", "漩涡刘能"); + return "show"; + } + @RequestMapping("/showEmp") + public ModelAndView showEmp(Map map) { + ModelAndView mv = new ModelAndView(); + List list = empService.findAll(); + mv.addObject("empList", list); + mv.setViewName("showEmp"); + return mv; + } + @RequestMapping("/showEmpMap") + public ModelAndView testMap(){ + ModelAndView mv =new ModelAndView(); + List list =empService.findAll(); + Map empMap =new HashMap<>(); + for (Emp emp : list) { + empMap.put(emp.getEmpno().toString(), emp); + } + mv.addObject("empMap", empMap); + mv.setViewName("showEmpMap"); + return mv; + } +} diff --git a/springboot_all/springboot01/src/main/java/com/zhangzeyuan/controller/MyController.java b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/controller/MyController.java new file mode 100644 index 0000000..f36319d --- /dev/null +++ b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/controller/MyController.java @@ -0,0 +1,35 @@ +package com.zhangzeyuan.controller; + +import com.zhangzeyuan.pojo.User; +import com.zhangzeyuan.service.UserService; +import com.zhangzeyuan.service.impl.UserServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; + +/** + * @Author ZZY_1 + * @Date 2023/12/29 16:36 + * @Version 1.0 + */ +@Controller("/user") +public class MyController { + @Autowired + private UserService userService; + @RequestMapping("/secondController") + @ResponseBody + public String secondController() { + return "hello springboot01"; + } + + @RequestMapping("findAll") + @ResponseBody + public List findAll() { + List all = userService.findAll(); + return all; + } + +} diff --git a/springboot_all/springboot01/src/main/java/com/zhangzeyuan/controller/ThymeleafController.java b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/controller/ThymeleafController.java new file mode 100644 index 0000000..461b6b6 --- /dev/null +++ b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/controller/ThymeleafController.java @@ -0,0 +1,20 @@ +package com.zhangzeyuan.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +import java.util.Map; + +/** + * @Author ZZY_1 + * @Date 2023/12/30 19:19 + * @Version 1.0 + */ +@Controller +public class ThymeleafController { + @RequestMapping("/showIndex") + public String showIndex(Map map) { + map.put("msg", "testMessage"); + return "index"; + } +} diff --git a/springboot_all/springboot01/src/main/java/com/zhangzeyuan/mapper/EmpMapper.java b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/mapper/EmpMapper.java new file mode 100644 index 0000000..a1524e8 --- /dev/null +++ b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/mapper/EmpMapper.java @@ -0,0 +1,16 @@ +package com.zhangzeyuan.mapper; + +import com.zhangzeyuan.pojo.Emp; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @Author ZZY_1 + * @Date 2023/12/30 12:09 + * @Version 1.0 + */ +@Mapper +public interface EmpMapper { + List findAll(); +} diff --git a/springboot_all/springboot01/src/main/java/com/zhangzeyuan/mapper/UserMapper.java b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/mapper/UserMapper.java new file mode 100644 index 0000000..b8f563f --- /dev/null +++ b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/mapper/UserMapper.java @@ -0,0 +1,17 @@ +package com.zhangzeyuan.mapper; + +import com.zhangzeyuan.pojo.User; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @Author ZZY_1 + * @Date 2023/12/30 11:26 + * @Version 1.0 + */ +@Mapper +public interface UserMapper { + + List findAll(); +} diff --git a/springboot_all/springboot01/src/main/java/com/zhangzeyuan/pojo/Emp.java b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/pojo/Emp.java new file mode 100644 index 0000000..52e683f --- /dev/null +++ b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/pojo/Emp.java @@ -0,0 +1,30 @@ +package com.zhangzeyuan.pojo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; +@NoArgsConstructor +@AllArgsConstructor +@Data +public class Emp implements Serializable { + private Integer empno; + + private String ename; + + private String job; + + private Integer mgr; + + private Date hiredate; + + private Double sal; + + private Double comm; + + private Integer deptno; + + +} \ No newline at end of file diff --git a/springboot_all/springboot01/src/main/java/com/zhangzeyuan/pojo/User.java b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/pojo/User.java new file mode 100644 index 0000000..d7b58d9 --- /dev/null +++ b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/pojo/User.java @@ -0,0 +1,22 @@ +package com.zhangzeyuan.pojo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Author ZZY_1 + * @Date 2023/12/30 11:25 + * @Version 1.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class User implements Serializable { + private Integer uid; + private String username; + private String password; + +} diff --git a/springboot_all/springboot01/src/main/java/com/zhangzeyuan/service/EmpService.java b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/service/EmpService.java new file mode 100644 index 0000000..f5f5c76 --- /dev/null +++ b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/service/EmpService.java @@ -0,0 +1,16 @@ +package com.zhangzeyuan.service; + +import com.github.pagehelper.PageInfo; +import com.zhangzeyuan.pojo.Emp; + +import java.util.List; + +/** + * @Author ZZY_1 + * @Date 2023/12/30 12:08 + * @Version 1.0 + */ +public interface EmpService { + PageInfo findByPage(Integer pageNum, Integer pageSize); + List findAll(); +} diff --git a/springboot_all/springboot01/src/main/java/com/zhangzeyuan/service/UserService.java b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/service/UserService.java new file mode 100644 index 0000000..cba143f --- /dev/null +++ b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/service/UserService.java @@ -0,0 +1,14 @@ +package com.zhangzeyuan.service; + +import com.zhangzeyuan.pojo.User; + +import java.util.List; + +/** + * @Author ZZY_1 + * @Date 2023/12/30 11:26 + * @Version 1.0 + */ +public interface UserService { + List findAll(); +} diff --git a/springboot_all/springboot01/src/main/java/com/zhangzeyuan/service/impl/EmpServiceImpl.java b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/service/impl/EmpServiceImpl.java new file mode 100644 index 0000000..a15da29 --- /dev/null +++ b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/service/impl/EmpServiceImpl.java @@ -0,0 +1,49 @@ +package com.zhangzeyuan.service.impl; + +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.zhangzeyuan.mapper.EmpMapper; +import com.zhangzeyuan.pojo.Emp; +import com.zhangzeyuan.service.EmpService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Author ZZY_1 + * @Date 2023/12/30 12:08 + * @Version 1.0 + */ +@Service +public class EmpServiceImpl implements EmpService { + @Autowired + EmpMapper empMapper; + @Override + public PageInfo findByPage(Integer pageNum, Integer pageSize) { + Page page = PageHelper.startPage(pageNum, pageSize); + List list =empMapper.findAll(); + PageInfo pi = new PageInfo<>(list); + // 方式1 + System.out.println("当前页:"+page.getPageNum()); + System.out.println("总页数"+page.getPages()); + System.out.println("页大小:"+page.getPageSize()); + System.out.println("总记录数:"+page.getTotal()); + System.out.println("当前页数据"+page.getResult()); + + // 方式2 + System.out.println("当前页:"+pi.getPageNum()); + System.out.println("总页数"+pi.getPages()); + System.out.println("页大小:"+pi.getPageSize()); + System.out.println("总记录数:"+pi.getTotal()); + System.out.println("当前页数据"+pi); + return pi; + } + + @Override + public List findAll() { + List list =empMapper.findAll(); + return list; + } +} diff --git a/springboot_all/springboot01/src/main/java/com/zhangzeyuan/service/impl/UserServiceImpl.java b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..5d351ce --- /dev/null +++ b/springboot_all/springboot01/src/main/java/com/zhangzeyuan/service/impl/UserServiceImpl.java @@ -0,0 +1,29 @@ +package com.zhangzeyuan.service.impl; + +import com.zhangzeyuan.mapper.UserMapper; +import com.zhangzeyuan.pojo.User; +import com.zhangzeyuan.service.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * @Author ZZY_1 + * @Date 2023/12/30 11:27 + * @Version 1.0 + */ +@Service +@Transactional +public class UserServiceImpl implements UserService { + @Autowired + private UserMapper userMapper; + + + @Override + public List findAll() { + List users= userMapper.findAll(); + return users; + } +} diff --git a/springboot_all/springboot01/src/main/resources/application.yml b/springboot_all/springboot01/src/main/resources/application.yml new file mode 100644 index 0000000..a9c5a44 --- /dev/null +++ b/springboot_all/springboot01/src/main/resources/application.yml @@ -0,0 +1,54 @@ +server: + port: 8081 + servlet: + context-path: /springboot01 +spring: + datasource: + url: jdbc:mysql://192.168.56.99:3306/mydb?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai + driver-class-name: com.mysql.cj.jdbc.Driver + username: root + password: root +mybatis: + mapper-locations: classpath:mybatis/*.xml + type-aliases-package: com.zhangzeyuan.pojo +druid: + # 连接池的配置信息 + # 初始化大小,最小,最大 + initial-size: 5 + min-idle: 5 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + validationQuery: SELECT 1 + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + # 打开PSCache,并且指定每个连接上PSCache的大小 + poolPreparedStatements: true + maxPoolPreparedStatementPerConnectionSize: 20 + # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 + filters: stat,wall,slf4j + # 通过connectProperties属性来打开mergeSql功能;慢SQL记录 + connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 + # 配置DruidStatFilter + web-stat-filter: + enabled: true + url-pattern: "/*" + exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*" + # 配置DruidStatViewServlet + stat-view-servlet: + url-pattern: "/druid/*" + # IP白名单(没有配置或者为空,则允许所有访问) + allow: 127.0.0.1,192.168.56.99 + # IP黑名单 (存在共同时,deny优先于allow) + deny: 192.168.1.188 + # 禁用HTML页面上的“Reset All”功能 + reset-enable: false + # 登录名 + login-username: admin + # 登录密码 + login-password: 123456 \ No newline at end of file diff --git a/springboot_all/springboot01/src/main/resources/logback.xml b/springboot_all/springboot01/src/main/resources/logback.xml new file mode 100644 index 0000000..4348d37 --- /dev/null +++ b/springboot_all/springboot01/src/main/resources/logback.xml @@ -0,0 +1,56 @@ + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + + + + + + + + ${LOG_HOME}/server.%d{yyyy-MM-dd}.log + 30 + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + + + + + 10MB + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/springboot_all/springboot01/src/main/resources/mybatis/EmpMapper.xml b/springboot_all/springboot01/src/main/resources/mybatis/EmpMapper.xml new file mode 100644 index 0000000..0f85777 --- /dev/null +++ b/springboot_all/springboot01/src/main/resources/mybatis/EmpMapper.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/springboot_all/springboot01/src/main/resources/mybatis/UserMapper.xml b/springboot_all/springboot01/src/main/resources/mybatis/UserMapper.xml new file mode 100644 index 0000000..0a9341e --- /dev/null +++ b/springboot_all/springboot01/src/main/resources/mybatis/UserMapper.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/springboot_all/springboot01/src/main/resources/templates/index.html b/springboot_all/springboot01/src/main/resources/templates/index.html new file mode 100644 index 0000000..6513172 --- /dev/null +++ b/springboot_all/springboot01/src/main/resources/templates/index.html @@ -0,0 +1,12 @@ + + + + + Title + + + this is first thymeleaf! + + + + \ No newline at end of file diff --git a/springboot_all/springboot01/src/main/resources/templates/show.ftlh b/springboot_all/springboot01/src/main/resources/templates/show.ftlh new file mode 100644 index 0000000..ec86004 --- /dev/null +++ b/springboot_all/springboot01/src/main/resources/templates/show.ftlh @@ -0,0 +1,14 @@ + + + + + Title + + +this is first freemakerPage +
+${name} +${name} +
+ + \ No newline at end of file diff --git a/springboot_all/springboot01/src/main/resources/templates/showEmp.ftlh b/springboot_all/springboot01/src/main/resources/templates/showEmp.ftlh new file mode 100644 index 0000000..8a73454 --- /dev/null +++ b/springboot_all/springboot01/src/main/resources/templates/showEmp.ftlh @@ -0,0 +1,55 @@ + + + + + Title + + + + + + + + + + + + + + + + + + + <#if empList??> + <#list empList as emp> + style="background-color:deepskyblue" > + + + + + + + + + + + + + + + +
索引工号姓名岗位上级入职日期入职时间入职日期时间入职日期串薪资补助部门号
${emp_index}${emp.empno}style="color:blue" >${emp.ename}${emp.job}${emp.mgr!'无'}${emp.hiredate?date}${emp.hiredate?time}${emp.hiredate?datetime}${emp.hiredate?string('yyyy-MM')}style="color:green" >${emp.sal}${emp.comm!0}${emp.deptno}
+ + + \ No newline at end of file diff --git a/springboot_all/springboot01/src/main/resources/templates/showEmpMap.ftlh b/springboot_all/springboot01/src/main/resources/templates/showEmpMap.ftlh new file mode 100644 index 0000000..b9c78ab --- /dev/null +++ b/springboot_all/springboot01/src/main/resources/templates/showEmpMap.ftlh @@ -0,0 +1,49 @@ + + + + + Title + + + +输出7521员工信息:
+工号:${empMap['7521'].empno}
+姓名:${empMap['7521'].ename}
+岗位:${empMap['7521'].job}
+薪资:${empMap['7521'].sal}
+部门号:${empMap['7521'].deptno}
+ + + + + + + + + + + <#list empMap?keys as k> + + + + + + + + + + +
索引工号姓名岗位薪资部门号
${k_index}${k}${empMap[k].ename}${empMap[k].job}${empMap[k].sal}${empMap[k].deptno}
+ + + \ No newline at end of file