บทความก่อนหน้านี้การใช้งานของ MyBatis Reverse Engineering ส่วนใหญ่พูดถึงการใช้ mybatis-generator-core-1.3.2.jar สิ่งที่ฉันต้องการแนะนำในบทความนี้คือการปรับเปลี่ยนรหัสแพ็คเกจ JAR เพื่อให้ได้การสร้างเทมเพลตที่กำหนดเอง
1. จากที่นี่เราสามารถดาวน์โหลดซอร์สโค้ดของโครงการ MyBatis-Generator-core-1.3.2.jar
http://maven.outofmemory.cn/org.mybatis.generator/mybatis-generator-core/1.3.2/
2. นำเข้าโครงการ Maven ที่มีอยู่ภายใต้ Eclipse, File-> Import
เลือกตำแหน่งซอร์สโค้ดของโครงการและคลิกเสร็จสิ้นเพื่อนำเข้าให้เสร็จสมบูรณ์
โครงสร้างไดเรกทอรีโครงการเป็นแบบนี้
3. ด้านล่างฉันย้อนกลับรูปแบบการแมปและ XML เพื่อสร้าง
4. เริ่มแก้ไขก่อนอื่นอธิบายแต่ละไดเรกทอรี
แพ็คเกจ TSE ที่ด้านล่างเป็นแพ็คเกจที่กำหนดเองของฉันซึ่งเป็นคลาสหลักทดสอบว่ารหัสที่สร้างขึ้นตรงตามมาตรฐานที่คาดหวังหรือไม่
เนื่องจากแพ็คเกจนี้เขียนโดยชาวต่างชาติสไตล์รหัสที่สร้างขึ้นไม่เหมือนกับของเรา หากคุณต้องการแก้ไขรูปแบบรหัสขอแนะนำให้คุณอ่านบทความเกี่ยวกับช้างสับปะรด ฉันจะไม่พูดถึงรูปแบบรหัสที่นี่
http://www.blogjava.net/bolo/archive/2015/03/20/423683.html
ก่อนอื่นเราจะแก้ไขรหัสการแมปของไฟล์อินเตอร์เฟสที่จะสร้างโดยโครงการย้อนกลับ โดยค่าเริ่มต้นมีการเพิ่มเติมการลบการดัดแปลงและการค้นหา มาพูดคุยเกี่ยวกับวิธีการแก้ไขอย่างใดอย่างหนึ่งในการอัปเดต
ตัวอย่างเช่นฉันต้องการมีวิธีการดังกล่าวในการอัปเดตโมฆะการแมปที่สร้างขึ้น (แผนที่ <สตริงวัตถุ> datamap);
เปลี่ยนคลาส UpdateByPrimaryKeyWithOutBlobSmethodgenerator ภายใต้ org.mybatis.generator.codegen.mybatis3.javamapper.elements แพ็คเกจดังต่อไปนี้:
/** ลิขสิทธิ์ 2009 Apache Software Foundation ** ได้รับใบอนุญาตภายใต้ใบอนุญาต Apache, เวอร์ชัน 2.0 ("ใบอนุญาต");* คุณไม่สามารถใช้ไฟล์นี้ยกเว้นตามใบอนุญาต* คุณอาจได้รับสำเนาใบอนุญาตที่ ** http://www.apache.org/license/license-2.0 "ตามสภาพ" พื้นฐาน* โดยไม่มีการรับประกันหรือเงื่อนไขใด ๆ ไม่ว่าจะโดยชัดแจ้งหรือบอกเป็นนัย* ดูใบอนุญาตสำหรับการอนุญาตการกำกับดูแลภาษาเฉพาะและ* ข้อ จำกัด ภายใต้ใบอนุญาต*/แพ็คเกจ org.mybatis.generator.codegen.mybatis3.javamapper.elements; org.mybatis.generator.api.dom.java.UlualifiedJavatype นำเข้า org.mybatis.generator.api.dom.java.interface; นำเข้า org.mybatis.generator.api.dom.java.javavisibility; org.mybatis.generator.api.dom.java.parameter;/**** @author Jeff Butler**/ชั้นเรียนสาธารณะ updateByprimarykeyWithoutBlobsmethodgenerator ExtractSabstractJavamappermetHodgenerator addInterfaceElements (อินเตอร์เฟสอินเตอร์เฟส) {set <เต็ม QualifiedJavatype> importEdTypes = ใหม่ชุด treeSet <เต็มไปด้วย QualifiedJavatype> (); parametertypeSpes.parimetertypes.parimeterty = วิธีการใหม่ (); // เพิ่มวิธีการปรับเปลี่ยน publicmethod.setVisability (Javavisability.public); // ตั้งค่าการส่งคืนที่นี่ฉันใช้โมฆะที่กำหนดเองวิธีที่ไม่มีค่าส่งคืน getVoidInstance () // คลาสที่มีคุณสมบัติใหม่ เต็มไปด้วย QualifiedJavatype ("void") เพียงเขียนประเภทการส่งคืนบนวิธีการสร้าง SetReturntype (เต็ม QualifiedJavatype.getVoidInstance ()); // ตั้งชื่อวิธีคุณยังสามารถเข้าไปในและดูวิธีการ พารามิเตอร์ (ParameterType, "Record")); // $ non nls-1 $ เต็ม qualifiedjavatype maptype = fullqualifiedJavatype.getMymapInstance (); // พารามิเตอร์ของวิธีการนี่คือพารามิเตอร์ DATEMAP ของพารามิเตอร์ประเภทแผนที่ = พารามิเตอร์ใหม่ (MAPTYPE, "DATAMAP"); method.addparameter (พารามิเตอร์); Context.getCommentGenerator (). AddGeneralMethodcomment (วิธีการ, introspectedTable); addMapperannotations (interfaze, method); if (context.getPlugins (). clientUpDateByPrimaryKeyWithOutBlobSmethodGenerated (วิธีการ, interfaze, introspectedtable)) {interfaze.addimportedTypes (importedTypes); methody.addmethod (วิธีการ)}} คุณสามารถแก้ไขได้ตามความคิดเห็น
ถัดไปแก้ไขรหัสใน XML ที่สอดคล้องกันของการแมป ในทำนองเดียวกันที่นี่ฉันจะแนะนำวิธีการอัปเดตเท่านั้น ฉันเชื่อว่าหลังจากอ่านแล้วคุณสามารถแก้ไขวิธีการอื่นได้ด้วยตัวเอง
เปลี่ยนคลาส UpdateByPrimaryKeyWithOutBlobSelementGenerator ภายใต้ org.mybatis.generator.codegen.mybatis3.xmlmapper.elements แพ็คเกจดังต่อไปนี้:
/** ลิขสิทธิ์ 2009 Apache Software Foundation ** ได้รับใบอนุญาตภายใต้ใบอนุญาต Apache, เวอร์ชัน 2.0 ("ใบอนุญาต");* คุณไม่สามารถใช้ไฟล์นี้ยกเว้นตามใบอนุญาต* คุณอาจได้รับสำเนาใบอนุญาตที่ ** http://www.apache.org/license/license-2.0 "ตามสภาพ" พื้นฐาน* โดยไม่มีการรับประกันหรือเงื่อนไขใด ๆ ไม่ว่าจะโดยชัดแจ้งหรือบอกเป็นนัย* ดูใบอนุญาตสำหรับการอนุญาตการกำกับดูแลภาษาเฉพาะและ* ข้อ จำกัด ภายใต้ใบอนุญาต*/แพ็คเกจ org.mybatis.generator.codegen.mybatis3.xmlmapper.elements; org.mybatis.generator.api.intropsectedcolumn; นำเข้า org.mybatis.generator.api.dom.outpututitiles; นำเข้า org.mybatis.generator.api.dom.xml.attribute; นำเข้า org.mybatis.gatis.gatis.gatis. org.mybatis.generator.api.dom.xml.xmlelement; นำเข้า org.mybatis.generator.codegen.mybatis3.mybatis3formattingitations;/**** @author Jeff Butler** Issimple; Public UpdateByprimaryKeyWithOutBlobSelementGenerator (บูลีน issimple) {super (); // this.issimple = issimple;}@upridepublic addelements (xmlelement) {// update tag // $ non nls-1 $ // asses ของแท็กอัปเดต answer.addattribute (แอตทริบิวต์ใหม่ ("id", introspectedTable.getUpDateByPrimaryKeyStatementId ())); //$NON-NLS-1$ANSWER.ADDATTRIBUTE(NEW ATTRIBUTE ("PARAMETERTYPE", // $ ไม่ใช่ NLS-1 $ "MAP")); // เพิ่มแท็กลงใน context.getCommentGenerator (). addComment (คำตอบ); StringBuilder sb = new StringBuilder (); sb.append ("Update"); //$NON-NLS-1$SB.Append( IntroScectedTable.GetFullualIfiedTablenameatruntime());//tag เนื้อหานั่นคือองค์ประกอบข้อความตอบคำถาม (ข้อความใหม่ (sb.tostring ())); sb.setLength (0); // ตั้งค่าแท็ก xmlelement setelement = new xmlelement ("set"); // $ non nls-1 $ // รับฟิลด์ทั้งหมดในรายการตารางฐานข้อมูล <StropectectedColumn> COLS = IntrospectedTable.getAllColumns (); // iteration java.util.iterator <introspectedColumn> iter = cols.iterator () iter.next (); // ถ้าแท็ก xmlelement ifelement = new xmlelement ("ถ้า"); // $ nonnls-1 $ // ชื่อฟิลด์สตริง str = mybatis3formattingutitilits.getescapedColumnName (IntrospectedColumn); // ถ้าแท็กเพิ่มการทดสอบแอตทริบิวต์ค่าคือฟิลด์! = null และฟิลด์! ค่าที่จะแก้ไข SB.Append (MyBatis3FormattingUtilities.getEscapedColumnName (IntrospectedColumn)); SB.Append ("="); //$NON-NLS-1$SB.Append(MYBATIS3FORMATTITITITY.GETPARAMETERCLAUSE( INTROSPECTECTCOLUMN)); if (iter.hasnext ()) {sb.append (',');} // ถ้าแท็กเพิ่มองค์ประกอบข้อความด้านบน ifelement.addelement (textelement ใหม่ (sb.toString ())); ถ้า (iter.hasnext ()) {sb.setlength (0); 1);} setelement.addelement (ifelement);} // โดยที่องค์ประกอบ (แก้ไขเงื่อนไขฟิลด์แก้ไข) xmlelement โดยที่การเลือกตั้ง = ใหม่ xmlelement ("โดยที่"); สำหรับ (introspectedColumn IntrospectedColumn sb.setLength (0); sb.append (mybatis3formattingitilities.getescapedColumnName (IntrospectedColumn)); sb.append ("="); //$NON-NLS-1$SB.Append(MYBATIS3FORMATTATICTILS.GETPARAMETERCLAUSE( INTROSPECTECTCOLUMN)); wereelement.addelement( NEW TEXTELEMENT (SB.TOSTRING ()));} // เพิ่มองค์ประกอบที่กำหนดไว้ คำตอบ ADDELEMENT (ที่ไหน); if (context.getPlugins (). SQLMAPUPDATEBYBRIMARYKEANTHOUDBLOBSELEMENTGENATED (คำตอบ, intRospectedTable)) {ParentElement.addElement (คำตอบ);}}} คุณสามารถแก้ไขวิธีการอื่นได้ตามวิธีการอัปเดตนี้
หากคุณต้องการเพิ่มวิธีการใหม่โปรดดูโพสต์ต่อไปนี้
http://m.blog.csdn.net/article/details?id=35985705
ต่อไปฉันจะตรวจสอบผลการแก้ไข
GeneratorConfig.xml // กำหนดค่า XML ก่อนและวางไว้ใน SRC/Main/Resources/Directory <? xml version = "1.0" การเข้ารหัส = "UTF-8"?> <! "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> <seneratorconfiguration> <!-แนะนำไฟล์การกำหนดค่า-> <! location = "e: /eclipse_workspace/testmybatis/mysql-connector-java-5.1.13-bin.jar"/> <!-บริบทหนึ่งสำหรับฐานข้อมูล-> <context id = "Infoguardian" targetRuntime = "MyBatis3" value = "true"/> <!-uncomment-> <property name = "suppressDate" value = "true"/> <!-ไม่ว่าจะสร้างการสร้างความคิดเห็น timestamps-> </commentGenerator> <! ConnectionUrl = "JDBC: mySQL: // localHost: 3306/เข้าสู่ระบบ? ตัวละคร = UTF-8" userId = "รูท" รหัสผ่าน = "รูท"/> <! value = "false"/> </javatyperesolver> <!-สร้างที่อยู่คลาสเอนทิตี-> <javamodelgenerator targetPackage = "pojo" targetProject = "mybatis3"> <! -> <property name = "ENABLESUBPACKAGES" value = "true"/> <!-ไม่ว่าจะเรียกการตัดแต่งเมื่อตั้งค่าสำหรับฟิลด์ประเภทสตริง-> <property name = "trimStrings" value = "true"/> </javamodelGenerator> <! เลเยอร์ของสคีมาภายใต้เส้นทางปัจจุบันเช่น: เส้นทาง fase cn.ffcs.test.domain ", true: cn.ffcs.test.domain". [schemaname]-> <property name = "ENABSEBPACKAGES" value = "true" /> < /sqlmapgenerator> <! type = "xmlmapper" targetPackage = "mapper" targetProject = "mybatis3"> <!-ไม่ว่าจะเพิ่มเลเยอร์ใหม่ของสคีมาใต้เส้นทางปัจจุบันเช่น: เส้นทาง fase cn.ffcs.test.domain ", true: cn.ffcs.test.domain" </javaclientGenerator> <!-กำหนดค่าข้อมูลตารางไม่มีการสร้างตารางที่นี่ชื่อตารางที่สอดคล้องกันจะต้องเปลี่ยนหนึ่งครั้ง-> <table tablename = "เข้าสู่ระบบ" domainObjectName = "เข้าสู่ระบบ" enableCountByExample = "false" enableteByExample = "False" </GeneratorConfiguration>
startup.java///the โปรแกรมหลักสำหรับการตรวจสอบ
แพ็คเกจ tse; นำเข้า org.junit.assert.assertequals; นำเข้า java.io.file; นำเข้า java.util.arraylist; นำเข้า java.util.list; นำเข้า java.util.list; นำเข้า org.mybatis.enerator.api.mybatisgeneratoratoratoratoratoratoratoratoratoratoratoratorator. org.mybatis.generator.config.xml.configurationparser; นำเข้า org.mybatis.generator.internal.defaultshellcallback; การเริ่มต้นคลาสสาธารณะ {public static void main (string [] args) โยนข้อยกเว้น ไฟล์ (startup.class.getResource ("/generatoronconfig.xml"). touri ()); configurationParser cp = new configurationParser (คำเตือน); การกำหนดค่าการกำหนดค่า = cp.parseconfiguration (configfile) MyBatisGenerator (config, shellcallback, คำเตือน); mybatisgenerator.generate (null); system.out.println (คำเตือน);}} ตกลงเรียกใช้ startup.java
ไฟล์ที่เกี่ยวข้องถูกสร้างขึ้นในไดเรกทอรีเป้าหมายตามการกำหนดค่าของ GeneratorConfig.xml
ตกลงผลลัพธ์เดียวกับที่ฉันคาดไว้
5. หลังจากการดัดแปลงข้างต้นเราเริ่มบรรจุภัณฑ์
เนื่องจากเป็นโครงการ Maven ฉันใช้ Maven3.3.9 และคุณยังสามารถใช้ Eclipse ในตัว Maven แต่ฉันไม่ชอบมันอยู่ดี
ด้านล่างคือรหัสไฟล์ pom.xml ของโครงการ Maven ของฉัน
<? XML เวอร์ชัน = "1.0" การเข้ารหัส = "UTF-8"?> <!-ลิขสิทธิ์ 2009-2011 MyBatis Teamlicense ภายใต้ใบอนุญาต Apache เวอร์ชัน 2.0 ("ใบอนุญาต"); คุณไม่สามารถใช้ไฟล์นี้ยกเว้นในการปฏิบัติตามใบอนุญาตคุณอาจได้รับสำเนาใบอนุญาต athttp: //www.apache.org/licenses/license-2.0unless ตามกฎหมายที่บังคับใช้หรือตกลงที่จะเป็นลายลักษณ์อักษร ใบอนุญาต.-> <!-เวอร์ชัน: $ id: pom.xml 4114 2011-11-27 19: 03: 32z simone.tripodi $-> <Project xmlns = "http://maven.apache.org/pom/4.0.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/maven-v4_0_0.xsd"><modelversion>4.0.0 </modelversion> S-Generator </artifactId> <version> 1.3.2 </Sersion> </Parent> <ArtIfactId> MyBatis-Generator-Core </artifactId> <packaging> jar </packaging> <name> Core Generator </name> <สร้าง> <!-การสร้างนี้สร้างและติดตั้งไฟล์ JAR ที่ใช้เครื่องมือสำหรับโครงการระบบ-ดังนั้นเราจึงสามารถรวบรวมข้อมูลความครอบคลุมรวม-> <ปลั๊กอิน> <!-! <Plugin> <roupID> org.apache.maven.plugins </groupId> <ratifactid> maven-site-plugin </artifactid> <cenections> <cencution> <maven> PREPARE-Package </เฟส> <goals> <goal> ไซต์ </เป้าหมาย> <Plugin> <roupId> org.apache.maven.plugins </groupId> <ratifactid> maven-source-plugin </artifactid> <cencutions> <cencution> <maven> PREPARY-Package </pearse> <plugin> <roupid> org.apache.maven.plugins </groupid> <ratifactid> maven-source-plugin </artifactid> <version> 2.2.1 </version> tach-sources </id> <goals> <goal> jar </goal> </goals> <การกำหนดค่า> <รวมถึง <รวม> **/org/** </include> -> <!-<Plugin> <roupId> org.apache.maven.plugins </groupid> <ratifactid> maven-javadoc-plugin </artifactid> <cencutions> -> <plugin> <roupId> org.codehaus.mojo </groupid> <ratifactid> Cobertura-Maven-Plugin </artifactid> <cencutions> <cencution> <id> Cobertura-Instrument </id> <pare> </plugin> <!- <Plugin> <roupId> org.apache.maven.plugins </groupId> <ratifactid> maven-jar-plugin </artifactid> <การกำหนดค่า> <rarchive> mainclass> org.mybatis.generator.api.shellrunner </sclass> </manifest> </archive> </configuration> Tura-jar </id> <pare> การทดสอบการรวม </เฟส> <goals> <goal> jar </sour> </เป้าหมาย> <การกำหนดค่า> <classifier> Cobertura </classifier> <classesdirectory> $ {basedir}/target/generated-classes/cobertura -> <plugin> <roupId> org.apache.maven.plugins </groupId> <ratifactid> maven-jar-plugin </artifactid> <cersion> 2.4 </เวอร์ชัน> l> jar </goal> </goals> </execution> </executions> <การกำหนดค่า> <chevive> <Manifest> <dadClassPath> True </addClassPath> <SclassPathPrefix> </classpathprefix> ชั้นเรียน> </manifest> </archive> <cenned> <cult> **/org/** </include> </cold> </การกำหนดค่า> </plugin> <plugin> </loupid> org.apache.maven.plugins </groupid> การเปลี่ยนแปลง> <การดำเนินการ> <id> Cobertura-Install </id> <pare> การรวมการทดสอบการรวม </เฟส> <source> <source> ติดตั้ง </เป้าหมาย> </เป้าหมาย> <การกำหนดค่า> </plugin> <!-<plugin> <molin> <sloupid> org.apache.maven.plugins </groupId> <ratifactid> maven-assembly-plugin </artifactid> <การกำหนดค่า> <scriptor> <scriptor> <EXECUTIONS> <EXECUTION> <ID> BUNDLE </ID> <goals> <goal> Single </eal> </เป้าหมาย> <pare> Package </Phase> </Execution> </Executions> </plugin> -> <plugin> <GroupId> org.apache.maven.plugins </groupid> <ratifactid> maven-assembly-plugin </artifactid> <การกำหนดค่า> <ภาคผนวก ID> FALSE </AppendAsemblyId> <scriptors> <scriptor> $ {Afflementir} /src/main/assembly/src.xml </scriptor> </scriptors> <EXCUTIONS> <EXECUTION> <ID> Make-ASSEMBLY </ID> <pare> Package </Phase> <goals> <goal> Single </goal> </goals> </Execution> </execution> </plugin> tifactId> <cenections> <cuition> <mpare> การปรับใช้ </เฟส> <goals> <goal> อัปโหลด </goal> </เป้าหมาย> <การกำหนดค่า> <อัปโหลด> <อัปโหลด> <file> $ {project.build.directory </project.artifactid $ {project.version} </summary> <melles> <dable> <dlable> Fileth </label> <melmall> type-archive </label> <meld> <label> ผลิตภัณฑ์ Generator </label> <label> เวอร์ชัน-$ {project.version} </label> </labels> >/ปลั๊กอิน> <plugin> <roupId> org.apache.maven.plugins </groupid> <ratifactid> maven-release-plugin </artifactid> <การกำหนดค่า> <guruments> -prelease, Gopload </arguments> ld> <การรายงาน> <plugins> <plugin> <molin> <roupId> org.codehaus.mojo </groupid> <ratifactid> jdepend-maven-plugin </artifactid> <sersion> 2.0-beta-2 </sold> </plugin> a-maven-plugin </artifactid> </plugin> </plugins> </การรายงาน> <การพึ่งพา> <การพึ่งพา> <roupId> log4j </groupId> <ratifactid> log4j </artifactid> upid> <ratifactid> ant </artifactid> <scope> ให้ </cope> </การพึ่งพา> <การพึ่งพา> <roupid> Junit </groupId> <ratifactid> junit </artifactid> <pope> test </scope> ActID> HSQLDB </ArtIfactId> <pope> ทดสอบ </scope> </การพึ่งพา> <การพึ่งพา> <roupId> org.apache.maven.plugins </groupId> <url> https://mybatis.googlecode.com/svn/sub-projects/generator/tags/mybatis-generator-1.3.2/mybatis-generat OR-core </url> <การเชื่อมต่อ> SCM: SVN: https: //mybatis.googlecode.com/svn/sub-projects/generator/tags/mybatis-gen Ether-1.3.2/mybatis-generator-core </การเชื่อมต่อ> <evelopererConnection> SCM: SVN: https: //mybatis.googlecode.com/svn/sub-projects/generator/tags/mybatis-generator-1.3 จากนั้นแก้ไขรหัส SRC/Main/Assembly/SRC.XML
<การชุมนุม xmlns = "http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns: xsi = "http://www.w3.org/200 1/xmlschema-instance "xsi: schemalocation =" http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsdญ > <fileSet> <Irectory> SRC/Main/Resources </Directory> <OutputDirectory>/</UtputDirectory> <cond inclulen orconfig.xml </include> </indive> <cecludes> <cerfrude> log4j.properties </exclude> <cedsol> src.xml </exclude> </excludes> </fileset> <filectory> ude> run.bat </include> </indive> </fileset> <fileset> <Setory> $ {project.build.directory} </directory> <pututDirectory>/</outputDirectory> leset> <fileset> <Irectory> $ {project.build.directory} </directory> <EutputDirectory>/</outputDirectory> <cencal> <cult> $ {project.artifactid}-$ {project.version} จากนั้นสร้างโฟลเดอร์สคริปต์ใหม่ภายใต้ SRC/Main/, สร้างเอกสารข้อความ TXT ใหม่ในโฟลเดอร์สคริปต์และป้อนรหัสต่อไปนี้
java -jar mybatis -generator-1.3.2.jar -configfile generatoronconfig.xml เขียนทับ
หยุดชั่วคราว
เปลี่ยนชื่อไฟล์เป็น run.bat
ณ จุดนี้บรรจุภัณฑ์และการกำหนดค่าจะเสร็จสมบูรณ์
คุณสามารถคลิกขวาที่ Run As-> Maven Build ภายใต้โครงการและป้อนแพ็คเกจในเป้าหมาย หรือป้อนไดเรกทอรีโครงการใน CMD ในบรรทัดคำสั่งและเรียกใช้แพ็คเกจ MVN ครั้งแรกที่คุณเรียกใช้ที่นี่คุณจะรอเป็นเวลานานเพราะ Maven จะดาวน์โหลดแพ็คเกจ Jar ที่ขึ้นอยู่กับโปรดรออย่างอดทน
หลังจากบรรจุภัณฑ์โครงสร้างต่อไปนี้จะถูกสร้างขึ้นในไดเรกทอรีเป้าหมายในไดเรกทอรีรากของโครงการ
จากรูปด้านบนเราจะเห็นได้ว่าแพ็คเกจ mybatis-generator-core-1.3.2.jar ได้ถูกสร้างขึ้น ต่อไปเราสามารถใช้เพื่อเพิ่ม generatorConfig.xml เพื่อสร้างรหัสที่เราต้องการ
หากคุณไม่เข้าใจอะไรในระหว่างกระบวนการปรับเปลี่ยนรหัสโปรดอ่านเพิ่มเติมของซอร์สโค้ด
ตกลงแสดงผลลัพธ์
นั่นคือทั้งหมดสำหรับบทความนี้!
ข้างต้นคือความรู้ที่เกี่ยวข้องเกี่ยวกับการดัดแปลงและบรรจุภัณฑ์ของแพ็คเกจ Jar Engineering Reverse Engineering MyBatis ที่แนะนำโดยบรรณาธิการ ฉันหวังว่ามันจะเป็นประโยชน์กับทุกคน!