From 4d776020103ba37a29ea6712d5150ce5ac476a39 Mon Sep 17 00:00:00 2001 From: nixj Date: Fri, 7 Jun 2024 10:08:00 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90add=E3=80=91=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E3=80=81=E8=A1=8C=E7=A8=8B=E9=83=A8=E5=88=86=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9D=83=E9=99=90=E9=80=BB=E8=BE=91=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/query/ItineraryPageQuery.java | 2 ++ .../JdbcOrderExceedStandardRepository.java | 4 +++- .../JdbcConsumptionDetailRepositoryImpl.java | 4 +++- .../service/impl/ManageServiceImpl.java | 21 +++++++++++++++++-- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/chint/manage/entity/query/ItineraryPageQuery.java b/src/main/java/com/chint/manage/entity/query/ItineraryPageQuery.java index 4d7e7639..5511003a 100644 --- a/src/main/java/com/chint/manage/entity/query/ItineraryPageQuery.java +++ b/src/main/java/com/chint/manage/entity/query/ItineraryPageQuery.java @@ -1,6 +1,7 @@ package com.chint.manage.entity.query; import com.chint.domain.value_object.BaseQuery; +import com.chint.infrastructure.util.PageResult; import lombok.Data; import java.util.ArrayList; @@ -11,4 +12,5 @@ public class ItineraryPageQuery extends BaseQuery { private String applicant="";// 申请人 private String actualOrderNo=""; //申请单号 private List userIds=new ArrayList<>(); + private List routeIds; } diff --git a/src/main/java/com/chint/manage/mapper/JdbcOrderExceedStandardRepository.java b/src/main/java/com/chint/manage/mapper/JdbcOrderExceedStandardRepository.java index 69a4d6da..b7cdff16 100644 --- a/src/main/java/com/chint/manage/mapper/JdbcOrderExceedStandardRepository.java +++ b/src/main/java/com/chint/manage/mapper/JdbcOrderExceedStandardRepository.java @@ -9,6 +9,8 @@ import org.springframework.data.jdbc.repository.query.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public interface JdbcOrderExceedStandardRepository extends CrudRepository { @@ -16,5 +18,5 @@ public interface JdbcOrderExceedStandardRepository extends CrudRepository findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContains(String applicant, String company, String actualOrderNo, String orderNo, Pageable pageable); + Page findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContainsAndOrderNoIn(String applicant, String company, String actualOrderNo, String orderNo, List orderNos, Pageable pageable); } diff --git a/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java b/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java index c2c56892..10a8909b 100644 --- a/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java +++ b/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java @@ -55,7 +55,7 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai @Override public Page itineraryPageQueryByDto(ItineraryPageQuery dto) { String query = "SELECT * FROM route_order " + - "WHERE 1 = 1 " + + "WHERE route_id IN (:routeIds) " + "AND (:actualOrderNo IS NULL OR actual_order_no = :actualOrderNo ) "; if (!dto.getUserIds().isEmpty()) { @@ -69,6 +69,7 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai } params.put("actualOrderNo", dto.getActualOrderNo()); params.put("userIds", dto.getUserIds()); + params.put("routeIds", dto.getRouteIds()); PageRequest pageRequest = PageRequest .of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("route_id").descending()); params.put("offset", pageRequest.getOffset()); @@ -89,6 +90,7 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai if (orderIds==null||orderIds.isEmpty()) { return PageResult.totalPageNum(0, new ArrayList<>()); } + PageRequest pageRequest = PageRequest .of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending()); Page data=new PageImpl<>(Collections.emptyList()); diff --git a/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java b/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java index 062a557e..1692ce8b 100644 --- a/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java +++ b/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java @@ -22,6 +22,7 @@ import com.chint.manage.mapper.JdbcOrderDownloadRecordRepository; import com.chint.manage.mapper.JdbcOrderExceedStandardRepository; import com.chint.manage.mapper.impl.JdbcConsumptionDetailRepositoryImpl; import com.chint.manage.service.ManageService; +import com.chint.manage.util.BaseUtil; import com.chint.manage.util.ExcelUtil; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -57,6 +58,8 @@ public class ManageServiceImpl implements ManageService { private JdbcUserRepository jdbcUserRepository; @Autowired private JdbcOrderDownloadRecordRepository jdbcOrderDownloadRecordRepository; + @Autowired + private BaseUtil baseUtil; @Override public PageResult pageConsumptionDetail(ConsumptionDetailQuery dto) { @@ -70,12 +73,19 @@ public class ManageServiceImpl implements ManageService { @Override public PageResult standardQuery(StandardQuery dto) { + //数据权限 + List orderNos=baseUtil.getOrderNos(); + if (orderNos==null||orderNos.isEmpty()) { + return PageResult.totalPageNum(0, new ArrayList<>()); + } + PageRequest pageRequest = PageRequest .of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending()); - Page page=jdbcOrderExceedStandardRepository.findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContains(dto.getApplicant(), + Page page=jdbcOrderExceedStandardRepository.findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContainsAndOrderNoIn(dto.getApplicant(), dto.getCompanyName(), dto.getActualOrderNo(), dto.getOrderNo(), + orderNos, pageRequest); List excelList = getOrderExceedStandardExcels(page); @@ -89,13 +99,20 @@ public class ManageServiceImpl implements ManageService { @Override public PageResult itineraryPageQuery(ItineraryPageQuery dto) { + //数据权限 + List routeIds=baseUtil.getRouteIds(); + if (routeIds==null||routeIds.isEmpty()) { + return PageResult.totalPageNum(0, new ArrayList<>()); + } + List users=new ArrayList<>(); if (!dto.getApplicant().isEmpty()){ users=jdbcUserRepository.findAllByNameContains(dto.getApplicant()); if (users==null||users.isEmpty()){ - return null; + return PageResult.totalPageNum(0, new ArrayList<>()); } } + dto.setRouteIds(routeIds); dto.setUserIds(users.stream().map(User::getEmployeeNo).toList()); Page page= jdbcConsumptionDetailRepository.itineraryPageQueryByDto(dto); //处理信息