mirror of
https://gitee.com/best_handsome/mybatis-plus-join
synced 2025-07-11 00:02:22 +08:00
1.3.2
This commit is contained in:
parent
953a70f2ff
commit
8251a84f81
142
pom.xml
142
pom.xml
@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<version>1.3.2</version>
|
||||
<name>mybatis-plus-join</name>
|
||||
<description>An enhanced toolkit of Mybatis-Plus to simplify development.</description>
|
||||
<url>https://github.com/yulichang/mybatis-plus-join</url>
|
||||
@ -52,144 +52,4 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.6.8</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<serverId>ossrh</serverId>
|
||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||
<stagingProgressTimeoutMinutes>30</stagingProgressTimeoutMinutes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>disable-javadoc-doclint</id>
|
||||
<activation>
|
||||
<jdk>[1.8,)</jdk>
|
||||
</activation>
|
||||
<properties>
|
||||
<additionalparam>-Xdoclint:none</additionalparam>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.6.8</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<serverId>ossrh</serverId>
|
||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||
<stagingProgressTimeoutMinutes>30</stagingProgressTimeoutMinutes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>ossrh</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>ossrh</id>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
</project>
|
||||
|
@ -161,15 +161,18 @@ public class MPJInterceptor implements Interceptor {
|
||||
//移除对多查询列,为了可重复使用wrapper
|
||||
columnList.removeIf(SelectColumn::isLabel);
|
||||
List<ResultMapping> resultMappings = new ArrayList<>(columnList.size());
|
||||
columnList.forEach(i -> {
|
||||
for (SelectColumn i : columnList) {
|
||||
TableFieldInfo info = i.getTableFieldInfo();
|
||||
if (StringUtils.isNotBlank(i.getAlias())) {
|
||||
//优先别名查询 selectFunc selectAs
|
||||
ResultMapping.Builder builder = new ResultMapping.Builder(ms.getConfiguration(), i.getAlias(),
|
||||
i.getAlias(), getAliasField(resultType, fieldMap, i.getAlias()));
|
||||
if (i.getFuncEnum() == null || StringUtils.isBlank(i.getFuncEnum().getSql())) {
|
||||
Field f = fieldMap.get(i.getAlias());
|
||||
if (f == null) {
|
||||
continue;
|
||||
}
|
||||
if (info != null && info.getTypeHandler() != null && info.getTypeHandler() != UnknownTypeHandler.class) {
|
||||
Field f = fieldMap.get(i.getAlias());
|
||||
if (f.getType() == info.getField().getType()) {
|
||||
builder.typeHandler(getTypeHandler(ms, info));
|
||||
}
|
||||
@ -180,23 +183,28 @@ public class MPJInterceptor implements Interceptor {
|
||||
// select selectAll selectAsClass
|
||||
if (i.getFuncEnum() == null || StringUtils.isBlank(i.getFuncEnum().getSql())) {
|
||||
ResultMapping.Builder builder = new ResultMapping.Builder(ms.getConfiguration(), info.getProperty(),
|
||||
info.getColumn(), info.getPropertyType());
|
||||
if (info.getTypeHandler() != null && info.getTypeHandler() != UnknownTypeHandler.class) {
|
||||
Field f = fieldMap.get(info.getProperty());
|
||||
if (f != null && f.getType() == info.getField().getType()) {
|
||||
StringUtils.getTargetColumn(info.getColumn()), info.getPropertyType());
|
||||
Field f = fieldMap.get(info.getProperty());
|
||||
if (f == null) {
|
||||
continue;
|
||||
}
|
||||
if (f.getType() == info.getField().getType()) {
|
||||
if (info.getTypeHandler() != null && info.getTypeHandler() != UnknownTypeHandler.class) {
|
||||
builder.typeHandler(getTypeHandler(ms, info));
|
||||
}
|
||||
}
|
||||
builder.javaType(f.getType());
|
||||
resultMappings.add(builder.build());
|
||||
} else {
|
||||
resultMappings.add(new ResultMapping.Builder(ms.getConfiguration(), info.getProperty(), info.getColumn(), info.getPropertyType()).build());
|
||||
resultMappings.add(new ResultMapping.Builder(ms.getConfiguration(), info.getProperty(),
|
||||
StringUtils.getTargetColumn(info.getColumn()), info.getPropertyType()).build());
|
||||
}
|
||||
} else {
|
||||
// 主键列
|
||||
resultMappings.add(new ResultMapping.Builder(ms.getConfiguration(), i.getTagProperty(), i.getColumnName(),
|
||||
i.getKeyType()).build());
|
||||
resultMappings.add(new ResultMapping.Builder(ms.getConfiguration(), i.getTagProperty(),
|
||||
StringUtils.getTargetColumn(i.getColumnName()), i.getKeyType()).build());
|
||||
}
|
||||
});
|
||||
}
|
||||
Set<String> columnSet = resultMappings.stream().map(ResultMapping::getColumn).collect(Collectors.toSet());
|
||||
//移除result中不存在的标签
|
||||
resultMappings.removeIf(i -> !fieldMap.containsKey(i.getProperty()));
|
||||
@ -214,7 +222,8 @@ public class MPJInterceptor implements Interceptor {
|
||||
columnName = getColumn(columnSet, columnName);
|
||||
columnList.add(SelectColumn.of(mpjColl.getEntityClass(), r.getColumn(), null,
|
||||
Objects.equals(columnName, r.getColumn()) ? null : columnName, null, null, true, null));
|
||||
ResultMapping.Builder builder = new ResultMapping.Builder(ms.getConfiguration(), r.getProperty(), columnName, r.getJavaType());
|
||||
ResultMapping.Builder builder = new ResultMapping.Builder(ms.getConfiguration(), r.getProperty(),
|
||||
StringUtils.getTargetColumn(columnName), r.getJavaType());
|
||||
if (r.isId()) {//主键标记为id标签
|
||||
builder.flags(Collections.singletonList(ResultFlag.ID));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user