| | |
| | | package com.tcm.training.admin.agent.service; |
| | | |
| | | import cn.idev.excel.FastExcel; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | if (trim(regionCode) != null) { |
| | | List<Long> ids = new ArrayList<Long>(); |
| | | for (AgentRegion region : regionMapper.selectList(new LambdaQueryWrapper<AgentRegion>() |
| | | .eq(AgentRegion::getRegionCode, trim(regionCode)))) ids.add(region.getAgentId()); |
| | | if (ids.isEmpty()) return emptyPage(page, pageSize); |
| | | .eq(AgentRegion::getRegionCode, trim(regionCode)))) |
| | | ids.add(region.getAgentId()); |
| | | if (ids.isEmpty()) { |
| | | return emptyPage(page, pageSize); |
| | | } |
| | | query.in(ProvincialAgent::getId, ids); |
| | | } |
| | | if (trim(clinicName) != null) { |
| | |
| | | .like(Clinic::getName, trim(clinicName)))) { |
| | | if (clinic.getAgentId() != null && !ids.contains(clinic.getAgentId())) ids.add(clinic.getAgentId()); |
| | | } |
| | | if (ids.isEmpty()) return emptyPage(page, pageSize); |
| | | if (ids.isEmpty()) { |
| | | return emptyPage(page, pageSize); |
| | | } |
| | | query.in(ProvincialAgent::getId, ids); |
| | | } |
| | | IPage<ProvincialAgent> result = agentMapper.selectPage(new Page<ProvincialAgent>(page, pageSize), query); |
| | |
| | | private PageResponse<ProvincialAgentListItemVO> emptyPage(int page, int pageSize) { |
| | | return PageResponse.of(new ArrayList<ProvincialAgentListItemVO>(), 0, page, pageSize); |
| | | } |
| | | |
| | | public ProvincialAgentDetailVO detail(Long id) { |
| | | return toDetail(require(id)); |
| | | } |