From 1f6067deb52e3eb62c95bb32706661c11b0e6eae Mon Sep 17 00:00:00 2001 From: duwenyuan <15600000461@163.com> Date: Sun, 28 Dec 2025 20:59:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=A0=E5=90=88=E5=B3=B0?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GardsNuclearReleaseRecords.java | 4 +- .../configuration/GardsNuclearfacility.java | 24 ++- .../configuration/GardsResearchReactors.java | 2 +- .../configuration/GardsSummationPeak.java | 33 ++++ .../base/mapper/GardsSummationPeakMapper.java | 9 + .../impl/SampleStatAnalysisService.java | 77 ++++---- .../GardsSummationPeakController.java | 179 ++++++++++++++++++ .../service/GardsSummationPeakService.java | 56 ++++++ .../impl/GardsSummationPeakServiceImpl.java | 130 +++++++++++++ 9 files changed, 463 insertions(+), 51 deletions(-) create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsSummationPeak.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsSummationPeakMapper.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsSummationPeakController.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsSummationPeakService.java create mode 100644 jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsSummationPeakServiceImpl.java diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearReleaseRecords.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearReleaseRecords.java index 94e04f7..2374d48 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearReleaseRecords.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearReleaseRecords.java @@ -53,7 +53,7 @@ public class GardsNuclearReleaseRecords implements Serializable { /** * 开始时间 */ - @Excel(name = "开始时间", format = "yyyy-MM-dd HH:mm:ss", width = 20, height = 20, orderNum = "3") + @Excel(name = "开始时间", format = "yyyy-MM-dd", width = 20, height = 20, orderNum = "3") @TableField(value = "START_TIME", fill = FieldFill.INSERT_UPDATE) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @@ -61,7 +61,7 @@ public class GardsNuclearReleaseRecords implements Serializable { /** * 结束时间 */ - @Excel(name = "结束时间", format = "yyyy-MM-dd HH:mm:ss", width = 20, height = 20, orderNum = "4") + @Excel(name = "结束时间", format = "yyyy-MM-dd", width = 20, height = 20, orderNum = "4") @TableField(value = "END_TIME", fill = FieldFill.INSERT_UPDATE) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearfacility.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearfacility.java index 63d57eb..5464f1e 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearfacility.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsNuclearfacility.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.util.Date; @@ -21,48 +22,50 @@ public class GardsNuclearfacility implements Serializable { /** * 核设施名称 */ + @Excel(name = "核设施名称", width = 20,height = 20,orderNum="0") @TableField(value = "FACILITY_NAME") private String facilityName; /** * 核设施类型 */ + @Excel(name = "核设施类型", width = 20,height = 20,orderNum="1") @TableField(value = "TYPE") private String type; /** * 地点 */ + @Excel(name = "地点", width = 20,height = 20,orderNum="2") @TableField(value = "LOCATION") private String location; /** * 经度 */ + @Excel(name = "经度", width = 20,height = 20,orderNum="3") @TableField(value = "LONGITUDE") private String longitude; - @TableField(exist = false) - private Double lonValue; - /** * 纬度 */ + @Excel(name = "纬度", width = 20,height = 20,orderNum="4") @TableField(value = "LATITUDE") private String latitude; - @TableField(exist = false) - private Double latValue; /** * 状态 */ + @Excel(name = "状态", width = 20,height = 20,orderNum="5") @TableField(value = "STATUS") private String status; /** * 修建时间 */ + @Excel(name = "修建时间",format = "yyyy-MM-dd", width = 20,height = 20,orderNum="6") @TableField(value = "BUILDDATE") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @@ -71,6 +74,7 @@ public class GardsNuclearfacility implements Serializable { /** * 临界时间 */ + @Excel(name = "临界时间",format = "yyyy-MM-dd", width = 20,height = 20,orderNum="7") @TableField(value = "CRITICALITYDATE") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @@ -79,6 +83,7 @@ public class GardsNuclearfacility implements Serializable { /** * 退休时间 */ + @Excel(name = "退休时间", format = "yyyy-MM-dd",width = 20,height = 20,orderNum="8") @TableField(value = "RETIREDATE") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @@ -87,6 +92,7 @@ public class GardsNuclearfacility implements Serializable { /** * 网格工程日期 */ + @Excel(name = "并网时间",format = "yyyy-MM-dd", width = 20,height = 20,orderNum="9") @TableField(value = "GRIDCONEETIONDATE") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @@ -95,48 +101,56 @@ public class GardsNuclearfacility implements Serializable { /** * 销售公司 */ + @Excel(name = "所属公司", width = 20,height = 20,orderNum="10") @TableField(value = "VENDOR") private String vendor; /** * 拥有者 */ + @Excel(name = "拥有者", width = 20,height = 20,orderNum="11") @TableField(value = "OWNER") private String owner; /** * 操作人员 */ + @Excel(name = "操作人员", width = 20,height = 20,orderNum="12") @TableField(value = "OPERARTOR") private String operartor; /** * 容量 */ + @Excel(name = "容量", width = 20,height = 20,orderNum="13") @TableField(value = "CAPACITYGROSS") private Integer capacitygross; /** * 容量集 */ + @Excel(name = "容量集", width = 20,height = 20,orderNum="14") @TableField(value = "CAPACITYNET") private Integer capacitynet; /** * 热容量 */ + @Excel(name = "热容量", width = 20,height = 20,orderNum="15") @TableField(value = "CAPACITYTHERMAL") private Integer capacitythermal; /** * 活动时间 */ + @Excel(name = "活动时间", width = 20,height = 20,orderNum="16") @TableField(value = "ACTIVITY_DAY") private Integer activityDay; /** * 活动年份 */ + @Excel(name = "活动年份", width = 20,height = 20,orderNum="17") @TableField(value = "ACTIVITY_YEAR") private Integer activityYear; diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsResearchReactors.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsResearchReactors.java index d76bd6e..fa76480 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsResearchReactors.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsResearchReactors.java @@ -87,7 +87,7 @@ public class GardsResearchReactors implements Serializable { /** * 首次临界日期 */ - @Excel(name = "首次临界日期", width = 20,height = 20,orderNum="8") + @Excel(name = "首次临界日期", format = "yyyy-MM-dd", width = 20,height = 20,orderNum="8") @TableField(value = "FIRST_CRITICALITY_DATE") @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsSummationPeak.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsSummationPeak.java new file mode 100644 index 0000000..9d9aa07 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/configuration/GardsSummationPeak.java @@ -0,0 +1,33 @@ +package org.jeecg.modules.base.entity.configuration; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; + +import java.io.Serializable; +import java.util.Date; + +/** + * 加合峰信息实体类 + * 对应表名:CONFIGURATION.GARDS_SUMMATION_PEAK + */ +@Data +@TableName("CONFIGURATION.GARDS_SUMMATION_PEAK") +public class GardsSummationPeak implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "ID", type = IdType.AUTO) + private Long id; + + @TableField("NUCLIDE") + @Excel(name = "核素名称", width = 20, height = 20, orderNum = "0") + private String nuclide; + + @TableField("ENERGY") + @Excel(name = "能量", width = 20, height = 20, orderNum = "1") + private Double energy; + + @TableField(value = "MODDATE", fill = FieldFill.INSERT_UPDATE) + private Date moddate; +} \ No newline at end of file diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsSummationPeakMapper.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsSummationPeakMapper.java new file mode 100644 index 0000000..76a7cd1 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsSummationPeakMapper.java @@ -0,0 +1,9 @@ +package org.jeecg.modules.base.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.jeecg.modules.base.entity.configuration.GardsSummationPeak; + +@Mapper +public interface GardsSummationPeakMapper extends BaseMapper { +} diff --git a/jeecg-module-data-analyze/src/main/java/org/jeecg/service/impl/SampleStatAnalysisService.java b/jeecg-module-data-analyze/src/main/java/org/jeecg/service/impl/SampleStatAnalysisService.java index 5dc58bb..177247f 100644 --- a/jeecg-module-data-analyze/src/main/java/org/jeecg/service/impl/SampleStatAnalysisService.java +++ b/jeecg-module-data-analyze/src/main/java/org/jeecg/service/impl/SampleStatAnalysisService.java @@ -227,44 +227,6 @@ public class SampleStatAnalysisService extends ServiceImpl> groupedByNuclideName = nuclideActConcIntvlList.stream() .filter(p -> p.getNuclideName() != null) .collect(Collectors.groupingBy(NuclideActConcIntvl::getNuclideName)); - - //查询级别 getSample - List nuclideNames = new ArrayList<>(groupedByNuclideName.keySet()); - if (CollectionUtils.isNotEmpty(nuclideNames)) { - //通过台站ID、核素名称查找阈值 - thresholdResultHisDataList = this.baseMapper.selectByStationAndNuclides(schemaName, Integer.valueOf(stationCode), nuclideNames, startTime, endTime); - - if (CollectionUtils.isNotEmpty(thresholdResultHisDataList)) { - // 构建Map: 复合键 -> 阈值 - Map thresholdMap = new HashMap<>(); - - for (GardsThresholdResultHis threshold : thresholdResultHisDataList) { - // 创建复合键: nuclideName|stationId|collectStop - String key = threshold.getNuclideName() + "|" + - (threshold.getStationId() != null ? Integer.valueOf(threshold.getStationId()) : stationCode) + "|" + - safeGetTime(threshold.getCollectStop()); - thresholdMap.put(key, threshold); - } - - // 设置阈值 - for (NuclideActConcIntvl data : nuclideActConcIntvlList) { - if (data.getNuclideName() == null || data.getCollectStop() == null) { - continue; - } - // 创建相同的复合键 - String dataKey = data.getNuclideName() + "|" + - (data.getStationCode() != null ? Integer.valueOf(data.getStationCode()) : stationCode) + "|" + - data.getCollectStop().getTime(); - - GardsThresholdResultHis threshold = thresholdMap.get(dataKey); - if (threshold != null) { - data.setThresholdValue(threshold.getThresholdValue()); - } - } - } - } - - Map> sortedByCount = groupedByNuclideName.entrySet().stream() .sorted(Map.Entry.>comparingByValue( Comparator.comparingInt(List::size) @@ -275,12 +237,7 @@ public class SampleStatAnalysisService extends ServiceImpl e1, LinkedHashMap::new // 使用 LinkedHashMap )); - - //NuclideStatAnalysisVO vo = getChartData(nuclideActConcIntvlList); - // resultMap.put("nuclideActConcIntvlList", groupedByNuclideName); resultMap.put("nuclideActConcIntvlList", sortedByCount); - // resultMap.put("sampleLevelDataList", vo); - //resultMap.put("thresholdResultHisDataList", thresholdResultHisDataList); result.setSuccess(true); result.setResult(resultMap); return result; @@ -3687,4 +3644,38 @@ public class SampleStatAnalysisService extends ServiceImpl defaultNuclides = defaultNuclideMapper.selectList(queryWrapper); return defaultNuclides; } + + + + + + public static double findMaxValue(List list) { + if (list == null || list.isEmpty()) { + // 处理空集合情况,返回一个默认值 + return 0; + } + + // 初始值设为第一个对象的三个字段中的最大值 + double maxValue = Math.max(list.get(0).getMdc(), + Math.max(list.get(0).getConc(), list.get(0).getThresholdValue())); + + for (NuclideActConcIntvl item : list) { + + Double mdc = item.getMdc(); + Double conc = item.getConc(); + Double thresholdValue = item.getThresholdValue(); + + // 分别比较每个字段,更新最大值 + if (mdc != null && mdc > maxValue) { + maxValue = mdc; + } + if (conc != null && conc > maxValue) { + maxValue = conc; + } + if (thresholdValue != null && thresholdValue > maxValue) { + maxValue = thresholdValue; + } + } + return maxValue; + } } diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsSummationPeakController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsSummationPeakController.java new file mode 100644 index 0000000..7c1cba2 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsSummationPeakController.java @@ -0,0 +1,179 @@ +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.GardsSummationPeak; +import org.jeecg.service.GardsSummationPeakService; +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.factory.annotation.Autowired; +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; + +@RestController +@RequestMapping("/getGardsSummationPeak") +@Slf4j +public class GardsSummationPeakController { + @Autowired + private GardsSummationPeakService gardsSummationPeakService; + + /** + * 新增信息 + */ + @PostMapping("/create") + @Operation(summary = "新增信息") + public Result create(@RequestBody GardsSummationPeak gardsSummationPeak) { + return gardsSummationPeakService.create(gardsSummationPeak); + } + + /** + * 删除信息 + */ + @DeleteMapping("/delete") + @Operation(summary = "删除信息") + public Result deleteById(@RequestParam Integer Id) { + return gardsSummationPeakService.deleteById(Id); + } + + /** + * 更新信息 + */ + @PutMapping("/update") + @Operation(summary = "更新信息") + public Result update(@RequestBody GardsSummationPeak gardsSummationPeak) { + return gardsSummationPeakService.update(gardsSummationPeak); + } + + /** + * 查询信息 + */ + @GetMapping("/queryById") + @Operation(summary = "查询信息") + public Result getById(@RequestParam Integer Id) { + return gardsSummationPeakService.queryById(Id); + } + + /** + * 分页查询 + * + * @param pageNum + * @param pageSize + * @param nuclide 核素名称 + * @return + */ + @GetMapping("/page") + @Operation(summary = "分页查询") + public Result> page( + @RequestParam(defaultValue = "1") Integer pageNum, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String nuclide) { + + return gardsSummationPeakService.page(pageNum, pageSize, nuclide); + } + + /** + * 组合条件查询 + * + * @param nuclide 名称 + * @return + */ + @GetMapping("/search") + @Operation(summary = "组合条件查询") + public Result> search(@RequestParam(required = false) String nuclide ) { + + try { + List list = gardsSummationPeakService.getByConditions(nuclide); + return Result.OK(list); + } catch (Exception e) { + log.error("search: " + e.getMessage()); + return Result.error("查询失败"); + } + + } + + @AutoLog(value = "导出模版") + @Operation(summary = "导出模版") + @GetMapping("/exportTemplate") + public void exportTemplate(HttpServletResponse response) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("加合峰信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + ExcelExportUtil.exportExcel(params, GardsSummationPeak.class, new ArrayList<>()).write(response.getOutputStream()); + } + + @AutoLog(value = "导出Excel") + @Operation(summary = "台站导出Excel") + @GetMapping("/exportExcel") + public void exportExcel(HttpServletResponse response, + @RequestParam(required = false) String nuclide) throws IOException { + ExportParams params = new ExportParams(); + params.setTitle("加合峰信息"); + params.setFixedTitle(true); + params.setTitleHeight((short) 8); + params.setType(ExcelType.XSSF); + List list = gardsSummationPeakService.getByConditions(nuclide); + ExcelExportUtil.exportExcel(params, GardsSummationPeak.class, list).write(response.getOutputStream()); + } + + /** + * 通过excel导入数据 + * + * @param request + * @return + */ + @AutoLog(value = "GardsSummationPeak") + @Operation(summary = "导入数据") + @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(), GardsSummationPeak.class, params); + + // 4. 批量保存数据到数据库 + gardsSummationPeakService.saveBatch(list); + + 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/service/GardsSummationPeakService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsSummationPeakService.java new file mode 100644 index 0000000..e8c9c9a --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsSummationPeakService.java @@ -0,0 +1,56 @@ +package org.jeecg.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.base.entity.configuration.GardsStations; +import org.jeecg.modules.base.entity.configuration.GardsSummationPeak; + +import java.util.List; + +public interface GardsSummationPeakService extends IService { + + /** + * 新增信息 + */ + + Result create(GardsSummationPeak gardsSummationPeak); + + /** + * 删除信息 + */ + Result deleteById(Integer Id); + + /** + * 更新信息 + */ + Result update(GardsSummationPeak gardsSummationPeak); + + /** + * 查询信息 + */ + Result queryById(Integer Id); + + /** + * 分页查询 + * + * @param pageNum + * @param pageSize + * @param nuclide + * @return + */ + Result> page( + Integer pageNum, + Integer pageSize, + String nuclide); + + /** + * 多条件组合查询 + * + * @param nuclide 名称 + * @return List + */ + List getByConditions(String nuclide); + + +} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsSummationPeakServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsSummationPeakServiceImpl.java new file mode 100644 index 0000000..2b748b3 --- /dev/null +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsSummationPeakServiceImpl.java @@ -0,0 +1,130 @@ +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.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.base.entity.configuration.GardsStations; +import org.jeecg.modules.base.entity.configuration.GardsSummationPeak; +import org.jeecg.modules.base.mapper.GardsSummationPeakMapper; +import org.jeecg.service.GardsSummationPeakService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +@Service +@DS("ora") +public class GardsSummationPeakServiceImpl extends ServiceImpl implements GardsSummationPeakService { + /** + * 新增信息 + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result create(GardsSummationPeak gardsSummationPeak) { + try { + + + boolean success = this.save(gardsSummationPeak); + if (success) { + return Result.OK("添加成功", gardsSummationPeak); + } else { + return Result.error("添加失败"); + } + } catch (Exception e) { + log.error("create: " + e.getMessage()); + return Result.error("添加失败"); + } + } + + /** + * 删除信息 + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result deleteById(Integer Id) { + try { + boolean success = this.removeById(Id); + if (success) { + return Result.OK("删除成功"); + } else { + return Result.error("删除失败,可能数据不存在"); + + } + } catch (Exception e) { + log.error("deleteById: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 更新信息 + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result update(GardsSummationPeak gardsSummationPeak) { + try { + boolean success = this.updateById(gardsSummationPeak); + if (success) { + return Result.OK("数据更新成功", gardsSummationPeak); + } else { + return Result.error("数据更新失败"); + + } + } catch (Exception e) { + log.error("update: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 查询信息 + */ + @Override + public Result queryById(Integer Id) { + try { + GardsSummationPeak nuclearReactors = this.getById(Id); + if (nuclearReactors != null) { + return Result.OK(nuclearReactors); + } else { + return Result.error("未找到数据"); + } + } catch (Exception e) { + log.error("getById: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + @Override + public Result> page(Integer pageNum, Integer pageSize, String nuclide) { + try { + Page page = new Page<>(pageNum, pageSize); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (nuclide != null && !nuclide.trim().isEmpty()) { + wrapper.like(GardsSummationPeak::getNuclide, nuclide); + } + wrapper.orderByDesc(GardsSummationPeak::getId); + IPage pageResult = this.page(page, wrapper); + + return Result.OK(pageResult); + } catch (Exception e) { + log.error("page: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + @Override + public List getByConditions(String nuclide) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + + if (nuclide != null && !nuclide.trim().isEmpty()) { + query.like(GardsSummationPeak::getNuclide, nuclide); + } + + query.orderByDesc(GardsSummationPeak::getId); + return this.list(query); + } +}