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); //处理信息