Browse Source

任务记录查询修稿

master
DX 2 weeks ago
parent
commit
dd1d377063
  1. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java
  2. 19
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java
  3. 55
      yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterpriseinspections/EnterpriseInspections.xml
  4. 8
      yudao-server/src/main/resources/application-local.yaml

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java

@ -53,6 +53,8 @@ public interface EnterpriseInspectionsMapper extends BaseMapperX<EnterpriseInspe
.inIfPresent(EnterpriseInspectionsDO::getTaskId,reqVO.getTaskIds())
.orderByDesc(EnterpriseInspectionsDO::getId));
}
IPage<EnterpriseInspectionsDO> inspectionsByLogStatus(Page<EnterpriseInspectionsDO> page, @Param("params") EnterpriseInspectionsPageReqVO pageReqVO);
//整改数据
List<EnterpriseInspectionsCorrectionVO> inspectionsCorrectionList();

19
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java

@ -269,8 +269,13 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
}
}
//TODO 按状态查询不好用
final PageResult<EnterpriseInspectionsDO> enterpriseInspectionsDOPageResult = enterpriseInspectionsMapper.selectPage(pageReqVO);
//TODO 按状态查询不好用 inspectionsByLogStatus
// final PageResult<EnterpriseInspectionsDO> enterpriseInspectionsDOPageResult = enterpriseInspectionsMapper.selectPage(pageReqVO);
Page<EnterpriseInspectionsDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
final IPage<EnterpriseInspectionsDO> enterpriseInspectionsDOIPage = enterpriseInspectionsMapper.inspectionsByLogStatus(page, pageReqVO);
final PageResult<EnterpriseInspectionsDO> enterpriseInspectionsDOPageResult = new PageResult<>(enterpriseInspectionsDOIPage.getRecords(), enterpriseInspectionsDOIPage.getTotal());
if ( enterpriseInspectionsDOPageResult.getList() != null && enterpriseInspectionsDOPageResult.getList().size() > 0 ) {
enterpriseInspectionsDOPageResult.getList().forEach(item->{
@ -356,11 +361,11 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
});
}
if (pageReqVO.getInspectionsStatus() != null) {
final List<EnterpriseInspectionsDO> collect = enterpriseInspectionsDOPageResult.getList().stream().filter(item -> item.getInspectionStatus() == pageReqVO.getInspectionsStatus()).collect(Collectors.toList());
enterpriseInspectionsDOPageResult.setList(collect);
enterpriseInspectionsDOPageResult.setTotal(Long.valueOf(collect.size()));
}
// if (pageReqVO.getInspectionsStatus() != null) {
// final List<EnterpriseInspectionsDO> collect = enterpriseInspectionsDOPageResult.getList().stream().filter(item -> item.getInspectionStatus() == pageReqVO.getInspectionsStatus()).collect(Collectors.toList());
// enterpriseInspectionsDOPageResult.setList(collect);
// enterpriseInspectionsDOPageResult.setTotal(Long.valueOf(collect.size()));
// }
return enterpriseInspectionsDOPageResult;
}

55
yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterpriseinspections/EnterpriseInspections.xml

@ -38,4 +38,59 @@
ei.enterprise_id = #{params.enterpriseId} and il.inspections_id is NOT NULL
</select>
<select id="inspectionsByLogStatus"
resultType="cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.EnterpriseInspectionsDO">
SELECT ei.*
FROM enterprise_inspections ei
LEFT JOIN inspections_log il
ON il.id = (
SELECT MAX(id)
FROM inspections_log
WHERE inspections_id = ei.id
)
<!-- 将过滤条件移至LEFT JOIN的ON子句中 -->
<where>
ei.deleted = 0
<if test="params.inspectionsStatus != null and params.inspectionsStatus != ''">
AND il.status = #{params.inspectionsStatus}
</if>
<if test="params.userId != null">
AND ei.user_id = #{params.userId}
</if>
<if test="params.enterpriseId != null">
AND ei.enterprise_id = #{params.enterpriseId}
</if>
<if test="params.enterpriseList != null">
AND ei.enterprise_id in
<foreach collection="params.enterpriseList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.createTime != null and params.createTime.length > 0">
AND ei.create_time BETWEEN
<foreach collection="params.createTime" item="item" open="" separator="and" close="">
#{item}
</foreach>
</if>
<if test="params.enterpriseList != null and params.enterpriseList.length > 0">
AND ei.enterprise_id IN
<foreach collection="params.enterpriseList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.taskList != null and params.taskList.size() > 0">
AND ei.task_id IN
<foreach collection="params.taskList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.userIds != null and params.userIds.size() > 0">
AND ei.user_id IN
<foreach collection="params.userIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
ORDER BY ei.id DESC
</select>
</mapper>

8
yudao-server/src/main/resources/application-local.yaml

@ -1,5 +1,5 @@
server:
port: 48080
port: 48088
--- #################### 数据库相关配置 ####################
spring:
@ -46,7 +46,7 @@ spring:
primary: master
datasource:
master:
url: jdbc:mysql://188.188.3.232:3306/huanbao?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
url: jdbc:mysql://82.156.141.150:3306/huanbao?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true # MySQL Connector/J 5.X 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
@ -54,8 +54,8 @@ spring:
# url: jdbc:dm://127.0.0.1:5236?schema=RUOYI_VUE_PRO # DM 连接的示例
# url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例
username: root
password: 123456
username: huanbao
password: DF64GBXeC4TkZcAP
slave: # 模拟从库,可根据自己需要修改
lazy: true # 开启懒加载,保证启动速度
url: jdbc:mysql://192.168.2.5:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true

Loading…
Cancel
Save