浏览代码

添加sql日志

wyyay 1 年之前
父节点
当前提交
10a5c9c7ab

+ 3 - 0
api/src/main/java/com/ankaibei/workflow/vo/SysUser.java

@@ -66,4 +66,7 @@ public class SysUser {
 
     // 权利列表
     private List<String> userPermsList;
+
+    //菜单列表
+    private List<String> menuList;
 }

+ 3 - 2
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/mapper/ProjectInfoMapper.java

@@ -7,6 +7,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
 
 import javax.transaction.Transactional;
 import java.util.List;
@@ -60,8 +61,8 @@ public interface ProjectInfoMapper extends JpaRepository<ProjectInfoEntity, Inte
      *
      * @param projectName
      */
-    @Query(value = "SELECT pro.*  FROM project_info pro WHERE if( ?1 !='', pro.project_name like %?1% , 1=1) and is_delete='1' and flow_task_status='3' order by pro.create_date desc",
+    @Query(value = "SELECT pro.*  FROM project_info pro WHERE if( :projectName !='', pro.project_name like CONCAT('%',:projectName,'%') , 1=1) and is_delete='1' and flow_task_status='3' order by pro.create_date desc",
             //countQuery = "SELECT count(1) FROM project_info pro WHERE if( ?1 !='', pro.project_name like %?1% , 1=1) ",
             nativeQuery = true)
-    List<ProjectInfoEntity> findAllByProjectName(String projectName);
+    List<ProjectInfoEntity> findAllByProjectName(@Param("projectName") String projectName);
 }

+ 1 - 0
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/api/SysUserApiService.java

@@ -66,6 +66,7 @@ public class SysUserApiService implements SysUserApi {
                 .status(user.getUserStatus())
                 .userPermsList(permCodeList)
                 .isAdmin(isAdmin)
+                .menuList(allMenuList)
                 .build();
     }
 

+ 5 - 0
application-webadmin/src/main/resources/application.yml

@@ -20,6 +20,9 @@ server:
 
 # spring相关配置
 spring:
+  jpa:
+    database: mysql
+    show-sql: true
   application:
     name: application-webadmin
   profiles:
@@ -48,6 +51,8 @@ flowable:
   database-schema-update: false
 
 mybatis-plus:
+  configuration:
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
   mapper-locations: classpath:com/ankaibei/workFlow/webadmin/*/dao/mapper/*Mapper.xml,com/ankaibei/workFlow/common/log/dao/mapper/*Mapper.xml,com/ankaibei/workFlow/common/online/dao/mapper/*Mapper.xml,com/ankaibei/workFlow/common/flow/dao/mapper/*Mapper.xml
   type-aliases-package: com.ankaibei.workFlow.webadmin.*.model,com.ankaibei.workFlow.common.log.model,com.ankaibei.workFlow.common.online.model,com.ankaibei.workFlow.common.flow.model
   global-config:

+ 6 - 0
application-webadmin/src/main/resources/logback-spring.xml

@@ -97,6 +97,12 @@ debug:当此属性设置为true时,将打印出logback内部日志信息,
         <appender-ref ref="console"/>
         <appender-ref ref="file_log"/>
     </logger>
+    <logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE"  />
+    <logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG"  />
+    <logger name="org.hibernate.SQL" level="DEBUG" />
+    <logger name="org.hibernate.type" level="info" />
+    <logger name="org.hibernate.engine.spi.QueryParameters" level="DEBUG" />
+    <logger name="org.hibernate.engine.query.spi.HQLQueryPlan" level="DEBUG" />
     <logger name="org.flowable" additivity="false" level="info">
         <appender-ref ref="console"/>
         <appender-ref ref="file_log"/>