release: 引入queryDsl

release-2024-08-08
huangyw 4 months ago
parent 446c0a0771
commit 7daa0a6e98

@ -26,7 +26,6 @@ import annotation.Excel;
import annotation.Excels; import annotation.Excels;
import annotation.Excel.ColumnType; import annotation.Excel.ColumnType;
import annotation.Excel.Type; import annotation.Excel.Type;
import com.sun.xml.internal.ws.util.UtilException;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RegExUtils; import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.reflect.FieldUtils; import org.apache.commons.lang3.reflect.FieldUtils;
@ -267,7 +266,6 @@ public class ExcelUtil<T>{
catch (Exception e) catch (Exception e)
{ {
log.error("导入Excel异常{}", e.getMessage()); log.error("导入Excel异常{}", e.getMessage());
throw new UtilException(e.getMessage());
} }
finally finally
{ {

@ -147,6 +147,17 @@
<version>${mybatis-plus.version}</version> <version>${mybatis-plus.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- QueryDSL框架依赖 -->
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>app</finalName> <finalName>app</finalName>
@ -174,6 +185,24 @@
<dockerHost>http://116.62.145.60:2375</dockerHost> <dockerHost>http://116.62.145.60:2375</dockerHost>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<!--因为QueryDsl是类型安全的所以还需要加上Maven APT plugin使用 APT 自动生成Q类:-->
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

@ -0,0 +1,23 @@
package com.luoo.user.config;
import com.querydsl.jpa.impl.JPAQueryFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import javax.persistence.EntityManager;
/**
* 使QueryDSL使JPAQueryFactoryJPAQueryFactory使EntityManager
* 使SpringEntityManagerJPAQueryFactory
* @author NJ
* @create 2022/12/5 15:12
*/
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Bean
public JPAQueryFactory jpaQuery(EntityManager entityManager) {
return new JPAQueryFactory(entityManager);
}
}

@ -155,6 +155,9 @@ public class UserPointLogService {
if (taskPointId != null) { if (taskPointId != null) {
TaskPoint taskPoint = taskPointService.getTaskPoint(taskPointId); TaskPoint taskPoint = taskPointService.getTaskPoint(taskPointId);
if(taskPoint == null) {
return ;
}
// 获取积分任务类型 // 获取积分任务类型
Integer type = taskPoint.getType(); Integer type = taskPoint.getType();

Loading…
Cancel
Save