From 3a1c57b161b6a67c6ae1ba562559b99ab0d7a86b Mon Sep 17 00:00:00 2001 From: duwenyuan <15600000461@163.com> Date: Wed, 8 Jul 2026 15:15:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BA=A7=E8=81=94=E7=AC=A6?= =?UTF-8?q?=E5=90=88=E6=A0=A1=E6=AD=A3=E5=9B=A0=E5=AD=90=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jeecg-module-monitor-info-database/pom.xml | 6 + ...GardsCorrectionFactorDetailController.java | 217 ++++++++++++++++ .../GardsCorrectionFactorEffController.java | 234 ++++++++++++++++++ .../GardsCorrectionFactorDetailService.java | 28 +++ .../GardsCorrectionFactorEffService.java | 59 +++++ ...ardsCorrectionFactorDetailServiceImpl.java | 58 +++++ .../GardsCorrectionFactorEffServiceImpl.java | 87 +++++++ 7 files changed, 689 insertions(+) create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsCorrectionFactorDetailController.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsCorrectionFactorEffController.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsCorrectionFactorDetailService.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsCorrectionFactorEffService.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsCorrectionFactorDetailServiceImpl.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsCorrectionFactorEffServiceImpl.java diff --git a/jeecg-module-monitor-info-database/pom.xml b/jeecg-module-monitor-info-database/pom.xml index b52058d..6108559 100644 --- a/jeecg-module-monitor-info-database/pom.xml +++ b/jeecg-module-monitor-info-database/pom.xml @@ -23,5 +23,11 @@ jeecg-boot-base-core ${jeecgboot.version} + + io.swagger + swagger-annotations + 1.6.6 + compile + \ No newline at end of file diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsCorrectionFactorDetailController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsCorrectionFactorDetailController.java new file mode 100644 index 0000000..d78880c --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsCorrectionFactorDetailController.java @@ -0,0 +1,217 @@ +package org.jeecg.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import io.swagger.v3.oas.annotations.Operation; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactorDetail; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactorEff; +import org.jeecg.modules.base.vo.DetectorMapDTO; +import org.jeecg.modules.base.vo.GardsCorrectionFactorDetailVO; +import org.jeecg.modules.base.vo.GardsCorrectionFactorEffVO; +import org.jeecg.service.GardsCorrectionFactorDetailService; +import org.jeecg.service.GardsCorrectionFactorEffService; +import org.jeecgframework.poi.excel.ExcelExportUtil; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.entity.enmus.ExcelType; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 级联符合校正因子库--校正因子 + */ +@Slf4j +@RestController +@RequestMapping("/gardsCorrectionFactorDetail") +public class GardsCorrectionFactorDetailController { + final short titleHeight = 8; + @Autowired + private GardsCorrectionFactorDetailService detailService; + @Autowired + private GardsCorrectionFactorEffService effService; + + /** + * 分页查询 + */ + @GetMapping("/page") + @Operation(summary = "分页查询") + public Result> list( + @RequestParam(defaultValue = "1") int pageNum, + @RequestParam(defaultValue = "10") int size, + @RequestParam(required = false)String stationCode, + @RequestParam(required = false)String detectorCode, + @RequestParam(required = false)String nuclideName) { + return Result.ok( + detailService.findPage(pageNum, size, stationCode, detectorCode, nuclideName)); + } + + /** + * 添加 + * + * @param detail + * @return + */ + @PostMapping("/add") + @Operation(summary = "添加") + public Result add(@RequestBody GardsCorrectionFactorDetail detail) { + return Result.ok(detailService.save(detail)); + } + + /** + * 更新 + * + * @param detail + * @return + */ + @PutMapping("/update") + @Operation(summary = "更新") + public Result update(@RequestBody GardsCorrectionFactorDetail detail) { + return Result.ok(detailService.updateById(detail)); + } + + /** + * 删除 + * + * @param id + * @return + */ + @DeleteMapping("/delete") + @Operation(summary = "删除") + public Result delete(@RequestParam(name = "id") Integer id) { + return Result.ok(detailService.removeById(id)); + } + + @AutoLog(value = "导出模版") + @Operation(summary = "导出模版") + @GetMapping("/exportTemplate") + public void exportTemplate(HttpServletResponse response) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("探测器模拟及联符合校正因子信息"); + params.setFixedTitle(true); + params.setTitleHeight(titleHeight); + params.setType(ExcelType.XSSF); + ExcelExportUtil.exportExcel(params, GardsCorrectionFactorDetailVO.class, new ArrayList<>()) + .write(response.getOutputStream()); + } + + @AutoLog(value = "导出Excel") + @Operation(summary = "导出校正因子Excel") + @GetMapping("/exportExcel") + public void exportExcel(HttpServletResponse response, + @RequestParam(required = false) String stationCode, + @RequestParam(required = false) String detectorCode, + @RequestParam(required = false) String nuclideName) + throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("探测器模拟及联符合校正因子信息"); + params.setFixedTitle(true); + params.setTitleHeight(titleHeight); + params.setType(ExcelType.XSSF); + + List list = detailService.findList( + stationCode, detectorCode, nuclideName); + ExcelExportUtil.exportExcel(params, GardsCorrectionFactorDetailVO.class, list) + .write(response.getOutputStream()); + } + + + /** + * 通过excel导入数据 + * + * @param request + * @return + */ + @AutoLog(value = "导入GardsAccelerator数据") + @PostMapping(value = "/importExcel") + public Result importExcel(HttpServletRequest request) { + // 1. 获取上传文件 + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map fileMap = multipartRequest.getFileMap(); + + // 2. 遍历文件进行处理 + for (Map.Entry entity : fileMap.entrySet()) { + // 获取上传文件对象 + MultipartFile file = entity.getValue(); + ImportParams params = new ImportParams(); + // 设置标题行行数(通常为1,如果没有标题填0) + params.setTitleRows(1); + // 设置表头行数(通常为1) + params.setHeadRows(1); + params.setNeedSave(true); + + try { + // 3. 使用 AutoPoi 工具类解析 Excel + List list = + ExcelImportUtil.importExcel(file.getInputStream(), + GardsCorrectionFactorDetailVO.class, params); + + // 预加载映射关系 (Key: Code, Value: DTO) + // SQL: SELECT DETECTOR_ID, DETECTOR_CODE, STATION_ID FROM GARDS_DETECTORS + Map refMap = effService.queryAllDetectorRef().stream() + .collect(Collectors.toMap(DetectorMapDTO::getDetectorCode, d -> d, + (k1, k2) -> k1)); + + // 转换GardsCorrectionFactorDetail并保存 + List entityList = new ArrayList<>(); + + for (GardsCorrectionFactorDetailVO vo : list) { + if (StringUtils.isEmpty(vo.getDetectorCode())) { + continue; + } + + // 根据 Excel 里的探测器代码获取数据库 ID + DetectorMapDTO ref = refMap.get(vo.getDetectorCode().trim()); + + if (ref == null) { + return Result.error( + "导入中止:系统中不存在探测器代码 [" + vo.getDetectorCode() + "]"); + } + GardsCorrectionFactorDetail effEntity = new GardsCorrectionFactorDetail(); + BeanUtils.copyProperties(vo, effEntity); + // 填充两个关联 ID + effEntity.setDetectorId(ref.getDetectorId()); + effEntity.setStationId(ref.getStationId()); + entityList.add(effEntity); + } + + // 4. 批量保存数据到数据库 + if (!CollectionUtils.isEmpty(entityList)) { + + //detailService.saveBatch(entityList); + + + entityList.forEach(item -> detailService.save(item)); + } + return Result.OK("文件导入成功!数据行数:" + list.size()); + } catch (Exception e) { + return Result.error("文件导入失败:" + e.getMessage()); + } finally { + try { + file.getInputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return Result.error("文件导入失败!"); + } + + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsCorrectionFactorEffController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsCorrectionFactorEffController.java new file mode 100644 index 0000000..2c596c3 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsCorrectionFactorEffController.java @@ -0,0 +1,234 @@ +package org.jeecg.controller; + +import io.swagger.v3.oas.annotations.Operation; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactorEff; +import org.jeecg.modules.base.vo.DetectorMapDTO; +import org.jeecg.modules.base.vo.DetectorOptionVO; +import org.jeecg.modules.base.vo.GardsCorrectionFactorEffVO; +import org.jeecg.modules.base.vo.StationOptionVO; +import org.jeecg.service.GardsCorrectionFactorEffService; +import org.jeecgframework.poi.excel.ExcelExportUtil; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.entity.enmus.ExcelType; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 级联符合校正因子库--峰效率 + */ +@Slf4j +@RestController +@RequestMapping("/gardsCorrectionFactorEff") +public class GardsCorrectionFactorEffController { + private final short titleHeight = 8; + @Autowired + private GardsCorrectionFactorEffService effService; + + /** + * 分页查询 + */ + @GetMapping("/page") + @Operation(summary = "分页查询") + public Result list(@RequestParam(defaultValue = "1") int pageNum, + @RequestParam(defaultValue = "10") int size, + @RequestParam(required = false) String stationCode, + @RequestParam(required = false) String detectorCode) { + return Result.OK(effService.findPage(pageNum, size, stationCode, detectorCode)); + } + + /** + * 添加 + * + * @param eff 实体 + * @return Result + */ + @PostMapping("/add") + @Operation(summary = "添加") + public Result add(@RequestBody GardsCorrectionFactorEff eff) { + + return Result.OK(effService.add(eff)); + } + + /** + * 更新 + * + * @param eff 实体 + * @return Result + */ + @PutMapping("/update") + @Operation(summary = "更新") + public Result update(@RequestBody GardsCorrectionFactorEff eff) { + return Result.OK(effService.update(eff)); + } + + /** + * 删除 + * + * @param id 主键ID + * @return Result + */ + @DeleteMapping("/delete") + @Operation(summary = "删除") + public Result delete(@RequestParam(name = "id") Integer id) { + effService.delete(id); + return Result.OK(); + } + + + @AutoLog(value = "导出模版") + @Operation(summary = "导出模版") + @GetMapping("/exportTemplate") + public void exportTemplate(HttpServletResponse response) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("探测器模拟及联符合校正因子信息"); + params.setFixedTitle(true); + params.setTitleHeight(titleHeight); + params.setType(ExcelType.XSSF); + ExcelExportUtil.exportExcel(params, GardsCorrectionFactorEffVO.class, new ArrayList<>()) + .write(response.getOutputStream()); + } + + @AutoLog(value = "导出Excel") + @Operation(summary = "导出校正因子Excel") + @GetMapping("/exportExcel") + public void exportExcel(HttpServletResponse response, + @RequestParam(required = false) String stationCode, + @RequestParam(required = false) String detectorCode) + throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("探测器模拟及联符合校正因子效率信息"); + params.setFixedTitle(true); + params.setTitleHeight(titleHeight); + params.setType(ExcelType.XSSF); + + List list = effService.selectVOList( + stationCode, detectorCode); + ExcelExportUtil.exportExcel(params, GardsCorrectionFactor.class, list) + .write(response.getOutputStream()); + } + + + /** + * 通过excel导入数据 + * + * @param request + * @return + */ + @AutoLog(value = "导入GardsAccelerator数据") + @PostMapping(value = "/importExcel") + public Result importExcel(HttpServletRequest request) { + // 1. 获取上传文件 + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map fileMap = multipartRequest.getFileMap(); + + // 2. 遍历文件进行处理 + for (Map.Entry entity : fileMap.entrySet()) { + // 获取上传文件对象 + MultipartFile file = entity.getValue(); + ImportParams params = new ImportParams(); + // 设置标题行行数(通常为1,如果没有标题填0) + params.setTitleRows(1); + // 设置表头行数(通常为1) + params.setHeadRows(1); + params.setNeedSave(true); + + try { + // 使用 AutoPoi 工具类解析 Excel + List voList = + ExcelImportUtil.importExcel(file.getInputStream(), + GardsCorrectionFactorEffVO.class, params); + + if (!CollectionUtils.isEmpty(voList)) { + + // 预加载映射关系 (Key: Code, Value: DTO) + // SQL: SELECT DETECTOR_ID, DETECTOR_CODE, STATION_ID FROM GARDS_DETECTORS + Map refMap = effService.queryAllDetectorRef().stream() + .collect(Collectors.toMap(DetectorMapDTO::getDetectorCode, d -> d, + (k1, k2) -> k1)); + + // 转换GardsCorrectionFactorEff并保存 + List entityList = new ArrayList<>(); + + for (GardsCorrectionFactorEffVO vo : voList) { + if (StringUtils.isEmpty(vo.getDetectorCode())) { + continue; + } + + // 根据 Excel 里的探测器代码获取数据库 ID + DetectorMapDTO ref = refMap.get(vo.getDetectorCode().trim()); + + if (ref == null) { + return Result.error( + "导入中止:系统中不存在探测器代码 [" + vo.getDetectorCode() + + "]"); + } + GardsCorrectionFactorEff effEntity = new GardsCorrectionFactorEff(); + BeanUtils.copyProperties(vo, effEntity); + // 填充两个关联 ID + effEntity.setDetectorId(ref.getDetectorId()); + effEntity.setStationId(ref.getStationId()); + entityList.add(effEntity); + } + // 4. 批量保存数据到数据库 + if (!CollectionUtils.isEmpty(entityList)) { + entityList.forEach(item -> effService.save(item)); + + //effService.saveBatch(entityList); + } + return Result.OK("文件导入成功!数据行数:" + entityList.size()); + } + + } catch (Exception e) { + return Result.error("文件导入失败:" + e.getMessage()); + } finally { + try { + file.getInputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return Result.error("文件导入失败!"); + } + + @AutoLog(value = "获取站点列表") + + + // 下拉框:站点 + @GetMapping("/stations") + public List getStations() { + return effService.getStationOptions(); + } + + // 根据站点 ID 过滤探测器 + @AutoLog(value = "获取探测器") + @GetMapping("/detectors") + public List getDetectors(@RequestParam(value = "stationId",required = false) Long stationId) { + if (stationId == null) { + return Collections.emptyList(); + } + return effService.getDetectorOptions(stationId); + } + + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsCorrectionFactorDetailService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsCorrectionFactorDetailService.java new file mode 100644 index 0000000..74a1e0f --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsCorrectionFactorDetailService.java @@ -0,0 +1,28 @@ +package org.jeecg.service; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactorDetail; +import org.jeecg.modules.base.vo.GardsCorrectionFactorDetailVO; + +import java.util.List; +import java.util.Map; + +public interface GardsCorrectionFactorDetailService extends IService { + + IPage findPage(Integer pageNum, Integer pageSize, + String stationCode, String detectorCode, String nuclideName); + + List findList(String stationCode, String detectorCode, String nuclideName); + + + List>selectStations(); + + List>selectdetectors(); + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsCorrectionFactorEffService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsCorrectionFactorEffService.java new file mode 100644 index 0000000..dd68ee0 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsCorrectionFactorEffService.java @@ -0,0 +1,59 @@ +package org.jeecg.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactorEff; +import org.jeecg.modules.base.vo.*; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.stream.Collectors; + +public interface GardsCorrectionFactorEffService extends IService { + IPage findPage(Integer pageNum, Integer pageSize, + String stationCode, String detectorCode); + + + /** + * 添加 + */ + + boolean add(GardsCorrectionFactorEff entity); + + /** + * 修改 + * + * @param entity + * @return + */ + boolean update(GardsCorrectionFactorEff entity); + + /** + * 删除 + * + * @param id 主键ID + * @return + */ + boolean delete(Integer id); + + + /** + * 导出数据 + * + * @param stationCode 台站编码 + * @param detectorCode 探测器编码 + * @return List + */ + List selectVOList(String stationCode, String detectorCode); + + List queryAllDetectorRef(); + + + // 获取所有站点 + List getStationOptions(); + + // 根据站点联动获取探测器 + List getDetectorOptions(Long stationId); + + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsCorrectionFactorDetailServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsCorrectionFactorDetailServiceImpl.java new file mode 100644 index 0000000..d568d28 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsCorrectionFactorDetailServiceImpl.java @@ -0,0 +1,58 @@ +package org.jeecg.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactorDetail; +import org.jeecg.modules.base.mapper.GardsCorrectionFactorDetailMapper; +import org.jeecg.modules.base.mapper.GardsCorrectionFactorMapper; +import org.jeecg.service.GardsCorrectionFactorDetailService; +import org.jeecg.modules.base.vo.GardsCorrectionFactorDetailVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.util.List; +import java.util.Map; + +@Service +@DS("ora") +public class GardsCorrectionFactorDetailServiceImpl + extends ServiceImpl + implements GardsCorrectionFactorDetailService { + @Autowired + private GardsCorrectionFactorMapper factorMapper; + + @Override + public IPage findPage(Integer pageNum, Integer pageSize, + String stationCode, String detectorCode, String nuclideName) { + Page page = new Page<>(pageNum, pageSize); + // 对应界面顶部的搜索框逻辑 + + return baseMapper.selectCombinedPage(page, stationCode,detectorCode,nuclideName); + } + + @Override + public List findList(String stationCode, String detectorCode, String nuclideName) { + + return baseMapper.findList(stationCode,detectorCode,nuclideName); + + } + + @Override + public List> selectStations() { + List> stations= baseMapper.selectStations(); + return stations; + } + + @Override + public List> selectdetectors() { + List> detectors= baseMapper.selectdetectors(); + return detectors; + } + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsCorrectionFactorEffServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsCorrectionFactorEffServiceImpl.java new file mode 100644 index 0000000..209e8c3 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsCorrectionFactorEffServiceImpl.java @@ -0,0 +1,87 @@ +package org.jeecg.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactorDetail; +import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactorEff; +import org.jeecg.modules.base.mapper.GardsCorrectionFactorEffMapper; +import org.jeecg.modules.base.vo.*; +import org.jeecg.service.GardsCorrectionFactorEffService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.StringUtils; + +import java.util.List; +import java.util.stream.Collectors; + +@Service +@DS("ora") +public class GardsCorrectionFactorEffServiceImpl + extends ServiceImpl + implements GardsCorrectionFactorEffService { + + @Override + public IPage findPage(Integer pageNum, Integer pageSize, + String stationCode, String detectorCode) { + Page page = new Page<>(pageNum, pageSize); + + return baseMapper.selectCombinedPage(page, stationCode, detectorCode); + } + + + // 增加 (增) + @Transactional + public boolean add(GardsCorrectionFactorEff entity) { + return this.save(entity); + } + + // 修改 (改) + @Transactional + public boolean update(GardsCorrectionFactorEff entity) { + return this.updateById(entity); + } + + // 删除 (删) + @Transactional + public boolean delete(Integer id) { + return this.removeById(id); + } + + /** + * 导出数据 + * @param stationCode 台站编码 + * @param detectorCode 探测器编码 + * @return List + */ + public List selectVOList(String stationCode, String detectorCode) { + return baseMapper.selectVOList(stationCode, detectorCode); + + } + + @Override + public List queryAllDetectorRef() { + return baseMapper.queryAllDetectorRef(); + } + + + // 获取所有站点 + public List getStationOptions() { + return baseMapper.getStationOptions().stream() + .map(s -> new StationOptionVO(s.getStationId(), s.getStationCode())) + .collect(Collectors.toList()); + } + + // 根据站点联动获取探测器 + public List getDetectorOptions(Long stationId) { + return baseMapper.getDetectorOptions(stationId).stream() + .map(d -> new DetectorOptionVO(d.getDetectorId(), d.getDetectorCode())) + .collect(Collectors.toList()); + } + + + + +}