mirror of
https://github.com/201206030/novel-cloud.git
synced 2025-06-24 05:56:38 +00:00
上传通用模块/代码生成模块/网关基础服务/监控基础服务/用户微服务
This commit is contained in:
190
novel-gen/novel-gen.iml
Normal file
190
novel-gen/novel-gen.iml
Normal file
@ -0,0 +1,190 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
<facet type="web" name="Web">
|
||||
<configuration>
|
||||
<webroots />
|
||||
<sourceRoots>
|
||||
<root url="file://$MODULE_DIR$/src/main/java" />
|
||||
<root url="file://$MODULE_DIR$/src/main/resources" />
|
||||
</sourceRoots>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="novel-common" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-alibaba-nacos-discovery:0.2.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-alibaba-nacos-discovery:0.2.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-client:1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-common:1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-api:1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.47" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.prometheus:simpleclient:0.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:2.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:2.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-netflix-ribbon:2.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:2.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.7.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.60" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.60" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-ribbon:2.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-archaius:2.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-netflix-archaius:2.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.netflix.archaius:archaius-core:0.7.6" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.google.code.findbugs:jsr305:3.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-configuration:commons-configuration:1.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon:2.3.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.ribbon:ribbon-transport:2.3.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: io.reactivex:rxnetty-contexts:0.4.9" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: io.reactivex:rxnetty-servo:0.4.9" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.hystrix:hystrix-core:1.5.18" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: javax.inject:javax.inject:1" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: io.reactivex:rxnetty:0.4.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon-core:2.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon-httpclient:2.3.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.sun.jersey:jersey-client:1.19.1" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.sun.jersey:jersey-core:1.19.1" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: javax.ws.rs:jsr311-api:1.1.1" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.sun.jersey.contribs:jersey-apache-client4:1.19.1" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.servo:servo-core:0.12.21" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.netflix-commons:netflix-commons-util:0.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon-loadbalancer:2.3.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.netflix-commons:netflix-statistics:0.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.reactivex:rxjava:1.3.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-alibaba-nacos-config:0.2.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-alibaba-nacos-config:0.2.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.7.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.7.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-core:2.7.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.7.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.7.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.7.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:18.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.4.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.28" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.1.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-ui:2.7.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.24" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.24" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.24" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.17.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.3.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.1.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-cache:2.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.1.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-redis:1.4.1.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.1.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.1.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.1.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.1.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.1.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: redis.clients:jedis:2.9.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.6.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.11" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.google.protobuf:protobuf-java:2.6.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.2.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.1.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.dynamic-sql:mybatis-dynamic-sql:1.1.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.2.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.2.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.1.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.cuisongliu:orderbyhelper-spring-boot-starter:1.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.cuisongliu:orderbyhelper-spring-boot-autoconfigure:1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:orderby-helper:0.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt-api:0.10.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt-impl:0.10.6" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: io.jsonwebtoken:jjwt-jackson:0.10.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.9.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.generator:mybatis-generator-core:1.3.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-actuator:2.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.28" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator-autoconfigure:2.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator:2.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.micrometer:micrometer-core:1.1.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hdrhistogram:HdrHistogram:2.1.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.latencyutils:LatencyUtils:2.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.4" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.11.1" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:2.23.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.9.16" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.9.16" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.1.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.6.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: javax.xml.bind:jaxb-api:2.3.1" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: javax.activation:javax.activation-api:1.2.0" level="project" />
|
||||
</component>
|
||||
</module>
|
29
novel-gen/pom.xml
Normal file
29
novel-gen/pom.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>novel-cloud</artifactId>
|
||||
<groupId>com.java2nb.novel</groupId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>novel-gen</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.java2nb.novel</groupId>
|
||||
<artifactId>novel-common</artifactId>
|
||||
</dependency>
|
||||
<!-- MyBatis 生成器 -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.generator</groupId>
|
||||
<artifactId>mybatis-generator-core</artifactId>
|
||||
<version>${mybatis-generator.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
@ -0,0 +1,66 @@
|
||||
package com.java2nb.novel.gen;
|
||||
|
||||
import org.mybatis.generator.api.IntrospectedColumn;
|
||||
import org.mybatis.generator.api.IntrospectedTable;
|
||||
import org.mybatis.generator.api.dom.java.CompilationUnit;
|
||||
import org.mybatis.generator.api.dom.java.Field;
|
||||
import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType;
|
||||
import org.mybatis.generator.internal.DefaultCommentGenerator;
|
||||
import org.mybatis.generator.internal.util.StringUtility;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 自定义注释生成器生成器
|
||||
* @author xiongxiaoyang
|
||||
* @version 1.0
|
||||
* @since 2020/5/27
|
||||
*/
|
||||
public class CommentGenerator extends DefaultCommentGenerator {
|
||||
private boolean addRemarkComments = false;
|
||||
private static final String EXAMPLE_SUFFIX="Example";
|
||||
private static final String API_MODEL_PROPERTY_FULL_CLASS_NAME="io.swagger.annotations.ApiModelProperty";
|
||||
|
||||
/**
|
||||
* 设置用户配置的参数
|
||||
*/
|
||||
@Override
|
||||
public void addConfigurationProperties(Properties properties) {
|
||||
super.addConfigurationProperties(properties);
|
||||
this.addRemarkComments = StringUtility.isTrue(properties.getProperty("addRemarkComments"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFieldAnnotation(Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn, Set<FullyQualifiedJavaType> imports) {
|
||||
if(field.getInitializationString() == null) {
|
||||
String remarks = introspectedColumn.getRemarks();
|
||||
//根据参数和备注信息判断是否添加备注信息
|
||||
if (addRemarkComments && StringUtility.stringHasValue(remarks)) {
|
||||
// addFieldJavaDoc(field, remarks);
|
||||
//数据库中特殊字符需要转义
|
||||
if (remarks.contains("\"")) {
|
||||
remarks = remarks.replace("\"", "'");
|
||||
}
|
||||
//给model的字段添加swagger注解
|
||||
field.addJavaDocLine("@ApiModelProperty(value = \"" + remarks + "\")");
|
||||
}
|
||||
}
|
||||
|
||||
super.addFieldAnnotation(field,introspectedTable,introspectedColumn,imports);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void addJavaFileComment(CompilationUnit compilationUnit) {
|
||||
super.addJavaFileComment(compilationUnit);
|
||||
//只在model中添加swagger注解类的导入
|
||||
if(!compilationUnit.isJavaInterface()&&!compilationUnit.getType().getFullyQualifiedName().contains(EXAMPLE_SUFFIX)){
|
||||
compilationUnit.addImportedType(new FullyQualifiedJavaType(API_MODEL_PROPERTY_FULL_CLASS_NAME));
|
||||
}
|
||||
}
|
||||
}
|
41
novel-gen/src/main/java/com/java2nb/novel/gen/Generator.java
Normal file
41
novel-gen/src/main/java/com/java2nb/novel/gen/Generator.java
Normal file
@ -0,0 +1,41 @@
|
||||
package com.java2nb.novel.gen;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
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.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 持久层代码生成器
|
||||
* @author xiongxiaoyang
|
||||
* @version 1.0
|
||||
* @since 2020/5/27
|
||||
*/
|
||||
public class Generator {
|
||||
@SneakyThrows
|
||||
public static void main(String[] args) {
|
||||
//MBG 执行过程中的警告信息
|
||||
List<String> warnings = new ArrayList<>();
|
||||
//读取我们的 MBG 配置文件
|
||||
InputStream is = Generator.class.getResourceAsStream("/mybatis/generatorConfig.xml");
|
||||
ConfigurationParser cp = new ConfigurationParser(warnings);
|
||||
Configuration config = cp.parseConfiguration(is);
|
||||
is.close();
|
||||
//当生成的代码重复时,不要覆盖原代码
|
||||
DefaultShellCallback callback = new DefaultShellCallback(true);
|
||||
//创建 MBG
|
||||
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
|
||||
//执行生成代码
|
||||
myBatisGenerator.generate(null);
|
||||
//输出警告信息
|
||||
for (String warning : warnings) {
|
||||
System.out.println(warning);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
147
novel-gen/src/main/java/com/java2nb/novel/user/entity/User.java
Normal file
147
novel-gen/src/main/java/com/java2nb/novel/user/entity/User.java
Normal file
@ -0,0 +1,147 @@
|
||||
package com.java2nb.novel.user.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
public class User {
|
||||
@ApiModelProperty(value = "主键")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "登录名")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "登录密码")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty(value = "昵称")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String nickName;
|
||||
|
||||
@ApiModelProperty(value = "用户头像")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String userPhoto;
|
||||
|
||||
@ApiModelProperty(value = "用户性别,0:男,1:女")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Byte userSex;
|
||||
|
||||
@ApiModelProperty(value = "账户余额")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long accountBalance;
|
||||
|
||||
@ApiModelProperty(value = "用户状态,0:正常")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Byte status;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date updateTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUsername(String username) {
|
||||
this.username = username == null ? null : username.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setPassword(String password) {
|
||||
this.password = password == null ? null : password.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getNickName() {
|
||||
return nickName;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setNickName(String nickName) {
|
||||
this.nickName = nickName == null ? null : nickName.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getUserPhoto() {
|
||||
return userPhoto;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUserPhoto(String userPhoto) {
|
||||
this.userPhoto = userPhoto == null ? null : userPhoto.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Byte getUserSex() {
|
||||
return userSex;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUserSex(Byte userSex) {
|
||||
this.userSex = userSex;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getAccountBalance() {
|
||||
return accountBalance;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setAccountBalance(Long accountBalance) {
|
||||
this.accountBalance = accountBalance;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Byte getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setStatus(Byte status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.java2nb.novel.user.mapper;
|
||||
|
||||
import java.sql.JDBCType;
|
||||
import java.util.Date;
|
||||
import javax.annotation.Generated;
|
||||
import org.mybatis.dynamic.sql.SqlColumn;
|
||||
import org.mybatis.dynamic.sql.SqlTable;
|
||||
|
||||
public final class UserDynamicSqlSupport {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final User user = new User();
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> id = user.id;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> username = user.username;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> password = user.password;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> nickName = user.nickName;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> userPhoto = user.userPhoto;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Byte> userSex = user.userSex;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> accountBalance = user.accountBalance;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Byte> status = user.status;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> createTime = user.createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> updateTime = user.updateTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final class User extends SqlTable {
|
||||
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<String> username = column("username", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> password = column("password", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> nickName = column("nick_name", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> userPhoto = column("user_photo", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<Byte> userSex = column("user_sex", JDBCType.TINYINT);
|
||||
|
||||
public final SqlColumn<Long> accountBalance = column("account_balance", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Byte> status = column("status", JDBCType.TINYINT);
|
||||
|
||||
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public final SqlColumn<Date> updateTime = column("update_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public User() {
|
||||
super("user");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,211 @@
|
||||
package com.java2nb.novel.user.mapper;
|
||||
|
||||
import static com.java2nb.novel.user.mapper.UserDynamicSqlSupport.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||
|
||||
import com.java2nb.novel.user.entity.User;
|
||||
import java.util.List;
|
||||
import javax.annotation.Generated;
|
||||
import org.apache.ibatis.annotations.DeleteProvider;
|
||||
import org.apache.ibatis.annotations.InsertProvider;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Result;
|
||||
import org.apache.ibatis.annotations.ResultMap;
|
||||
import org.apache.ibatis.annotations.Results;
|
||||
import org.apache.ibatis.annotations.SelectProvider;
|
||||
import org.apache.ibatis.annotations.UpdateProvider;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.mybatis.dynamic.sql.SqlBuilder;
|
||||
import org.mybatis.dynamic.sql.delete.DeleteDSL;
|
||||
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
|
||||
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
||||
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategy;
|
||||
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
|
||||
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
|
||||
import org.mybatis.dynamic.sql.select.SelectDSL;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSL;
|
||||
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
|
||||
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||
|
||||
@Mapper
|
||||
public interface UserMapper {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
long count(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
|
||||
int delete(DeleteStatementProvider deleteStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
|
||||
int insert(InsertStatementProvider<User> insertStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@ResultMap("UserResult")
|
||||
User selectOne(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@Results(id="UserResult", value = {
|
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||
@Result(column="username", property="username", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="password", property="password", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="nick_name", property="nickName", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="user_photo", property="userPhoto", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="user_sex", property="userSex", jdbcType=JdbcType.TINYINT),
|
||||
@Result(column="account_balance", property="accountBalance", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="status", property="status", jdbcType=JdbcType.TINYINT),
|
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
|
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
|
||||
})
|
||||
List<User> selectMany(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
|
||||
int update(UpdateStatementProvider updateStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
|
||||
return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
|
||||
.from(user);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
|
||||
return DeleteDSL.deleteFromWithMapper(this::delete, user);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int deleteByPrimaryKey(Long id_) {
|
||||
return DeleteDSL.deleteFromWithMapper(this::delete, user)
|
||||
.where(id, isEqualTo(id_))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insert(User record) {
|
||||
return insert(SqlBuilder.insert(record)
|
||||
.into(user)
|
||||
.map(id).toProperty("id")
|
||||
.map(username).toProperty("username")
|
||||
.map(password).toProperty("password")
|
||||
.map(nickName).toProperty("nickName")
|
||||
.map(userPhoto).toProperty("userPhoto")
|
||||
.map(userSex).toProperty("userSex")
|
||||
.map(accountBalance).toProperty("accountBalance")
|
||||
.map(status).toProperty("status")
|
||||
.map(createTime).toProperty("createTime")
|
||||
.map(updateTime).toProperty("updateTime")
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insertSelective(User record) {
|
||||
return insert(SqlBuilder.insert(record)
|
||||
.into(user)
|
||||
.map(id).toPropertyWhenPresent("id", record::getId)
|
||||
.map(username).toPropertyWhenPresent("username", record::getUsername)
|
||||
.map(password).toPropertyWhenPresent("password", record::getPassword)
|
||||
.map(nickName).toPropertyWhenPresent("nickName", record::getNickName)
|
||||
.map(userPhoto).toPropertyWhenPresent("userPhoto", record::getUserPhoto)
|
||||
.map(userSex).toPropertyWhenPresent("userSex", record::getUserSex)
|
||||
.map(accountBalance).toPropertyWhenPresent("accountBalance", record::getAccountBalance)
|
||||
.map(status).toPropertyWhenPresent("status", record::getStatus)
|
||||
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
||||
.map(updateTime).toPropertyWhenPresent("updateTime", record::getUpdateTime)
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<User>>> selectByExample() {
|
||||
return SelectDSL.selectWithMapper(this::selectMany, id, username, password, nickName, userPhoto, userSex, accountBalance, status, createTime, updateTime)
|
||||
.from(user);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<User>>> selectDistinctByExample() {
|
||||
return SelectDSL.selectDistinctWithMapper(this::selectMany, id, username, password, nickName, userPhoto, userSex, accountBalance, status, createTime, updateTime)
|
||||
.from(user);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default User selectByPrimaryKey(Long id_) {
|
||||
return SelectDSL.selectWithMapper(this::selectOne, id, username, password, nickName, userPhoto, userSex, accountBalance, status, createTime, updateTime)
|
||||
.from(user)
|
||||
.where(id, isEqualTo(id_))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(User record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, user)
|
||||
.set(id).equalTo(record::getId)
|
||||
.set(username).equalTo(record::getUsername)
|
||||
.set(password).equalTo(record::getPassword)
|
||||
.set(nickName).equalTo(record::getNickName)
|
||||
.set(userPhoto).equalTo(record::getUserPhoto)
|
||||
.set(userSex).equalTo(record::getUserSex)
|
||||
.set(accountBalance).equalTo(record::getAccountBalance)
|
||||
.set(status).equalTo(record::getStatus)
|
||||
.set(createTime).equalTo(record::getCreateTime)
|
||||
.set(updateTime).equalTo(record::getUpdateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(User record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, user)
|
||||
.set(id).equalToWhenPresent(record::getId)
|
||||
.set(username).equalToWhenPresent(record::getUsername)
|
||||
.set(password).equalToWhenPresent(record::getPassword)
|
||||
.set(nickName).equalToWhenPresent(record::getNickName)
|
||||
.set(userPhoto).equalToWhenPresent(record::getUserPhoto)
|
||||
.set(userSex).equalToWhenPresent(record::getUserSex)
|
||||
.set(accountBalance).equalToWhenPresent(record::getAccountBalance)
|
||||
.set(status).equalToWhenPresent(record::getStatus)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||
.set(updateTime).equalToWhenPresent(record::getUpdateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKey(User record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, user)
|
||||
.set(username).equalTo(record::getUsername)
|
||||
.set(password).equalTo(record::getPassword)
|
||||
.set(nickName).equalTo(record::getNickName)
|
||||
.set(userPhoto).equalTo(record::getUserPhoto)
|
||||
.set(userSex).equalTo(record::getUserSex)
|
||||
.set(accountBalance).equalTo(record::getAccountBalance)
|
||||
.set(status).equalTo(record::getStatus)
|
||||
.set(createTime).equalTo(record::getCreateTime)
|
||||
.set(updateTime).equalTo(record::getUpdateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKeySelective(User record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, user)
|
||||
.set(username).equalToWhenPresent(record::getUsername)
|
||||
.set(password).equalToWhenPresent(record::getPassword)
|
||||
.set(nickName).equalToWhenPresent(record::getNickName)
|
||||
.set(userPhoto).equalToWhenPresent(record::getUserPhoto)
|
||||
.set(userSex).equalToWhenPresent(record::getUserSex)
|
||||
.set(accountBalance).equalToWhenPresent(record::getAccountBalance)
|
||||
.set(status).equalToWhenPresent(record::getStatus)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||
.set(updateTime).equalToWhenPresent(record::getUpdateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
}
|
54
novel-gen/src/main/resources/mybatis/generatorConfig.xml
Normal file
54
novel-gen/src/main/resources/mybatis/generatorConfig.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
|
||||
<generatorConfiguration>
|
||||
<!--Mybatis Generator目前有5种运行模式,分别为:MyBatis3DynamicSql、MyBatis3Kotlin、MyBatis3、MyBatis3Simple、MyBatis3DynamicSqlV1。-->
|
||||
<context id="springboot-base" targetRuntime="MyBatis3DynamicSql">
|
||||
<commentGenerator type="com.java2nb.novel.gen.CommentGenerator">
|
||||
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
|
||||
<property name="suppressAllComments" value="true"/>
|
||||
<property name="addRemarkComments" value="true"/>
|
||||
</commentGenerator>
|
||||
<jdbcConnection
|
||||
connectionURL="jdbc:mysql://127.0.0.1:3306/novel_plus?tinyInt1isBit=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true"
|
||||
driverClass="com.mysql.jdbc.Driver" password="test123456"
|
||||
userId="root" />
|
||||
|
||||
<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer, 为 true时把JDBC DECIMAL
|
||||
和 NUMERIC 类型解析为java.math.BigDecimal -->
|
||||
<javaTypeResolver>
|
||||
<property name="forceBigDecimals" value="false" />
|
||||
</javaTypeResolver>
|
||||
|
||||
<!-- targetProject:生成PO类的位置 -->
|
||||
<javaModelGenerator
|
||||
targetPackage="com.java2nb.novel.user.entity"
|
||||
targetProject="/Users/xiongxiaoyang/java/novel-cloud/novel-gen/src/main/java">
|
||||
<!-- enableSubPackages:是否让schema作为包的后缀 -->
|
||||
<property name="enableSubPackages" value="false" />
|
||||
<!-- 从数据库返回的值被清理前后的空格 -->
|
||||
<property name="trimStrings" value="true" />
|
||||
</javaModelGenerator>
|
||||
|
||||
|
||||
<!-- targetProject:mapper映射文件生成的位置 -->
|
||||
<sqlMapGenerator targetPackage="mybatis.mapping"
|
||||
targetProject="/Users/xiongxiaoyang/java/novel-cloud/novel-gen/src/main/resources">
|
||||
<!-- enableSubPackages:是否让schema作为包的后缀 -->
|
||||
<property name="enableSubPackages" value="false" />
|
||||
</sqlMapGenerator>
|
||||
|
||||
<!-- targetPackage:mapper接口生成的位置 -->
|
||||
<javaClientGenerator
|
||||
targetPackage="com.java2nb.novel.user.mapper"
|
||||
targetProject="/Users/xiongxiaoyang/java/novel-cloud/novel-gen/src/main/java" type="XMLMAPPER">
|
||||
<!-- enableSubPackages:是否让schema作为包的后缀 -->
|
||||
<property name="enableSubPackages" value="false" />
|
||||
</javaClientGenerator>
|
||||
|
||||
<!--生成全部表tableName设为%-->
|
||||
<table tableName="user" />
|
||||
|
||||
<!-- 指定数据库表 -->
|
||||
<!--<table schema="jly" tableName="job_position" domainObjectName="JobPositionTest"/>-->
|
||||
</context>
|
||||
</generatorConfiguration>
|
291
novel-gen/src/main/resources/mybatis/mapping/UserMapper.xml
Normal file
291
novel-gen/src/main/resources/mybatis/mapping/UserMapper.xml
Normal file
@ -0,0 +1,291 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.java2nb.novel.user.mapper.UserMapper">
|
||||
<resultMap id="BaseResultMap" type="com.java2nb.novel.user.entity.User">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="username" jdbcType="VARCHAR" property="username" />
|
||||
<result column="password" jdbcType="VARCHAR" property="password" />
|
||||
<result column="nick_name" jdbcType="VARCHAR" property="nickName" />
|
||||
<result column="user_photo" jdbcType="VARCHAR" property="userPhoto" />
|
||||
<result column="user_sex" jdbcType="TINYINT" property="userSex" />
|
||||
<result column="account_balance" jdbcType="BIGINT" property="accountBalance" />
|
||||
<result column="status" jdbcType="TINYINT" property="status" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, username, password, nick_name, user_photo, user_sex, account_balance, status,
|
||||
create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.java2nb.novel.user.entity.UserExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from user
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from user
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from user
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="com.java2nb.novel.user.entity.UserExample">
|
||||
delete from user
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.java2nb.novel.user.entity.User">
|
||||
insert into user (id, username, password,
|
||||
nick_name, user_photo, user_sex,
|
||||
account_balance, status, create_time,
|
||||
update_time)
|
||||
values (#{id,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
|
||||
#{nickName,jdbcType=VARCHAR}, #{userPhoto,jdbcType=VARCHAR}, #{userSex,jdbcType=TINYINT},
|
||||
#{accountBalance,jdbcType=BIGINT}, #{status,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{updateTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.java2nb.novel.user.entity.User">
|
||||
insert into user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="username != null">
|
||||
username,
|
||||
</if>
|
||||
<if test="password != null">
|
||||
password,
|
||||
</if>
|
||||
<if test="nickName != null">
|
||||
nick_name,
|
||||
</if>
|
||||
<if test="userPhoto != null">
|
||||
user_photo,
|
||||
</if>
|
||||
<if test="userSex != null">
|
||||
user_sex,
|
||||
</if>
|
||||
<if test="accountBalance != null">
|
||||
account_balance,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="username != null">
|
||||
#{username,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="password != null">
|
||||
#{password,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="nickName != null">
|
||||
#{nickName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userPhoto != null">
|
||||
#{userPhoto,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userSex != null">
|
||||
#{userSex,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="accountBalance != null">
|
||||
#{accountBalance,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="com.java2nb.novel.user.entity.UserExample" resultType="java.lang.Long">
|
||||
select count(*) from user
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update user
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.username != null">
|
||||
username = #{record.username,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.password != null">
|
||||
password = #{record.password,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.nickName != null">
|
||||
nick_name = #{record.nickName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.userPhoto != null">
|
||||
user_photo = #{record.userPhoto,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.userSex != null">
|
||||
user_sex = #{record.userSex,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="record.accountBalance != null">
|
||||
account_balance = #{record.accountBalance,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.status != null">
|
||||
status = #{record.status,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update user
|
||||
set id = #{record.id,jdbcType=BIGINT},
|
||||
username = #{record.username,jdbcType=VARCHAR},
|
||||
password = #{record.password,jdbcType=VARCHAR},
|
||||
nick_name = #{record.nickName,jdbcType=VARCHAR},
|
||||
user_photo = #{record.userPhoto,jdbcType=VARCHAR},
|
||||
user_sex = #{record.userSex,jdbcType=TINYINT},
|
||||
account_balance = #{record.accountBalance,jdbcType=BIGINT},
|
||||
status = #{record.status,jdbcType=TINYINT},
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.java2nb.novel.user.entity.User">
|
||||
update user
|
||||
<set>
|
||||
<if test="username != null">
|
||||
username = #{username,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="password != null">
|
||||
password = #{password,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="nickName != null">
|
||||
nick_name = #{nickName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userPhoto != null">
|
||||
user_photo = #{userPhoto,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userSex != null">
|
||||
user_sex = #{userSex,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="accountBalance != null">
|
||||
account_balance = #{accountBalance,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.java2nb.novel.user.entity.User">
|
||||
update user
|
||||
set username = #{username,jdbcType=VARCHAR},
|
||||
password = #{password,jdbcType=VARCHAR},
|
||||
nick_name = #{nickName,jdbcType=VARCHAR},
|
||||
user_photo = #{userPhoto,jdbcType=VARCHAR},
|
||||
user_sex = #{userSex,jdbcType=TINYINT},
|
||||
account_balance = #{accountBalance,jdbcType=BIGINT},
|
||||
status = #{status,jdbcType=TINYINT},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
BIN
novel-gen/target/classes/META-INF/novel-gen.kotlin_module
Normal file
BIN
novel-gen/target/classes/META-INF/novel-gen.kotlin_module
Normal file
Binary file not shown.
Binary file not shown.
BIN
novel-gen/target/classes/com/java2nb/novel/gen/Generator.class
Normal file
BIN
novel-gen/target/classes/com/java2nb/novel/gen/Generator.class
Normal file
Binary file not shown.
54
novel-gen/target/classes/mybatis/generatorConfig.xml
Normal file
54
novel-gen/target/classes/mybatis/generatorConfig.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
|
||||
<generatorConfiguration>
|
||||
<!--Mybatis Generator目前有5种运行模式,分别为:MyBatis3DynamicSql、MyBatis3Kotlin、MyBatis3、MyBatis3Simple、MyBatis3DynamicSqlV1。-->
|
||||
<context id="springboot-base" targetRuntime="MyBatis3DynamicSql">
|
||||
<commentGenerator type="com.java2nb.novel.gen.CommentGenerator">
|
||||
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
|
||||
<property name="suppressAllComments" value="true"/>
|
||||
<property name="addRemarkComments" value="true"/>
|
||||
</commentGenerator>
|
||||
<jdbcConnection
|
||||
connectionURL="jdbc:mysql://127.0.0.1:3306/novel_plus?tinyInt1isBit=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true"
|
||||
driverClass="com.mysql.jdbc.Driver" password="test123456"
|
||||
userId="root" />
|
||||
|
||||
<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer, 为 true时把JDBC DECIMAL
|
||||
和 NUMERIC 类型解析为java.math.BigDecimal -->
|
||||
<javaTypeResolver>
|
||||
<property name="forceBigDecimals" value="false" />
|
||||
</javaTypeResolver>
|
||||
|
||||
<!-- targetProject:生成PO类的位置 -->
|
||||
<javaModelGenerator
|
||||
targetPackage="com.java2nb.novel.user.entity"
|
||||
targetProject="/Users/xiongxiaoyang/java/novel-cloud/novel-gen/src/main/java">
|
||||
<!-- enableSubPackages:是否让schema作为包的后缀 -->
|
||||
<property name="enableSubPackages" value="false" />
|
||||
<!-- 从数据库返回的值被清理前后的空格 -->
|
||||
<property name="trimStrings" value="true" />
|
||||
</javaModelGenerator>
|
||||
|
||||
|
||||
<!-- targetProject:mapper映射文件生成的位置 -->
|
||||
<sqlMapGenerator targetPackage="mybatis.mapping"
|
||||
targetProject="/Users/xiongxiaoyang/java/novel-cloud/novel-gen/src/main/resources">
|
||||
<!-- enableSubPackages:是否让schema作为包的后缀 -->
|
||||
<property name="enableSubPackages" value="false" />
|
||||
</sqlMapGenerator>
|
||||
|
||||
<!-- targetPackage:mapper接口生成的位置 -->
|
||||
<javaClientGenerator
|
||||
targetPackage="com.java2nb.novel.user.mapper"
|
||||
targetProject="/Users/xiongxiaoyang/java/novel-cloud/novel-gen/src/main/java" type="XMLMAPPER">
|
||||
<!-- enableSubPackages:是否让schema作为包的后缀 -->
|
||||
<property name="enableSubPackages" value="false" />
|
||||
</javaClientGenerator>
|
||||
|
||||
<!--生成全部表tableName设为%-->
|
||||
<table tableName="user" />
|
||||
|
||||
<!-- 指定数据库表 -->
|
||||
<!--<table schema="jly" tableName="job_position" domainObjectName="JobPositionTest"/>-->
|
||||
</context>
|
||||
</generatorConfiguration>
|
291
novel-gen/target/classes/mybatis/mapping/UserMapper.xml
Normal file
291
novel-gen/target/classes/mybatis/mapping/UserMapper.xml
Normal file
@ -0,0 +1,291 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.java2nb.novel.user.mapper.UserMapper">
|
||||
<resultMap id="BaseResultMap" type="com.java2nb.novel.user.entity.User">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="username" jdbcType="VARCHAR" property="username" />
|
||||
<result column="password" jdbcType="VARCHAR" property="password" />
|
||||
<result column="nick_name" jdbcType="VARCHAR" property="nickName" />
|
||||
<result column="user_photo" jdbcType="VARCHAR" property="userPhoto" />
|
||||
<result column="user_sex" jdbcType="TINYINT" property="userSex" />
|
||||
<result column="account_balance" jdbcType="BIGINT" property="accountBalance" />
|
||||
<result column="status" jdbcType="TINYINT" property="status" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, username, password, nick_name, user_photo, user_sex, account_balance, status,
|
||||
create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.java2nb.novel.user.entity.UserExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from user
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from user
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from user
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="com.java2nb.novel.user.entity.UserExample">
|
||||
delete from user
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.java2nb.novel.user.entity.User">
|
||||
insert into user (id, username, password,
|
||||
nick_name, user_photo, user_sex,
|
||||
account_balance, status, create_time,
|
||||
update_time)
|
||||
values (#{id,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
|
||||
#{nickName,jdbcType=VARCHAR}, #{userPhoto,jdbcType=VARCHAR}, #{userSex,jdbcType=TINYINT},
|
||||
#{accountBalance,jdbcType=BIGINT}, #{status,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{updateTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.java2nb.novel.user.entity.User">
|
||||
insert into user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="username != null">
|
||||
username,
|
||||
</if>
|
||||
<if test="password != null">
|
||||
password,
|
||||
</if>
|
||||
<if test="nickName != null">
|
||||
nick_name,
|
||||
</if>
|
||||
<if test="userPhoto != null">
|
||||
user_photo,
|
||||
</if>
|
||||
<if test="userSex != null">
|
||||
user_sex,
|
||||
</if>
|
||||
<if test="accountBalance != null">
|
||||
account_balance,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="username != null">
|
||||
#{username,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="password != null">
|
||||
#{password,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="nickName != null">
|
||||
#{nickName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userPhoto != null">
|
||||
#{userPhoto,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userSex != null">
|
||||
#{userSex,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="accountBalance != null">
|
||||
#{accountBalance,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="com.java2nb.novel.user.entity.UserExample" resultType="java.lang.Long">
|
||||
select count(*) from user
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update user
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.username != null">
|
||||
username = #{record.username,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.password != null">
|
||||
password = #{record.password,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.nickName != null">
|
||||
nick_name = #{record.nickName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.userPhoto != null">
|
||||
user_photo = #{record.userPhoto,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.userSex != null">
|
||||
user_sex = #{record.userSex,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="record.accountBalance != null">
|
||||
account_balance = #{record.accountBalance,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.status != null">
|
||||
status = #{record.status,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update user
|
||||
set id = #{record.id,jdbcType=BIGINT},
|
||||
username = #{record.username,jdbcType=VARCHAR},
|
||||
password = #{record.password,jdbcType=VARCHAR},
|
||||
nick_name = #{record.nickName,jdbcType=VARCHAR},
|
||||
user_photo = #{record.userPhoto,jdbcType=VARCHAR},
|
||||
user_sex = #{record.userSex,jdbcType=TINYINT},
|
||||
account_balance = #{record.accountBalance,jdbcType=BIGINT},
|
||||
status = #{record.status,jdbcType=TINYINT},
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.java2nb.novel.user.entity.User">
|
||||
update user
|
||||
<set>
|
||||
<if test="username != null">
|
||||
username = #{username,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="password != null">
|
||||
password = #{password,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="nickName != null">
|
||||
nick_name = #{nickName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userPhoto != null">
|
||||
user_photo = #{userPhoto,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userSex != null">
|
||||
user_sex = #{userSex,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="accountBalance != null">
|
||||
account_balance = #{accountBalance,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.java2nb.novel.user.entity.User">
|
||||
update user
|
||||
set username = #{username,jdbcType=VARCHAR},
|
||||
password = #{password,jdbcType=VARCHAR},
|
||||
nick_name = #{nickName,jdbcType=VARCHAR},
|
||||
user_photo = #{userPhoto,jdbcType=VARCHAR},
|
||||
user_sex = #{userSex,jdbcType=TINYINT},
|
||||
account_balance = #{accountBalance,jdbcType=BIGINT},
|
||||
status = #{status,jdbcType=TINYINT},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
Reference in New Issue
Block a user