From 3f465acb40c133a36933692a6667cec0188abbdb Mon Sep 17 00:00:00 2001 From: whyclxw <http://whyclxw@118.89.139.230:10101/r/~whyclxw/IdeaTest.git> Date: 星期五, 16 四月 2021 10:21:46 +0800 Subject: [PATCH] 提交 --- SpringBootF_1.iml | 5 + target/classes/mapper/User_infMapper.xml | 15 +++ target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst | 3 .idea/libraries/Maven__org_apache_velocity_velocity_engine_core_2_3.xml | 13 +++ target/classes/com/example/lxw/service/User_infService.class | 0 .idea/libraries/Maven__com_baomidou_mybatis_plus_generator_3_1_2.xml | 13 +++ target/test-classes/com/example/lxw/GeneratorCode.class | 0 pom.xml | 11 ++ target/classes/com/example/lxw/pojo/User_inf.class | 0 .idea/libraries/Maven__org_apache_commons_commons_lang3_3_8_1.xml | 13 +++ target/classes/com/example/lxw/pojo/vo/UserInfo.class | 0 target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst | 0 target/classes/com/example/lxw/controller/User_infController.class | 0 src/main/java/com/example/lxw/pojo/User_inf.java | 7 - target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst | 12 +++ src/test/java/com/example/lxw/GeneratorCode.java | 78 +++++++++++++++++++ target/classes/com/example/lxw/mapper/User_InfMapper.class | 0 target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst | 11 ++ 18 files changed, 173 insertions(+), 8 deletions(-) diff --git a/.idea/libraries/Maven__com_baomidou_mybatis_plus_generator_3_1_2.xml b/.idea/libraries/Maven__com_baomidou_mybatis_plus_generator_3_1_2.xml new file mode 100644 index 0000000..6d4aa45 --- /dev/null +++ b/.idea/libraries/Maven__com_baomidou_mybatis_plus_generator_3_1_2.xml @@ -0,0 +1,13 @@ +<component name="libraryTable"> + <library name="Maven: com.baomidou:mybatis-plus-generator:3.1.2"> + <CLASSES> + <root url="jar://$PROJECT_DIR$/../../maven/apache-maven-3.6.3/maven_jar/com/baomidou/mybatis-plus-generator/3.1.2/mybatis-plus-generator-3.1.2.jar!/" /> + </CLASSES> + <JAVADOC> + <root url="jar://$PROJECT_DIR$/../../maven/apache-maven-3.6.3/maven_jar/com/baomidou/mybatis-plus-generator/3.1.2/mybatis-plus-generator-3.1.2-javadoc.jar!/" /> + </JAVADOC> + <SOURCES> + <root url="jar://$PROJECT_DIR$/../../maven/apache-maven-3.6.3/maven_jar/com/baomidou/mybatis-plus-generator/3.1.2/mybatis-plus-generator-3.1.2-sources.jar!/" /> + </SOURCES> + </library> +</component> \ No newline at end of file diff --git a/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_8_1.xml b/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_8_1.xml new file mode 100644 index 0000000..b3049d2 --- /dev/null +++ b/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_8_1.xml @@ -0,0 +1,13 @@ +<component name="libraryTable"> + <library name="Maven: org.apache.commons:commons-lang3:3.8.1"> + <CLASSES> + <root url="jar://$PROJECT_DIR$/../../maven/apache-maven-3.6.3/maven_jar/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar!/" /> + </CLASSES> + <JAVADOC> + <root url="jar://$PROJECT_DIR$/../../maven/apache-maven-3.6.3/maven_jar/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1-javadoc.jar!/" /> + </JAVADOC> + <SOURCES> + <root url="jar://$PROJECT_DIR$/../../maven/apache-maven-3.6.3/maven_jar/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1-sources.jar!/" /> + </SOURCES> + </library> +</component> \ No newline at end of file diff --git a/.idea/libraries/Maven__org_apache_velocity_velocity_engine_core_2_3.xml b/.idea/libraries/Maven__org_apache_velocity_velocity_engine_core_2_3.xml new file mode 100644 index 0000000..582d111 --- /dev/null +++ b/.idea/libraries/Maven__org_apache_velocity_velocity_engine_core_2_3.xml @@ -0,0 +1,13 @@ +<component name="libraryTable"> + <library name="Maven: org.apache.velocity:velocity-engine-core:2.3"> + <CLASSES> + <root url="jar://$PROJECT_DIR$/../../maven/apache-maven-3.6.3/maven_jar/org/apache/velocity/velocity-engine-core/2.3/velocity-engine-core-2.3.jar!/" /> + </CLASSES> + <JAVADOC> + <root url="jar://$PROJECT_DIR$/../../maven/apache-maven-3.6.3/maven_jar/org/apache/velocity/velocity-engine-core/2.3/velocity-engine-core-2.3-javadoc.jar!/" /> + </JAVADOC> + <SOURCES> + <root url="jar://$PROJECT_DIR$/../../maven/apache-maven-3.6.3/maven_jar/org/apache/velocity/velocity-engine-core/2.3/velocity-engine-core-2.3-sources.jar!/" /> + </SOURCES> + </library> +</component> \ No newline at end of file diff --git a/SpringBootF_1.iml b/SpringBootF_1.iml index fb4a352..8c27d2c 100644 --- a/SpringBootF_1.iml +++ b/SpringBootF_1.iml @@ -40,7 +40,6 @@ <orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf:3.0.11.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.attoparser:attoparser:2.0.5.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.unbescape:unbescape:1.1.6.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" /> <orderEntry type="library" name="Maven: org.thymeleaf.extras:thymeleaf-extras-java8time:3.0.4.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.1.12.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.1.12.RELEASE" level="project" /> @@ -131,5 +130,9 @@ <orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.2.0.Final" level="project" /> <orderEntry type="library" name="Maven: io.springfox:springfox-bean-validators:2.9.2" level="project" /> <orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-ui:2.0.2" level="project" /> + <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-generator:3.1.2" level="project" /> + <orderEntry type="library" name="Maven: org.apache.velocity:velocity-engine-core:2.3" level="project" /> + <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" /> + <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" /> </component> </module> \ No newline at end of file diff --git a/pom.xml b/pom.xml index d9986bf..3304be7 100644 --- a/pom.xml +++ b/pom.xml @@ -97,6 +97,17 @@ </exclusion> </exclusions>--> </dependency> + <!--浠g爜鐢熸垚鍣�--> + <dependency> + <groupId>com.baomidou</groupId> + <artifactId>mybatis-plus-generator</artifactId> + <version>3.1.2</version> + </dependency> + <dependency> + <groupId>org.apache.velocity</groupId> + <artifactId>velocity-engine-core</artifactId> + <version>2.3</version> + </dependency> </dependencies> <build> diff --git a/src/main/java/com/example/lxw/pojo/User_inf.java b/src/main/java/com/example/lxw/pojo/User_inf.java index 7745746..c78639e 100644 --- a/src/main/java/com/example/lxw/pojo/User_inf.java +++ b/src/main/java/com/example/lxw/pojo/User_inf.java @@ -56,11 +56,4 @@ private List<UserBattgroupBaojigroupUsr> baojigroupUsrs; - public void setBaojigroupUsrs(List<UserBattgroupBaojigroupUsr> baojigroupUsrs) { - this.baojigroupUsrs = baojigroupUsrs; - } - - public List<UserBattgroupBaojigroupUsr> getBaojigroupUsrs() { - return baojigroupUsrs; - } } diff --git a/src/test/java/com/example/lxw/GeneratorCode.java b/src/test/java/com/example/lxw/GeneratorCode.java new file mode 100644 index 0000000..1ec38e2 --- /dev/null +++ b/src/test/java/com/example/lxw/GeneratorCode.java @@ -0,0 +1,78 @@ +package com.example.lxw; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.generator.AutoGenerator; +import com.baomidou.mybatisplus.generator.config.DataSourceConfig; +import com.baomidou.mybatisplus.generator.config.GlobalConfig; +import com.baomidou.mybatisplus.generator.config.PackageConfig; +import com.baomidou.mybatisplus.generator.config.StrategyConfig; +import com.baomidou.mybatisplus.generator.config.po.TableFill; +import com.baomidou.mybatisplus.generator.config.rules.DateType; +import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; +import java.util.ArrayList; + +import java.util.ArrayList; + +/** + * @author lxw + * @create 2021-04-15 16:48 + */ +public class GeneratorCode { + public static void main(String[] args) { + // 需要构建一个 代码自动生成器 对象 + AutoGenerator mpg = new AutoGenerator(); + // 配置策略 + // 1、全局配置 + GlobalConfig gc = new GlobalConfig(); + String projectPath = System.getProperty("user.dir"); + gc.setOutputDir(projectPath+"/src/main/java/com/example"); + gc.setAuthor("lxw"); + gc.setOpen(false); + gc.setFileOverride(false); // 是否覆盖 + gc.setServiceName("%sService"); // 去Service的I前缀 + gc.setIdType(IdType.ID_WORKER); + gc.setDateType(DateType.ONLY_DATE); + //gc.setSwagger2(true); + mpg.setGlobalConfig(gc); + //2、设置数据源 + DataSourceConfig dsc = new DataSourceConfig(); + dsc.setUrl("jdbc:mysql://192.168.10.79:3360/db_user?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8"); + dsc.setDriverName("com.mysql.cj.jdbc.Driver"); + dsc.setUsername("root"); + dsc.setPassword("lmx8688139"); + dsc.setDbType(DbType.MYSQL); + mpg.setDataSource(dsc); + //3、包的配置 + PackageConfig pc = new PackageConfig(); + pc.setModuleName("blog"); + pc.setParent("com.generator"); + pc.setEntity("entity"); + pc.setMapper("mapper"); + pc.setService("service"); + pc.setController("controller"); + mpg.setPackageInfo(pc); + //4、策略配置 + StrategyConfig strategy = new StrategyConfig(); + strategy.setInclude("tb_user_inf","tb_user_battgroup_baojigroup","tb_user_battgroup_baojigroup_battgroup","tb_user_battgroup_baojigroup_usr"); // 设置要映射的表名 + strategy.setNaming(NamingStrategy.underline_to_camel); + strategy.setColumnNaming(NamingStrategy.underline_to_camel); + strategy.setEntityLombokModel(true); // 自动lombok; + strategy.setLogicDeleteFieldName("deleted"); + // 自动填充配置 + TableFill gmtCreate = new TableFill("gmt_create", FieldFill.INSERT); + TableFill gmtModified = new TableFill("gmt_modified",FieldFill.INSERT_UPDATE); + ArrayList<TableFill> tableFills = new ArrayList<>(); + tableFills.add(gmtCreate); + tableFills.add(gmtModified); + strategy.setTableFillList(tableFills); + // 乐观锁 + strategy.setVersionFieldName("version"); + strategy.setRestControllerStyle(true); + strategy.setControllerMappingHyphenStyle(true); //localhost:8080/hello_id_2mpg.setStrategy(strategy); + mpg.execute(); //执行 + + } +} diff --git a/target/classes/com/example/lxw/controller/User_infController.class b/target/classes/com/example/lxw/controller/User_infController.class index 57e3f28..2e18c01 100644 --- a/target/classes/com/example/lxw/controller/User_infController.class +++ b/target/classes/com/example/lxw/controller/User_infController.class Binary files differ diff --git a/target/classes/com/example/lxw/mapper/User_InfMapper.class b/target/classes/com/example/lxw/mapper/User_InfMapper.class index 9de9339..9866014 100644 --- a/target/classes/com/example/lxw/mapper/User_InfMapper.class +++ b/target/classes/com/example/lxw/mapper/User_InfMapper.class Binary files differ diff --git a/target/classes/com/example/lxw/pojo/User_inf.class b/target/classes/com/example/lxw/pojo/User_inf.class index 6f887ce..2aaaabe 100644 --- a/target/classes/com/example/lxw/pojo/User_inf.class +++ b/target/classes/com/example/lxw/pojo/User_inf.class Binary files differ diff --git a/target/classes/com/example/lxw/pojo/vo/UserInfo.class b/target/classes/com/example/lxw/pojo/vo/UserInfo.class new file mode 100644 index 0000000..61489ff --- /dev/null +++ b/target/classes/com/example/lxw/pojo/vo/UserInfo.class Binary files differ diff --git a/target/classes/com/example/lxw/service/User_infService.class b/target/classes/com/example/lxw/service/User_infService.class index 34a24ea..d34a3af 100644 --- a/target/classes/com/example/lxw/service/User_infService.class +++ b/target/classes/com/example/lxw/service/User_infService.class Binary files differ diff --git a/target/classes/mapper/User_infMapper.xml b/target/classes/mapper/User_infMapper.xml index d05056c..bfb1611 100644 --- a/target/classes/mapper/User_infMapper.xml +++ b/target/classes/mapper/User_infMapper.xml @@ -10,10 +10,25 @@ </collection> </resultMap> + <resultMap id="baojiUserMap2" type="UserInfo"> + <result column="uSnId" property="uSnId" /> + <result column="uName" property="uName" /> + <collection property="usrList" ofType="UserBattgroupBaojigroupUsr"> + <result column="baoji_group_id" property="baojiGroupId" /> + </collection> + </resultMap> + <select id="searchByBaojiUsr" resultMap="baojiUserMap"> SELECT tb_user_inf.*,tb_user_battgroup_baojigroup_usr.baoji_group_id from tb_user_inf LEFT JOIN tb_user_battgroup_baojigroup_usr ON tb_user_inf.uId=tb_user_battgroup_baojigroup_usr.uId order by tb_user_inf.uid </select> + + <select id="searchByBaojiUsr2" resultMap="baojiUserMap2"> + SELECT tb_user_inf.*,tb_user_battgroup_baojigroup_usr.baoji_group_id + from tb_user_inf + LEFT JOIN tb_user_battgroup_baojigroup_usr ON tb_user_inf.uId=tb_user_battgroup_baojigroup_usr.uId + order by tb_user_inf.uid + </select> </mapper> \ No newline at end of file diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..72bb16f --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,12 @@ +com\example\lxw\websocket\WebSocketServer.class +com\example\lxw\config\SwaggerConfig4Knife.class +com\example\lxw\pojo\User_inf.class +com\example\lxw\mapper\User_InfMapper.class +com\example\lxw\config\MvcConfig.class +com\example\lxw\controller\User_infController.class +com\example\lxw\LxwApplication.class +com\example\lxw\pojo\UserBattgroupBaojigroupUsr.class +com\example\lxw\pojo\ServiceModel.class +com\example\lxw\service\User_infService.class +com\example\lxw\websocket\WebSocketServer$1.class +com\example\lxw\config\MybatisPlusConfig.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..6266ff7 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,11 @@ +D:\Eworkspqce\SpringBootF_1\src\main\java\com\example\lxw\pojo\User_inf.java +D:\Eworkspqce\SpringBootF_1\src\main\java\com\example\lxw\service\User_infService.java +D:\Eworkspqce\SpringBootF_1\src\main\java\com\example\lxw\pojo\ServiceModel.java +D:\Eworkspqce\SpringBootF_1\src\main\java\com\example\lxw\mapper\User_InfMapper.java +D:\Eworkspqce\SpringBootF_1\src\main\java\com\example\lxw\config\MvcConfig.java +D:\Eworkspqce\SpringBootF_1\src\main\java\com\example\lxw\LxwApplication.java +D:\Eworkspqce\SpringBootF_1\src\main\java\com\example\lxw\config\SwaggerConfig4Knife.java +D:\Eworkspqce\SpringBootF_1\src\main\java\com\example\lxw\config\MybatisPlusConfig.java +D:\Eworkspqce\SpringBootF_1\src\main\java\com\example\lxw\controller\User_infController.java +D:\Eworkspqce\SpringBootF_1\src\main\java\com\example\lxw\websocket\WebSocketServer.java +D:\Eworkspqce\SpringBootF_1\src\main\java\com\example\lxw\pojo\UserBattgroupBaojigroupUsr.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000..fef0a13 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1,3 @@ +D:\Eworkspqce\SpringBootF_1\src\test\java\com\example\lxw\GeneratorCode.java +D:\Eworkspqce\SpringBootF_1\src\test\java\com\example\lxw\LxwApplicationTests.java +D:\Eworkspqce\SpringBootF_1\src\test\java\com\example\lxw\MpperTest.java diff --git a/target/test-classes/com/example/lxw/GeneratorCode.class b/target/test-classes/com/example/lxw/GeneratorCode.class new file mode 100644 index 0000000..c51696d --- /dev/null +++ b/target/test-classes/com/example/lxw/GeneratorCode.class Binary files differ -- Gitblit v1.9.1