diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsAcceleratorController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsAcceleratorController.java index 2b2ed21..3dc2960 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsAcceleratorController.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsAcceleratorController.java @@ -7,6 +7,7 @@ import io.swagger.v3.oas.annotations.Operation; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.modules.base.entity.SourceRebuildMonitoringData; @@ -44,17 +45,7 @@ public class GardsAcceleratorController { @Operation(summary = "新增加速器信息") @PostMapping("create") public Result create(@RequestBody GardsAccelerator gardsAccelerator) { - try { - boolean success = gardsAcceleratorService.save(gardsAccelerator); - if (success) { - return Result.OK("添加成功",gardsAccelerator); - } else { - return Result.error("设施信息添加失败"); - } - } catch (Exception e) { - log.error(e.getMessage()); - return Result.error("操作失败"); - } + return gardsAcceleratorService.create(gardsAccelerator); } /** @@ -64,17 +55,7 @@ public class GardsAcceleratorController { @Operation(summary = "删除加速器信息") @DeleteMapping("/delete") public Result delete(@RequestParam Integer id) { - try { - boolean success = gardsAcceleratorService.removeById(id); - if (success) { - return Result.ok("删除成功"); - } else { - return Result.error("设施信息删除失败,可能该记录不存在"); - } - } catch (Exception e) { - log.error(e.getMessage()); - return Result.error("操作失败"); - } + return gardsAcceleratorService.delete(id); } /** @@ -83,17 +64,8 @@ public class GardsAcceleratorController { @Operation(summary = "更新加速器信息") @PutMapping("/update") public Result update(@RequestBody GardsAccelerator gardsAccelerator) { - try { - boolean success = gardsAcceleratorService.updateById(gardsAccelerator); - if (success) { - return Result.OK("设施信息更新成功",gardsAccelerator); - } else { - return Result.error("设施信息更新失败,可能该记录不存在"); - } - } catch (Exception e) { - log.error(e.getMessage()); - return Result.error("操作失败"); - } + return gardsAcceleratorService.update(gardsAccelerator); + } /** @@ -102,17 +74,7 @@ public class GardsAcceleratorController { @Operation(summary = "查询加速器信息") @GetMapping("/queryById") public Result getById(@RequestParam Integer id) { - try { - GardsAccelerator facility = gardsAcceleratorService.getById(id); - if (facility != null) { - return Result.ok(facility); - } else { - return Result.error("未找到对应的设施信息"); - } - } catch (Exception e) { - log.error(e.getMessage()); - return Result.error("查询失败"); - } + return gardsAcceleratorService.queryById(id); } /** @@ -123,120 +85,109 @@ public class GardsAcceleratorController { public Result> page( @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize, - @RequestParam(required = false) String country, + @RequestParam(required = false) String country, @RequestParam(required = false) String facilityName ) { - try { - Page page = new Page<>(pageNum, pageSize); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - - if (facilityName != null && !facilityName.trim().isEmpty()) { - wrapper.eq(GardsAccelerator::getFacilityName, facilityName); - } - if (country != null && !country.trim().isEmpty()) { - wrapper.eq(GardsAccelerator::getCountry, country); - } - IPage pageResult = gardsAcceleratorService.page(page,wrapper); - return Result.ok(pageResult); - } catch (Exception e) { - log.error("分页查询失败: " + e.getMessage()); - return Result.error("分页查询失败"); - } + return gardsAcceleratorService.queryPage(pageNum, pageSize, country, facilityName); } - /** - * 查询所有设施列表 - */ - @Operation(summary = "查询加速器所有信息") - @GetMapping("/list") - public Result> list() { - try { - List list = gardsAcceleratorService.list(); - return Result.ok(list); - } catch (Exception e) { - log.error("查询失败: " + e.getMessage()); - return Result.error("查询失败"); - } - } + //region 注释代码 +// +// /** +// * 查询所有设施列表 +// */ +// @Operation(summary = "查询加速器所有信息") +// @GetMapping("/list") +// public Result> list() { +// try { +// List list = gardsAcceleratorService.list(); +// return Result.ok(list); +// } catch (Exception e) { +// log.error("查询失败: " + e.getMessage()); +// return Result.error("查询失败"); +// } +// } +// +// /** +// * 根据设施代码查询 +// */ +// @Operation(summary = "根据加速器代码查询") +// @GetMapping("/by-facility-code") +// public Result getByFacilityCode(@RequestParam String facilityCode) { +// try { +// GardsAccelerator facility = gardsAcceleratorService.getByFacilityCode(facilityCode); +// if (facility != null) { +// return Result.ok(facility); +// } else { +// return Result.error("未找到设施代码为 " + facilityCode + " 的设施"); +// } +// } catch (Exception e) { +// log.error("查询失败: " + e.getMessage()); +// return Result.error("查询失败"); +// } +// } +// +// /** +// * 根据国家查询 +// */ +// @Operation(summary = "根据加速器国家查询") +// @GetMapping("/by-country") +// public Result> getByCountry(@RequestParam String country) { +// try { +// List list = gardsAcceleratorService.getByCountry(country); +// return Result.ok(list); +// } catch (Exception e) { +// log.error("查询失败: " + e.getMessage()); +// return Result.error("查询失败"); +// } +// } +// +// /** +// * 根据运行状态查询 +// */ +// @Operation(summary = "根据加速器运行状态查询") +// @GetMapping("/by-status") +// public Result> getByOperationalStatus(@RequestParam Integer isOperational) { +// try { +// List list = gardsAcceleratorService.getByOperationalStatus(isOperational); +// return Result.ok(list); +// } catch (Exception e) { +// log.error("查询失败: " + e.getMessage()); +// return Result.error("查询失败"); +// } +// } +// +// /** +// * 条件组合查询 +// */ +// @GetMapping("/search") +// @Operation(summary = "条件组合查询") +// public Result> search( +// @RequestParam(required = false) String country, +// @RequestParam(required = false) String category, +// @RequestParam(required = false) Integer isOperational) { +// try { +// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// +// if (country != null && !country.isEmpty()) { +// wrapper.eq(GardsAccelerator::getCountry, country); +// } +// if (category != null && !category.isEmpty()) { +// wrapper.eq(GardsAccelerator::getCategory, category); +// } +// if (isOperational != null) { +// wrapper.eq(GardsAccelerator::getIsOperational, isOperational); +// } +// +// List list = gardsAcceleratorService.list(wrapper); +// return Result.ok(list); +// } catch (Exception e) { +// log.error("条件查询失败: " + e.getMessage()); +// return Result.error("条件查询失败"); +// } +// } - /** - * 根据设施代码查询 - */ - @Operation(summary = "根据加速器代码查询") - @GetMapping("/by-facility-code") - public Result getByFacilityCode(@RequestParam String facilityCode) { - try { - GardsAccelerator facility = gardsAcceleratorService.getByFacilityCode(facilityCode); - if (facility != null) { - return Result.ok(facility); - } else { - return Result.error("未找到设施代码为 " + facilityCode + " 的设施"); - } - } catch (Exception e) { - log.error("查询失败: " + e.getMessage()); - return Result.error("查询失败"); - } - } - - /** - * 根据国家查询 - */ - @Operation(summary = "根据加速器国家查询") - @GetMapping("/by-country") - public Result> getByCountry(@RequestParam String country) { - try { - List list = gardsAcceleratorService.getByCountry(country); - return Result.ok(list); - } catch (Exception e) { - log.error("查询失败: " + e.getMessage()); - return Result.error("查询失败" ); - } - } - - /** - * 根据运行状态查询 - */ - @Operation(summary = "根据加速器运行状态查询") - @GetMapping("/by-status") - public Result> getByOperationalStatus(@RequestParam Integer isOperational) { - try { - List list = gardsAcceleratorService.getByOperationalStatus(isOperational); - return Result.ok(list); - } catch (Exception e) { - log.error("查询失败: " + e.getMessage()); - return Result.error("查询失败"); - } - } - - /** - * 条件组合查询 - */ - @GetMapping("/search") - @Operation(summary = "条件组合查询") - public Result> search( - @RequestParam(required = false) String country, - @RequestParam(required = false) String category, - @RequestParam(required = false) Integer isOperational) { - try { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - - if (country != null && !country.isEmpty()) { - wrapper.eq(GardsAccelerator::getCountry, country); - } - if (category != null && !category.isEmpty()) { - wrapper.eq(GardsAccelerator::getCategory, category); - } - if (isOperational != null) { - wrapper.eq(GardsAccelerator::getIsOperational, isOperational); - } - - List list = gardsAcceleratorService.list(wrapper); - return Result.ok(list); - } catch (Exception e) { - log.error("条件查询失败: " + e.getMessage()); - return Result.error("条件查询失败"); - } - } + //endregion @AutoLog(value = "导出模版") @Operation(summary = "加速器信息导出模版") @@ -265,15 +216,17 @@ public class GardsAcceleratorController { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - if (country != null && !country.isEmpty()) { - wrapper.eq(GardsAccelerator::getCountry, country); + if (StringUtils.isNotBlank(country)) { + wrapper.like(GardsAccelerator::getCountry, country); } - if (category != null && !category.isEmpty()) { - wrapper.eq(GardsAccelerator::getCategory, category); - } - if (facilityName != null && !facilityName.isEmpty()) { - wrapper.eq(GardsAccelerator::getFacilityName, facilityName); +// if (category != null && !category.isEmpty()) { +// wrapper.eq(GardsAccelerator::getCategory, category); +// } + if (StringUtils.isNotBlank(facilityName)) { + wrapper.like(GardsAccelerator::getFacilityName, facilityName); } + wrapper.orderByDesc(GardsAccelerator::getId); + List list = gardsAcceleratorService.list(wrapper); ExcelExportUtil.exportExcel(params, GardsAccelerator.class, list).write(response.getOutputStream()); } diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsCorrectionFactorController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsCorrectionFactorController.java index a5dcb87..282567c 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsCorrectionFactorController.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsCorrectionFactorController.java @@ -42,17 +42,7 @@ public class GardsCorrectionFactorController { @PostMapping("/create") @Operation(summary = "新增校正因子") public Result create(@RequestBody GardsCorrectionFactor gardsCorrectionFactor) { - try { - boolean success = gardsCorrectionFactorService.save(gardsCorrectionFactor); - if (success) { - return Result.OK("校正因子添加成功", gardsCorrectionFactor); - } else { - return Result.error("校正因子添加失败"); - } - } catch (Exception e) { - log.error("操作失败: " + e.getMessage()); - return Result.error("操作失败"); - } + return gardsCorrectionFactorService.create(gardsCorrectionFactor); } /** @@ -61,17 +51,7 @@ public class GardsCorrectionFactorController { @DeleteMapping("/delete") @Operation(summary = "根据ID删除校正因子") public Result delete(@RequestParam(name="id") Integer id) { - try { - boolean success = gardsCorrectionFactorService.removeById(id); - if (success) { - return Result.ok("校正因子删除成功"); - } else { - return Result.error("校正因子删除失败,可能该记录不存在"); - } - } catch (Exception e) { - log.error("操作失败: " + e.getMessage()); - return Result.error("操作失败"); - } + return gardsCorrectionFactorService.delete(id); } /** @@ -80,17 +60,7 @@ public class GardsCorrectionFactorController { @PutMapping("/update") @Operation(summary = "更新校正因子信息") public Result update(@RequestBody GardsCorrectionFactor gardsCorrectionFactor) { - try { - boolean success = gardsCorrectionFactorService.updateById(gardsCorrectionFactor); - if (success) { - return Result.OK("校正因子更新成功", gardsCorrectionFactor); - } else { - return Result.error("校正因子更新失败,可能该记录不存在"); - } - } catch (Exception e) { - log.error("操作失败: " + e.getMessage()); - return Result.error("操作失败"); - } + return gardsCorrectionFactorService.update(gardsCorrectionFactor); } /** @@ -99,17 +69,7 @@ public class GardsCorrectionFactorController { @GetMapping("/queryById") @Operation(summary = "根据ID查询校正因子详情") public Result getById(@RequestParam(name="id") Integer id) { - try { - GardsCorrectionFactor factor = gardsCorrectionFactorService.getById(id); - if (factor != null) { - return Result.OK("查询成功", factor); - } else { - return Result.error("未找到对应的校正因子信息"); - } - } catch (Exception e) { - log.error("操作失败: " + e.getMessage()); - return Result.error("查询失败"); - } + return gardsCorrectionFactorService.queryById(id); } /** @@ -122,159 +82,147 @@ public class GardsCorrectionFactorController { @RequestParam(defaultValue = "10") Integer pageSize, @RequestParam(required = false) String stationCode, @RequestParam(required = false) String detectorCode) { - try { - Page page = new Page<>(pageNum, pageSize); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - - if (stationCode != null && !stationCode.trim().isEmpty()) { - wrapper.eq(GardsCorrectionFactor::getStationCode, stationCode); - } - if (detectorCode != null && !detectorCode.trim().isEmpty()) { - wrapper.eq(GardsCorrectionFactor::getDetectorCode, detectorCode); - } - - IPage pageResult = gardsCorrectionFactorService.page(page, wrapper); - return Result.OK ("分页查询成功", pageResult); - } catch (Exception e) { - log.error("分页查询失败: " + e.getMessage()); - return Result.error("分页查询失败"); - } + return gardsCorrectionFactorService.page(pageNum, pageSize, stationCode, detectorCode); } - /** - * 查询所有校正因子列表 - */ - @GetMapping("/list") - @Operation(summary = "查询所有校正因子列表") - public Result> list() { - try { - List list = gardsCorrectionFactorService.list(); - return Result.OK ("查询成功", list); - } catch (Exception e) { - log.error("查询失败: " + e.getMessage()); - return Result.error("查询失败" ); - } - } - - /** - * 根据站点代码查询 - */ - @GetMapping("/by-station") - @Operation(summary = "根据站点代码查询") - public Result> getByStationCode(@RequestParam(name = "stationCode") String stationCode) { - try { - List list = gardsCorrectionFactorService.getByStationCode(stationCode); - return Result.OK ("查询成功", list); - } catch (Exception e) { - log.error("查询失败: " + e.getMessage()); - return Result.error("查询失败"); - } - } - - /** - * 根据探测器代码查询 - */ - @GetMapping("/by-detector") - @Operation(summary = "查询所有校正因子库数据") - public Result> getByDetectorCode(@RequestParam(name="detectorCode") String detectorCode) { - try { - List list = gardsCorrectionFactorService.getByDetectorCode(detectorCode); - return Result.OK ("查询成功", list); - } catch (Exception e) { - log.error("查询失败: " + e.getMessage()); - return Result.error("查询失败"); - } - } - - /** - * 根据站点和探测器代码组合查询 - */ - @GetMapping("/by-station-detector") - @Operation(summary = "根据站点和探测器代码组合查询") - public Result> getByStationAndDetector( - @RequestParam String stationCode, - @RequestParam String detectorCode) { - try { - List factor = gardsCorrectionFactorService.getByStationAndDetector(stationCode, detectorCode); - if (factor != null) { - return Result.OK("查询成功", factor); - } else { - return Result.error("未找到对应的校正因子"); - } - } catch (Exception e) { - log.error("查询失败: " + e.getMessage()); - return Result.error("查询失败"); - } - } - - /** - * 根据制造商查询 - */ - @GetMapping("/by-manufacturer") - @Operation(summary = "根据制造商查询") - public Result> getByManufacturer(@RequestParam String manufacturer) { - try { - List list = gardsCorrectionFactorService.getByManufacturer(manufacturer); - return Result.OK("查询成功", list); - } catch (Exception e) { - log.error("查询失败: " + e.getMessage()); - return Result.error("查询失败"); - } - } - - /** - * 根据型号查询 - */ - @GetMapping("/by-model") - @Operation(summary = "根据型号查询") - public Result> getByModel(@RequestParam String model) { - try { - List list = gardsCorrectionFactorService.getByModel(model); - return Result.OK ("查询成功", list); - } catch (Exception e) { - log.error("查询失败: " + e.getMessage()); - return Result.error("查询失败"); - } - } - - /** - * 多条件组合查询 - */ - @GetMapping("/search") - @Operation(summary = "校正因子多条件组合查询") - public Result> search( - @RequestParam(required = false) String stationCode, - @RequestParam(required = false) String detectorCode, - @RequestParam(required = false) String manufacturer, - @RequestParam(required = false) String model) { - try { - List list = gardsCorrectionFactorService.getByConditions( - stationCode, detectorCode, manufacturer, model); - return Result.OK ("查询成功", list); - } catch (Exception e) { - log.error("条件查询失败: " + e.getMessage()); - return Result.error("条件查询失败"); - } - } - - /** - * 批量更新校正因子 - */ - @PutMapping("/batch") - @Operation(summary = "校正因子批量更新") - public Result updateBatch(@RequestBody List factors) { - try { - boolean success = gardsCorrectionFactorService.updateBatchCorrectionFactors(factors); - if (success) { - return Result.ok("批量更新成功"); - } else { - return Result.error("批量更新失败"); - } - } catch (Exception e) { - log.error("批量操作失败: " + e.getMessage()); - return Result.error("批量操作失败"); - } - } + //region 注释代码 +// +// /** +// * 查询所有校正因子列表 +// */ +// @GetMapping("/list") +// @Operation(summary = "查询所有校正因子列表") +// public Result> list() { +// try { +// List list = gardsCorrectionFactorService.list(); +// return Result.OK ("查询成功", list); +// } catch (Exception e) { +// log.error("查询失败: " + e.getMessage()); +// return Result.error("查询失败" ); +// } +// } +// +// /** +// * 根据站点代码查询 +// */ +// @GetMapping("/by-station") +// @Operation(summary = "根据站点代码查询") +// public Result> getByStationCode(@RequestParam(name = "stationCode") String stationCode) { +// try { +// List list = gardsCorrectionFactorService.getByStationCode(stationCode); +// return Result.OK ("查询成功", list); +// } catch (Exception e) { +// log.error("查询失败: " + e.getMessage()); +// return Result.error("查询失败"); +// } +// } +// +// /** +// * 根据探测器代码查询 +// */ +// @GetMapping("/by-detector") +// @Operation(summary = "查询所有校正因子库数据") +// public Result> getByDetectorCode(@RequestParam(name="detectorCode") String detectorCode) { +// try { +// List list = gardsCorrectionFactorService.getByDetectorCode(detectorCode); +// return Result.OK ("查询成功", list); +// } catch (Exception e) { +// log.error("查询失败: " + e.getMessage()); +// return Result.error("查询失败"); +// } +// } +// +// /** +// * 根据站点和探测器代码组合查询 +// */ +// @GetMapping("/by-station-detector") +// @Operation(summary = "根据站点和探测器代码组合查询") +// public Result> getByStationAndDetector( +// @RequestParam String stationCode, +// @RequestParam String detectorCode) { +// try { +// List factor = gardsCorrectionFactorService.getByStationAndDetector(stationCode, detectorCode); +// if (factor != null) { +// return Result.OK("查询成功", factor); +// } else { +// return Result.error("未找到对应的校正因子"); +// } +// } catch (Exception e) { +// log.error("查询失败: " + e.getMessage()); +// return Result.error("查询失败"); +// } +// } +// +// /** +// * 根据制造商查询 +// */ +// @GetMapping("/by-manufacturer") +// @Operation(summary = "根据制造商查询") +// public Result> getByManufacturer(@RequestParam String manufacturer) { +// try { +// List list = gardsCorrectionFactorService.getByManufacturer(manufacturer); +// return Result.OK("查询成功", list); +// } catch (Exception e) { +// log.error("查询失败: " + e.getMessage()); +// return Result.error("查询失败"); +// } +// } +// +// /** +// * 根据型号查询 +// */ +// @GetMapping("/by-model") +// @Operation(summary = "根据型号查询") +// public Result> getByModel(@RequestParam String model) { +// try { +// List list = gardsCorrectionFactorService.getByModel(model); +// return Result.OK ("查询成功", list); +// } catch (Exception e) { +// log.error("查询失败: " + e.getMessage()); +// return Result.error("查询失败"); +// } +// } +// +// /** +// * 多条件组合查询 +// */ +// @GetMapping("/search") +// @Operation(summary = "校正因子多条件组合查询") +// public Result> search( +// @RequestParam(required = false) String stationCode, +// @RequestParam(required = false) String detectorCode, +// @RequestParam(required = false) String manufacturer, +// @RequestParam(required = false) String model) { +// try { +// List list = gardsCorrectionFactorService.getByConditions( +// stationCode, detectorCode, manufacturer, model); +// return Result.OK ("查询成功", list); +// } catch (Exception e) { +// log.error("条件查询失败: " + e.getMessage()); +// return Result.error("条件查询失败"); +// } +// } +// +// /** +// * 批量更新校正因子 +// */ +// @PutMapping("/batch") +// @Operation(summary = "校正因子批量更新") +// public Result updateBatch(@RequestBody List factors) { +// try { +// boolean success = gardsCorrectionFactorService.updateBatchCorrectionFactors(factors); +// if (success) { +// return Result.ok("批量更新成功"); +// } else { +// return Result.error("批量更新失败"); +// } +// } catch (Exception e) { +// log.error("批量操作失败: " + e.getMessage()); +// return Result.error("批量操作失败"); +// } +// } +// + //endregion @AutoLog(value = "导出模版") @Operation(summary = "导出模版") diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearFuelFacilityController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearFuelFacilityController.java index ff89551..3d302fe 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearFuelFacilityController.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearFuelFacilityController.java @@ -41,17 +41,7 @@ public class GardsNuclearFuelFacilityController { @PostMapping("/create") @Operation(summary = "新增核燃料设施信息") public Result create(@RequestBody GardsNuclearFuelFacilities facility) { - try { - boolean success = nuclearFuelFacilitiesService.save(facility); - if (success) { - return Result.OK("核燃料设施信息添加成功", facility); - } else { - return Result.error("核燃料设施信息添加失败"); - } - } catch (Exception e) { - log.error("操作失败: " + e.getMessage()); - return Result.error("操作失败"); - } + return nuclearFuelFacilitiesService.create(facility); } /** @@ -60,17 +50,7 @@ public class GardsNuclearFuelFacilityController { @DeleteMapping("/delete") @Operation(summary = "根据ID删除核燃料设施信息") public Result delete(@RequestParam Integer id) { - try { - boolean success = nuclearFuelFacilitiesService.removeById(id); - if (success) { - return Result.ok("核燃料设施信息删除成功"); - } else { - return Result.error("核燃料设施信息删除失败,可能该记录不存在"); - } - } catch (Exception e) { - log.error("操作失败: " + e.getMessage()); - return Result.error("操作失败 "); - } + return nuclearFuelFacilitiesService.delete(id); } /** @@ -79,17 +59,7 @@ public class GardsNuclearFuelFacilityController { @PutMapping("/update") @Operation(summary = "更新核燃料设施信息") public Result update(@RequestBody GardsNuclearFuelFacilities facility) { - try { - boolean success = nuclearFuelFacilitiesService.updateById(facility); - if (success) { - return Result.OK("核燃料设施信息更新成功", facility); - } else { - return Result.error("核燃料设施信息更新失败,可能该记录不存在"); - } - } catch (Exception e) { - log.error("操作失败: " + e.getMessage()); - return Result.error("操作失败"); - } + return nuclearFuelFacilitiesService.update(facility); } /** @@ -98,17 +68,7 @@ public class GardsNuclearFuelFacilityController { @GetMapping("/getById") @Operation(summary = "根据ID查询核燃料设施详情") public Result getById(@RequestParam Integer id) { - try { - GardsNuclearFuelFacilities facility = nuclearFuelFacilitiesService.getById(id); - if (facility != null) { - return Result.ok(facility); - } else { - return Result.error("未找到对应的核燃料设施信息"); - } - } catch (Exception e) { - log.error("操作失败: " + e.getMessage()); - return Result.error("查询失败"); - } + return nuclearFuelFacilitiesService.queryById(id); } /** @@ -123,82 +83,64 @@ public class GardsNuclearFuelFacilityController { @RequestParam(required = false) String facilityStatus, @RequestParam(required = false) String facilityName, @RequestParam(required = false) String country) { - try { - Page page = new Page<>(pageNum, pageSize); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - - if (facilityType != null && !facilityType.trim().isEmpty()) { - wrapper.eq(GardsNuclearFuelFacilities::getFacilityType, facilityType); - } - if (facilityStatus != null && !facilityStatus.trim().isEmpty()) { - wrapper.eq(GardsNuclearFuelFacilities::getFacilityStatus, facilityStatus); - } - if (facilityName != null && !facilityName.trim().isEmpty()) { - wrapper.eq(GardsNuclearFuelFacilities::getFacilityName, facilityName); - } - if (country != null && !country.trim().isEmpty()) { - wrapper.eq(GardsNuclearFuelFacilities::getCountry, country); - } - - IPage pageResult = nuclearFuelFacilitiesService.page(page, wrapper); - return Result.OK("分页查询成功", pageResult); - } catch (Exception e) { - log.error("操作失败: " + e.getMessage()); - return Result.error("分页查询失败"); - } + return nuclearFuelFacilitiesService.page(pageNum, pageSize, facilityType, facilityStatus, facilityName, country); } - /** - * 查询所有核燃料设施列表 - */ - @GetMapping("/list") - @Operation(summary = "查询所有核燃料设施列表") - public Result> list() { - try { - List list = nuclearFuelFacilitiesService.list(); - return Result.OK("查询成功", list); - } catch (Exception e) { - log.error("操作失败: " + e.getMessage()); - return Result.error("查询失败"); - } - } + //region 注释代码 - /** - * 根据设施名称模糊查询 - */ - @GetMapping("/by-name") - @Operation(summary = "根据设施名称模糊查询") - public Result> getByFacilityNameLike(@RequestParam String facilityName) { - try { - List list = nuclearFuelFacilitiesService.getByFacilityNameLike(facilityName); - return Result.OK("查询成功", list); - } catch (Exception e) { - log.error("操作失败: " + e.getMessage()); - return Result.error("查询失败"); - } - } +// /** +// * 查询所有核燃料设施列表 +// */ +// @GetMapping("/list") +// @Operation(summary = "查询所有核燃料设施列表") +// public Result> list() { +// try { +// List list = nuclearFuelFacilitiesService.list(); +// return Result.OK("查询成功", list); +// } catch (Exception e) { +// log.error("操作失败: " + e.getMessage()); +// return Result.error("查询失败"); +// } +// } +// +// /** +// * 根据设施名称模糊查询 +// */ +// @GetMapping("/by-name") +// @Operation(summary = "根据设施名称模糊查询") +// public Result> getByFacilityNameLike(@RequestParam String facilityName) { +// try { +// List list = nuclearFuelFacilitiesService.getByFacilityNameLike(facilityName); +// return Result.OK("查询成功", list); +// } catch (Exception e) { +// log.error("操作失败: " + e.getMessage()); +// return Result.error("查询失败"); +// } +// } +// +// +// /** +// * 多条件组合查询 +// */ +// @GetMapping("/search") +// @Operation(summary = "多条件组合查询") +// public Result> search( +// @RequestParam(required = false) String facilityType, +// @RequestParam(required = false) String facilityStatus, +// @RequestParam(required = false) String country, +// @RequestParam(required = false) String facilityName, +// @RequestParam(required = false) String fuelType) { +// try { +// List list = nuclearFuelFacilitiesService.getByConditions( +// facilityType, facilityStatus, country, facilityName, fuelType); +// return Result.OK("查询成功", list); +// } catch (Exception e) { +// log.error("操作失败: " + e.getMessage()); +// return Result.error("条件查询失败"); +// } +// } - - /** - * 多条件组合查询 - */ - @GetMapping("/search") - @Operation(summary = "多条件组合查询") - public Result> search( - @RequestParam(required = false) String facilityType, - @RequestParam(required = false) String facilityStatus, - @RequestParam(required = false) String country, - @RequestParam(required = false) String facilityName, - @RequestParam(required = false) String fuelType) { - try { - List list = nuclearFuelFacilitiesService.getByConditions( - facilityType, facilityStatus, country, facilityName, fuelType); - return Result.OK("查询成功", list); - } catch (Exception e) { - log.error("操作失败: " + e.getMessage()); - return Result.error("条件查询失败"); - } - } + //endregion @AutoLog(value = "导出模版") @Operation(summary = "导出模版") diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearReactorsController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearReactorsController.java index 4fbeb76..3e6f2b8 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearReactorsController.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearReactorsController.java @@ -49,17 +49,7 @@ public class GardsNuclearReactorsController { @Operation(summary = "新增核设施信息") public Result create(@RequestBody GardsNuclearReactors gardsNuclearReactors) { - try { - boolean success = gardsNuclearReactorsService.save(gardsNuclearReactors); - if (success) { - return Result.OK("添加核设施信息成功", gardsNuclearReactors); - } else { - return Result.error("添加核设施信息失败"); - } - } catch (Exception e) { - log.error("新增操作失败: " + e.getMessage()); - return Result.error("操作失败"); - } + return gardsNuclearReactorsService.create(gardsNuclearReactors); } /** @@ -71,17 +61,7 @@ public class GardsNuclearReactorsController { @DeleteMapping("/delete") @Operation(summary = "删除核设施信息数据") public Result delete(@RequestParam Integer id) { - try { - boolean success = gardsNuclearReactorsService.removeById(id); - if (success) { - return Result.ok("核设施信息删除成功"); - } - return Result.error("删除核设施信息失败,可能该记录不存在"); - - } catch (Exception e) { - log.error("操作失败: " + e.getMessage()); - return Result.error("操作失败"); - } + return gardsNuclearReactorsService.delete(id); } /** @@ -93,18 +73,7 @@ public class GardsNuclearReactorsController { @PutMapping("/update") @Operation(summary = "更新核设施数据") public Result update(@RequestBody GardsNuclearReactors gardsNuclearReactors) { - try { - boolean success = gardsNuclearReactorsService.updateById(gardsNuclearReactors); - if (success) { - return Result.OK("更新成功", gardsNuclearReactors); - } else { - return Result.error("更新失败,或者记录不存在"); - - } - } catch (Exception e) { - log.error("操作失败: " + e.getMessage()); - return Result.error("操作失败"); - } + return gardsNuclearReactorsService.update(gardsNuclearReactors); } /** @@ -115,18 +84,8 @@ public class GardsNuclearReactorsController { */ @GetMapping("/getById") @Operation(summary = "根据Id查询反应堆数据") - public Result getById(@RequestParam Integer id) { - try { - GardsNuclearReactors nuclearReactors = gardsNuclearReactorsService.getById(id); - if (nuclearReactors != null) { - return Result.OK(nuclearReactors); - } else { - return Result.error("未找到核设施信息数据"); - } - } catch (Exception e) { - log.error("操作失败: " + e.getMessage()); - return Result.error("查询失败"); - } + public Result queryById(@RequestParam Integer id) { + return gardsNuclearReactorsService.queryById(id); } @@ -147,55 +106,42 @@ public class GardsNuclearReactorsController { @RequestParam(required = false) String unitName, @RequestParam(required = false) String country) { - try { - Page page = new Page<>(pageNum, pageSize); - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - - if (unitName != null && !unitName.trim().isEmpty()) { - wrapper.eq(GardsNuclearReactors::getUnitName, unitName); - } - if (country != null && !country.trim().isEmpty()) { - wrapper.eq(GardsNuclearReactors::getCountry, country); - } - IPage pageResult = gardsNuclearReactorsService.page(page, wrapper); - - return Result.OK(pageResult); - } catch (Exception e) { - log.error("查询失败: " + e.getMessage()); - return Result.error("查询失败"); - } + return gardsNuclearReactorsService.page(pageNum, pageSize, unitName, country); } - /** - * 组合条件查询 - * - * @param unitName 名称 - * @param country 国家 - * @param reactorType reactorType - * @param reactorStatus reactorStatus - * @return list - */ - @GetMapping("/search") - @Operation(summary = "核设施信息组合条件查询") - public Result> search(@RequestParam(required = false) String unitName, - @RequestParam(required = false) String country, - @RequestParam(required = false) String reactorType, - @RequestParam(required = false) String reactorStatus) { + //region 注释代码 - try { - List list = gardsNuclearReactorsService.getByConditions(unitName, country, reactorType, reactorStatus); - return Result.OK(list); - } catch (Exception e) { - log.error("条件查询失败: " + e.getMessage()); - return Result.error("条件查询失败"); - } - - - } +// /** +// * 组合条件查询 +// * +// * @param unitName 名称 +// * @param country 国家 +// * @param reactorType reactorType +// * @param reactorStatus reactorStatus +// * @return list +// */ +// @GetMapping("/search") +// @Operation(summary = "核设施信息组合条件查询") +// public Result> search(@RequestParam(required = false) String unitName, +// @RequestParam(required = false) String country, +// @RequestParam(required = false) String reactorType, +// @RequestParam(required = false) String reactorStatus) { +// +// try { +// List list = gardsNuclearReactorsService.getByConditions(unitName, country, reactorType, reactorStatus); +// return Result.OK(list); +// } catch (Exception e) { +// log.error("条件查询失败: " + e.getMessage()); +// return Result.error("条件查询失败"); +// } +// +// +// } +// + //endregion @AutoLog(value = "导出模版") @Operation(summary = "核设施信息导出模版") diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearReleaseController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearReleaseController.java index 548b345..aee6248 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearReleaseController.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearReleaseController.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; + @Slf4j @RestController @RequestMapping("/gardsNuclearReleaseRecords") @@ -40,17 +41,7 @@ public class GardsNuclearReleaseController { @PostMapping("/create") @Operation(summary = "新增加核设施放射性排放记录信息") public Result create(@RequestBody GardsNuclearReleaseRecords gardsNuclearReleaseRecords) { - try { - boolean success = gardsNuclearReleaseService.save(gardsNuclearReleaseRecords); - if (success) { - return Result.OK("添加成功", gardsNuclearReleaseRecords); - } else { - return Result.error("添加失败"); - } - } catch (Exception e) { - log.error("create: " + e.getMessage()); - return Result.error("添加失败"); - } + return gardsNuclearReleaseService.create(gardsNuclearReleaseRecords); } /** @@ -59,18 +50,7 @@ public class GardsNuclearReleaseController { @DeleteMapping("/delete") @Operation(summary = "删除核设施放射性排放记录信息") public Result deleteById(@RequestParam Integer id) { - try { - boolean success = gardsNuclearReleaseService.removeById(id); - if (success) { - return Result.OK("删除成功"); - } else { - return Result.error("删除失败,可能数据不存在"); - - } - } catch (Exception e) { - log.error("deleteById: " + e.getMessage()); - return Result.error("操作失败"); - } + return gardsNuclearReleaseService.deleteById(id); } /** @@ -79,18 +59,7 @@ public class GardsNuclearReleaseController { @PutMapping("/update") @Operation(summary = "更新核设施放射性排放记录信息") public Result update(@RequestBody GardsNuclearReleaseRecords gardsNuclearReleaseRecords) { - try { - boolean success = gardsNuclearReleaseService.updateById(gardsNuclearReleaseRecords); - if (success) { - return Result.OK("数据更新成功", gardsNuclearReleaseRecords); - } else { - return Result.error("数据更新失败"); - - } - } catch (Exception e) { - log.error("update: " + e.getMessage()); - return Result.error("操作失败"); - } + return gardsNuclearReleaseService.update(gardsNuclearReleaseRecords); } /** @@ -99,25 +68,15 @@ public class GardsNuclearReleaseController { @GetMapping("/queryById") @Operation(summary = "查询核设施放射性排放记录信息") public Result getById(@RequestParam Integer id) { - try { - GardsNuclearReleaseRecords nuclearReactors = gardsNuclearReleaseService.getById(id); - if (nuclearReactors != null) { - return Result.OK(nuclearReactors); - } else { - return Result.error("未找到数据"); - } - } catch (Exception e) { - log.error("getById: " + e.getMessage()); - return Result.error("查询失败"); - } + return gardsNuclearReleaseService.queryById(id); } /** * 分页查询 * - * @param pageNum - * @param pageSize - * @param siteName + * @param pageNum 页数 + * @param pageSize 每页大小 + * @param facilityName * @param nuclide * @return */ @@ -126,57 +85,43 @@ public class GardsNuclearReleaseController { public Result> page( @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize, - @RequestParam(required = false) String siteName, + @RequestParam(required = false) String facilityName, @RequestParam(required = false) String nuclide) { - - try { - Page page = new Page<>(pageNum, pageSize); - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - - if (siteName != null && !siteName.trim().isEmpty()) { - wrapper.eq(GardsNuclearReleaseRecords::getSiteName, siteName); - } - if (nuclide != null && !nuclide.trim().isEmpty()) { - wrapper.eq(GardsNuclearReleaseRecords::getNuclide, nuclide); - } - IPage pageResult = gardsNuclearReleaseService.page(page, wrapper); - - return Result.OK(pageResult); - } catch (Exception e) { - log.error("page: " + e.getMessage()); - return Result.error("查询失败:"); - } + return gardsNuclearReleaseService.page(pageNum, pageSize, facilityName, nuclide); } - /** - * 组合条件查询 - * - * @param siteName 地点名称 - * @param nuclide 具体核素 - * @param nuclideType 核素类型 - * @param releaseType 释放类型 - * @return - */ - @GetMapping("/search") - @Operation(summary = "核设施放射性排放记录组合条件查询") - public Result> search( - @RequestParam(required = false) String siteName, - @RequestParam(required = false) String nuclide, - @RequestParam(required = false) String nuclideType, - @RequestParam(required = false) String releaseType) { + //region 注释代码 +// +// /** +// * 组合条件查询 +// * +// * @param siteName 地点名称 +// * @param nuclide 具体核素 +// * @param nuclideType 核素类型 +// * @param releaseType 释放类型 +// * @return +// */ +// @GetMapping("/search") +// @Operation(summary = "核设施放射性排放记录组合条件查询") +// public Result> search( +// @RequestParam(required = false) String siteName, +// @RequestParam(required = false) String nuclide, +// @RequestParam(required = false) String nuclideType, +// @RequestParam(required = false) String releaseType) { +// +// try { +// List list = gardsNuclearReleaseService.getByConditions(siteName, nuclide, nuclideType, releaseType); +// return Result.OK(list); +// } catch (Exception e) { +// log.error("条件查询失败: " + e.getMessage()); +// return Result.error("查询失败"); +// } +// +// } - try { - List list = gardsNuclearReleaseService.getByConditions(siteName, nuclide, nuclideType, releaseType); - return Result.OK(list); - } catch (Exception e) { - log.error("条件查询失败: " + e.getMessage()); - return Result.error("查询失败"); - } - - } + //endregion @AutoLog(value = "导出模版") @Operation(summary = "核设施放射性排放记录导出模版") @@ -195,16 +140,15 @@ public class GardsNuclearReleaseController { @Operation(summary = "核设施放射性排放记录导出Excel") @GetMapping("/exportExcel") public void exportExcel(HttpServletResponse response, - @RequestParam(required = false) String siteName, + @RequestParam(required = false) String facilityName, @RequestParam(required = false) String nuclide, - @RequestParam(required = false) String nuclideType, - @RequestParam(required = false) String releaseType) throws IOException { + @RequestParam(required = false) String matterState) throws IOException { ExportParams params = new ExportParams(); params.setTitle("核设施放射性排放记录信息"); params.setFixedTitle(true); params.setTitleHeight((short) 8); params.setType(ExcelType.XSSF); - List list = gardsNuclearReleaseService.getByConditions(siteName, nuclide, nuclideType, releaseType); + List list = gardsNuclearReleaseService.getByConditions(facilityName, nuclide, matterState); ExcelExportUtil.exportExcel(params, GardsNuclearReleaseRecords.class, list).write(response.getOutputStream()); } diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearTestingPlantController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearTestingPlantController.java index 1f28297..baa8a3a 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearTestingPlantController.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsNuclearTestingPlantController.java @@ -42,17 +42,7 @@ public class GardsNuclearTestingPlantController { @PostMapping("/create") @Operation(summary = "新增核试验信息") public Result create(@RequestBody GardsNuclearTestingPlant gardsNuclearTestingPlant) { - try { - boolean success = gardsNuclearTestingPlantService.save(gardsNuclearTestingPlant); - if (success) { - return Result.OK("添加成功", gardsNuclearTestingPlant); - } else { - return Result.error("添加失败"); - } - } catch (Exception e) { - log.error("create: " + e.getMessage()); - return Result.error("添加失败"); - } + return gardsNuclearTestingPlantService.create(gardsNuclearTestingPlant); } /** @@ -61,18 +51,7 @@ public class GardsNuclearTestingPlantController { @DeleteMapping("/delete") @Operation(summary = "删除核试验信息") public Result deleteById(@RequestParam Integer id) { - try { - boolean success = gardsNuclearTestingPlantService.removeById(id); - if (success) { - return Result.OK("删除成功"); - } else { - return Result.error("删除失败,可能数据不存在"); - - } - } catch (Exception e) { - log.error("deleteById: " + e.getMessage()); - return Result.error("操作失败:"); - } + return gardsNuclearTestingPlantService.deleteById(id); } /** @@ -81,18 +60,7 @@ public class GardsNuclearTestingPlantController { @PutMapping("/update") @Operation(summary = "更新核试验信息") public Result update(@RequestBody GardsNuclearTestingPlant gardsNuclearTestingPlant) { - try { - boolean success = gardsNuclearTestingPlantService.updateById(gardsNuclearTestingPlant); - if (success) { - return Result.OK("数据更新成功", gardsNuclearTestingPlant); - } else { - return Result.error("数据更新失败"); - - } - } catch (Exception e) { - log.error("update: " + e.getMessage()); - return Result.error("操作失败"); - } + return gardsNuclearTestingPlantService.update(gardsNuclearTestingPlant); } /** @@ -101,17 +69,7 @@ public class GardsNuclearTestingPlantController { @GetMapping("/queryById") @Operation(summary = "查询核试验信息") public Result getById(@RequestParam Integer id) { - try { - GardsNuclearTestingPlant nuclearReactors = gardsNuclearTestingPlantService.getById(id); - if (nuclearReactors != null) { - return Result.OK(nuclearReactors); - } else { - return Result.error("未找到数据"); - } - } catch (Exception e) { - log.error("getById: " + e.getMessage()); - return Result.error("查询失败:" + e.getMessage()); - } + return gardsNuclearTestingPlantService.queryById(id); } /** @@ -130,7 +88,6 @@ public class GardsNuclearTestingPlantController { @RequestParam(defaultValue = "10") Integer pageSize, @RequestParam(required = false) String name, @RequestParam(required = false) String type) { - try { Page page = new Page<>(pageNum, pageSize); diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsResearchReactorsController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsResearchReactorsController.java index 0ed2a88..3aba436 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsResearchReactorsController.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsResearchReactorsController.java @@ -41,17 +41,7 @@ public class GardsResearchReactorsController { @PostMapping("/create") @Operation(summary = "新增反应堆信息") public Result create(@RequestBody GardsResearchReactors gardsResearchReactors) { - try { - boolean success = gardsResearchReactorsService.save(gardsResearchReactors); - if (success) { - return Result.OK("反应堆信息添加成功", gardsResearchReactors); - } else { - return Result.error("反应堆信息添加失败"); - } - } catch (Exception e) { - log.error("create: " + e.getMessage()); - return Result.error("添加失败"); - } + return gardsResearchReactorsService.create(gardsResearchReactors); } /** @@ -60,18 +50,7 @@ public class GardsResearchReactorsController { @DeleteMapping("/delete") @Operation(summary = "删除反应堆信息") public Result deleteById(@RequestParam Integer id) { - try { - boolean success = gardsResearchReactorsService.removeById(id); - if (success) { - return Result.OK("删除成功"); - } else { - return Result.error("删除失败,可能数据不存在"); - - } - } catch (Exception e) { - log.error("deleteById: " + e.getMessage()); - return Result.error("操作失败"); - } + return gardsResearchReactorsService.deleteById(id); } /** @@ -80,18 +59,7 @@ public class GardsResearchReactorsController { @PutMapping("/update") @Operation(summary = "更新反应堆信息") public Result update(@RequestBody GardsResearchReactors gardsResearchReactors) { - try { - boolean success = gardsResearchReactorsService.updateById(gardsResearchReactors); - if (success) { - return Result.OK("数据更新成功", gardsResearchReactors); - } else { - return Result.error("数据更新失败"); - - } - } catch (Exception e) { - log.error("update: " + e.getMessage()); - return Result.error("操作失败"); - } + return gardsResearchReactorsService.update(gardsResearchReactors); } /** @@ -100,17 +68,7 @@ public class GardsResearchReactorsController { @GetMapping("/queryById") @Operation(summary = "查询反应堆信息") public Result getById(@RequestParam Integer id) { - try { - GardsResearchReactors nuclearReactors = gardsResearchReactorsService.getById(id); - if (nuclearReactors != null) { - return Result.OK(nuclearReactors); - } else { - return Result.error("未找到数据"); - } - } catch (Exception e) { - log.error("getById: " + e.getMessage()); - return Result.error("查询失败"); - } + return gardsResearchReactorsService.queryById(id); } /** @@ -130,24 +88,7 @@ public class GardsResearchReactorsController { @RequestParam(required = false) String facilityName, @RequestParam(required = false) String country) { - try { - Page page = new Page<>(pageNum, pageSize); - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - - if (facilityName != null && !facilityName.trim().isEmpty()) { - wrapper.eq(GardsResearchReactors::getFacilityName, facilityName); - } - if (country != null && !country.trim().isEmpty()) { - wrapper.eq(GardsResearchReactors::getCountry, country); - } - IPage pageResult = gardsResearchReactorsService.page(page, wrapper); - - return Result.OK(pageResult); - } catch (Exception e) { - log.error("page: " + e.getMessage()); - return Result.error("查询失败" ); - } + return gardsResearchReactorsService.page(pageNum, pageSize,facilityName,country); } diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsStationsController.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsStationsController.java index ef9c8d4..c38c0a0 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsStationsController.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/GardsStationsController.java @@ -40,17 +40,7 @@ public class GardsStationsController { @PostMapping("/create") @Operation(summary = "新增台站信息") public Result create(@RequestBody GardsStations gardsStations) { - try { - boolean success = gardsStationsService.save(gardsStations); - if (success) { - return Result.OK("添加成功", gardsStations); - } else { - return Result.error("添加失败"); - } - } catch (Exception e) { - log.error("create: " + e.getMessage()); - return Result.error("添加失败"); - } + return gardsStationsService.create(gardsStations); } /** @@ -59,18 +49,7 @@ public class GardsStationsController { @DeleteMapping("/delete") @Operation(summary = "删除台站信息") public Result deleteById(@RequestParam Integer stationId) { - try { - boolean success = gardsStationsService.removeById(stationId); - if (success) { - return Result.OK("删除成功"); - } else { - return Result.error("删除失败,可能数据不存在"); - - } - } catch (Exception e) { - log.error("deleteById: " + e.getMessage()); - return Result.error("操作失败"); - } + return gardsStationsService.deleteById(stationId); } /** @@ -79,18 +58,7 @@ public class GardsStationsController { @PutMapping("/update") @Operation(summary = "更新台站信息") public Result update(@RequestBody GardsStations gardsStations) { - try { - boolean success = gardsStationsService.updateById(gardsStations); - if (success) { - return Result.OK("数据更新成功", gardsStations); - } else { - return Result.error("数据更新失败"); - - } - } catch (Exception e) { - log.error("update: " + e.getMessage()); - return Result.error("操作失败"); - } + return gardsStationsService.update(gardsStations); } /** @@ -99,17 +67,7 @@ public class GardsStationsController { @GetMapping("/queryById") @Operation(summary = "查询台站信息") public Result getById(@RequestParam Integer stationId) { - try { - GardsStations nuclearReactors = gardsStationsService.getById(stationId); - if (nuclearReactors != null) { - return Result.OK(nuclearReactors); - } else { - return Result.error("未找到数据"); - } - } catch (Exception e) { - log.error("getById: " + e.getMessage()); - return Result.error("查询失败" ); - } + return gardsStationsService.queryById(stationId); } /** @@ -129,24 +87,7 @@ public class GardsStationsController { @RequestParam(required = false) String stationCode, @RequestParam(required = false) String countryCode) { - try { - Page page = new Page<>(pageNum, pageSize); - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - - if (stationCode != null && !stationCode.trim().isEmpty()) { - wrapper.eq(GardsStations::getStationCode, stationCode); - } - if (countryCode != null && !countryCode.trim().isEmpty()) { - wrapper.eq(GardsStations::getCountryCode, countryCode); - } - IPage pageResult = gardsStationsService.page(page, wrapper); - - return Result.OK(pageResult); - } catch (Exception e) { - log.error("page: " + e.getMessage()); - return Result.error("查询失败"); - } + return gardsStationsService.page(pageNum, pageSize, stationCode, countryCode); } /** diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/Test.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/Test.java deleted file mode 100644 index b0c8ab3..0000000 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/controller/Test.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.jeecg.controller; - -public class Test { -} diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsAcceleratorService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsAcceleratorService.java index ae334b9..e896fc3 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsAcceleratorService.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsAcceleratorService.java @@ -1,13 +1,29 @@ 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.GardsAccelerator; +import org.springframework.web.bind.annotation.RequestParam; import java.util.List; -public interface GardsAcceleratorService extends IService { +public interface GardsAcceleratorService extends IService { + + + Result create(GardsAccelerator gardsAccelerator); + + Result delete(Integer id); + + Result update(GardsAccelerator gardsAccelerator); + + Result queryById(Integer id); + + Result> queryPage(Integer pageNum, Integer pageSize, String country, String facilityName); + /** + * 根据设施代码查询设施信息 * 根据设施代码查询设施信息 */ GardsAccelerator getByFacilityCode(String facilityCode); diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsCorrectionFactorService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsCorrectionFactorService.java index 4fd9f80..d186164 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsCorrectionFactorService.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsCorrectionFactorService.java @@ -1,13 +1,51 @@ package org.jeecg.service; +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.IService; +import io.swagger.v3.oas.annotations.Operation; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor; +import org.springframework.web.bind.annotation.*; import java.util.List; public interface GardsCorrectionFactorService extends IService { + /** + * 新增校正因子 + */ + + Result create(GardsCorrectionFactor gardsCorrectionFactor) ; + + /** + * 根据ID删除校正因子 + */ + + Result delete( Integer id); + + /** + * 更新校正因子信息 + */ + + Result update(GardsCorrectionFactor gardsCorrectionFactor) ; + + /** + * 根据ID查询校正因子详情 + */ + + Result queryById(Integer id); + + + /** + * 分页查询校正因子列表 + */ + + Result> page(Integer pageNum, Integer pageSize, String stationCode, String detectorCode); + + /** * 根据站点代码查询校正因子列表 */ diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearFuelFacilityService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearFuelFacilityService.java index 8f16b00..d312439 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearFuelFacilityService.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearFuelFacilityService.java @@ -1,7 +1,13 @@ package org.jeecg.service; +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.IService; +import io.swagger.v3.oas.annotations.Operation; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.base.entity.configuration.GardsNuclearFuelFacilities; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -10,6 +16,42 @@ import java.util.List; */ public interface GardsNuclearFuelFacilityService extends IService { + + /** + * 新增核燃料设施信息 + */ + + Result create(GardsNuclearFuelFacilities facility); + + /** + * 根据ID删除核燃料设施信息 + */ + + Result delete(Integer id); + + /** + * 更新核燃料设施信息 + */ + + Result update(GardsNuclearFuelFacilities facility); + + /** + * 根据ID查询核燃料设施详情 + */ + + Result queryById(Integer id); + + /** + * 分页查询核燃料设施列表 + */ + + Result> page(Integer pageNum, Integer pageSize, + String facilityType, + String facilityStatus, + String facilityName, + String country); + + /** * 根据设施名称模糊查询 */ @@ -18,7 +60,7 @@ public interface GardsNuclearFuelFacilityService extends IService getByConditions(String facilityType, String facilityStatus, String country,String facilityName, String fuelType); + List getByConditions(String facilityType, String facilityStatus, String country, String facilityName, String fuelType); /** * 批量更新设施状态 @@ -26,5 +68,4 @@ public interface GardsNuclearFuelFacilityService extends IService ids, String status); - } diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearReactorsService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearReactorsService.java index bd7f2ae..fd5f0e1 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearReactorsService.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearReactorsService.java @@ -1,13 +1,70 @@ package org.jeecg.service; +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.IService; +import io.swagger.v3.oas.annotations.Operation; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.base.entity.configuration.GardsNuclearReactors; import org.jeecg.modules.base.mapper.GardsNuclearReactorsMapper; +import org.springframework.web.bind.annotation.*; import java.util.List; public interface GardsNuclearReactorsService extends IService { + /** + * 新增 核设施信息 + * + * @param gardsNuclearReactors + * @return + */ + + Result create(@RequestBody GardsNuclearReactors gardsNuclearReactors); + + /** + * 删除反应堆数据 + * + * @param id + * @return + */ + + Result delete(@RequestParam Integer id); + + /** + * 更新反应堆数据 + * + * @param gardsNuclearReactors + * @return + */ + + Result update(@RequestBody GardsNuclearReactors gardsNuclearReactors); + + /** + * 根据Id查询反应堆数据 + * + * @param id + * @return + */ + + Result queryById(@RequestParam Integer id); + + /** + * 分页查询反应堆数据 + * + * @param pageNum 页码 + * @param pageSize 分页大小 + * @param unitName 单位名称 + * @param country 国家 + * @return + */ + + Result> page( Integer pageNum, + Integer pageSize, + String unitName, + String country); + /** * 多条件组合查询 * @return List diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearReleaseService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearReleaseService.java index 56959c0..18cea04 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearReleaseService.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearReleaseService.java @@ -1,21 +1,65 @@ package org.jeecg.service; +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.IService; +import io.swagger.v3.oas.annotations.Operation; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.base.entity.configuration.GardsNuclearReactors; import org.jeecg.modules.base.entity.configuration.GardsNuclearReleaseRecords; +import org.springframework.web.bind.annotation.*; import java.util.List; public interface GardsNuclearReleaseService extends IService { + + /** + * 新增加核设施放射性排放记录信息 + */ + + Result create(GardsNuclearReleaseRecords gardsNuclearReleaseRecords); + + /** + * 删除核设施放射性排放记录信息 + */ + + Result deleteById(Integer id); + + /** + * 更新核设施放射性排放记录信息 + */ + + Result update(GardsNuclearReleaseRecords gardsNuclearReleaseRecords); + + /** + * 查询核设施放射性排放记录信息 + */ + + Result queryById(Integer id); + + /** + * 分页查询 + * + * @param pageNum 页数 + * @param pageSize 每页大小 + * @param facilityName 设施名称 + * @param nuclide 核素 + * @return 分页结果 + */ + + Result> page(Integer pageNum, Integer pageSize, String facilityName, String nuclide); + + /** * 多条件组合查询 - * @param siteName 站点/电厂名称 - * @param nuclide 具体核素 - * @param nuclideType 核素类别 - * @param releaseType 排放类型 + * + * @param facilityName 站点/电厂名称 + * @param nuclide 具体核素 + * @param matterState 物质状态 1-气体,2-气溶胶 * @return List */ - List getByConditions(String siteName, String nuclide, String nuclideType, String releaseType); + List getByConditions(String facilityName, String nuclide, String matterState); } diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearTestingPlantService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearTestingPlantService.java index 8e92373..5cce698 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearTestingPlantService.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsNuclearTestingPlantService.java @@ -1,17 +1,55 @@ package org.jeecg.service; +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.IService; +import io.swagger.v3.oas.annotations.Operation; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.base.entity.configuration.GardsNuclearReleaseRecords; import org.jeecg.modules.base.entity.configuration.GardsNuclearTestingPlant; +import org.springframework.web.bind.annotation.*; import java.util.List; public interface GardsNuclearTestingPlantService extends IService { + /** + * 新增 核试验信息 + */ + + Result create(GardsNuclearTestingPlant gardsNuclearTestingPlant); + + /** + * 删除核设施放射性排放记录信息 + */ + + Result deleteById(Integer id); + + /** + * 更新核设施放射性排放记录信息 + */ + + Result update(GardsNuclearTestingPlant gardsNuclearTestingPlant); + + /** + * 查询核设施放射性排放记录信息 + */ + + Result queryById(Integer id); + + Result> page( + Integer pageNum, + Integer pageSize, + String name, + String type); + + /** * 多条件组合查询 - * @param name 名称 + * + * @param name 名称 * @param type 类型 * @return List */ diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsResearchReactorsService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsResearchReactorsService.java index bbe8ef0..5ad910a 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsResearchReactorsService.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsResearchReactorsService.java @@ -1,13 +1,58 @@ package org.jeecg.service; +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.IService; +import io.swagger.v3.oas.annotations.Operation; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.base.entity.configuration.GardsNuclearTestingPlant; import org.jeecg.modules.base.entity.configuration.GardsResearchReactors; +import org.springframework.web.bind.annotation.*; import java.util.List; public interface GardsResearchReactorsService extends IService { + /** + * 新增信息 + */ + + Result create(@RequestBody GardsResearchReactors gardsResearchReactors); + + /** + * 删除信息 + */ + + Result deleteById(@RequestParam Integer id) ; + + /** + * 更新反应堆信息 + */ + + Result update(@RequestBody GardsResearchReactors gardsResearchReactors) ; + + /** + * 查询信息 + */ + + Result queryById(@RequestParam Integer id) ; + + /** + * 分页查询 + * + * @param pageNum + * @param pageSize + * @param facilityName + * @param country + * @return + */ + + Result> page( + @RequestParam(defaultValue = "1") Integer pageNum, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String facilityName, + @RequestParam(required = false) String country) ; /** * 多条件组合查询 diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsStationsService.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsStationsService.java index a19cb65..9ec2f6f 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsStationsService.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/GardsStationsService.java @@ -1,12 +1,63 @@ package org.jeecg.service; +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.IService; +import io.swagger.v3.oas.annotations.Operation; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.base.entity.configuration.GardsResearchReactors; import org.jeecg.modules.base.entity.configuration.GardsStations; +import org.springframework.web.bind.annotation.*; import java.util.List; public interface GardsStationsService extends IService { + + + + /** + * 新增信息 + */ + + Result create( GardsStations gardsStations) ; + + /** + * 删除信息 + */ + Result deleteById( Integer stationId) ; + + /** + * 更新信息 + */ + Result update( GardsStations gardsStations); + + /** + * 查询信息 + */ + Result queryById( Integer stationId) ; + + /** + * 分页查询 + * + * @param pageNum + * @param pageSize + * @param stationCode + * @param countryCode + * @return + */ + Result> page( + Integer pageNum, + Integer pageSize, + String stationCode, + String countryCode); + + + + + + + /** * 多条件组合查询 * @param stationCode 名称 diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsAcceleratorServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsAcceleratorServiceImpl.java index c396a6d..85c08bb 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsAcceleratorServiceImpl.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsAcceleratorServiceImpl.java @@ -2,11 +2,15 @@ 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.GardsAccelerator; import org.jeecg.modules.base.mapper.GardsAcceleratorMapper; import org.jeecg.service.GardsAcceleratorService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; @Service @@ -14,6 +18,95 @@ import java.util.List; public class GardsAcceleratorServiceImpl extends ServiceImpl implements GardsAcceleratorService { + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result create(GardsAccelerator gardsAccelerator) { + try { + boolean success = this.save(gardsAccelerator); + if (success) { + return Result.OK("添加成功",gardsAccelerator); + } else { + return Result.error("设施信息添加失败"); + } + } catch (Exception e) { + log.error(e.getMessage()); + return Result.error("操作失败"); + } + } + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result delete(Integer id) { + try { + boolean success = this.removeById(id); + if (success) { + return Result.ok("删除成功"); + } else { + return Result.error("设施信息删除失败,可能该记录不存在"); + } + } catch (Exception e) { + log.error(e.getMessage()); + return Result.error("操作失败"); + } + } + + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result update(GardsAccelerator gardsAccelerator) { + try { + boolean success = this.updateById(gardsAccelerator); + if (success) { + return Result.OK("设施信息更新成功",gardsAccelerator); + } else { + return Result.error("设施信息更新失败,可能该记录不存在"); + } + } catch (Exception e) { + log.error(e.getMessage()); + return Result.error("操作失败"); + } + } + + @Override + public Result> queryPage(Integer pageNum, Integer pageSize, String country, String facilityName) + { + try { + Page page = new Page<>(pageNum, pageSize); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (facilityName != null && !facilityName.trim().isEmpty()) { + wrapper.like(GardsAccelerator::getFacilityName, facilityName); + } + if (country != null && !country.trim().isEmpty()) { + wrapper.like(GardsAccelerator::getCountry, country); + } + wrapper.orderByDesc(GardsAccelerator::getId); + + IPage pageResult = this.page(page, wrapper); + return Result.ok(pageResult); + } catch (Exception e) { + log.error("分页查询失败: " + e.getMessage()); + return Result.error("分页查询失败"); + } + + } + + + + + @Override + public Result queryById(Integer id) { + try { + GardsAccelerator facility = this.getById(id); + if (facility != null) { + return Result.ok(facility); + } else { + return Result.error("未找到对应的设施信息"); + } + } catch (Exception e) { + log.error(e.getMessage()); + return Result.error("查询失败"); + } + } + @Override public GardsAccelerator getByFacilityCode(String facilityCode) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsCorrectionFactorServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsCorrectionFactorServiceImpl.java index d0f8e0e..6bb1c8f 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsCorrectionFactorServiceImpl.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsCorrectionFactorServiceImpl.java @@ -2,18 +2,132 @@ 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 io.swagger.v3.oas.annotations.Operation; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.base.entity.configuration.GardsAccelerator; import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor; import org.jeecg.modules.base.mapper.GardsCorrectionFactorMapper; import org.jeecg.service.GardsCorrectionFactorService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; import java.util.List; @Service @DS("ora") -public class GardsCorrectionFactorServiceImpl extends ServiceImpl implements GardsCorrectionFactorService { +public class GardsCorrectionFactorServiceImpl extends ServiceImpl implements GardsCorrectionFactorService { + + + /** + * 新增校正因子 + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result create(@RequestBody GardsCorrectionFactor gardsCorrectionFactor) { + try { + boolean success = this.save(gardsCorrectionFactor); + if (success) { + return Result.OK("校正因子添加成功", gardsCorrectionFactor); + } else { + return Result.error("校正因子添加失败"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + + /** + * 根据ID删除校正因子 + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result delete(Integer id) { + try { + boolean success = this.removeById(id); + if (success) { + return Result.ok("校正因子删除成功"); + } else { + return Result.error("校正因子删除失败,可能该记录不存在"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 更新校正因子信息 + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result update(GardsCorrectionFactor gardsCorrectionFactor) { + try { + boolean success = this.updateById(gardsCorrectionFactor); + if (success) { + return Result.OK("校正因子更新成功", gardsCorrectionFactor); + } else { + return Result.error("校正因子更新失败,可能该记录不存在"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 根据ID查询校正因子详情 + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result queryById(Integer id) { + try { + GardsCorrectionFactor factor = this.getById(id); + if (factor != null) { + return Result.OK("查询成功", factor); + } else { + return Result.error("未找到对应的校正因子信息"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 分页查询校正因子列表 + */ + @Override + public Result> page( + @RequestParam(defaultValue = "1") Integer pageNum, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String stationCode, + @RequestParam(required = false) String detectorCode) { + try { + Page page = new Page<>(pageNum, pageSize); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (stationCode != null && !stationCode.trim().isEmpty()) { + wrapper.like(GardsCorrectionFactor::getStationCode, stationCode); + } + if (detectorCode != null && !detectorCode.trim().isEmpty()) { + wrapper.like(GardsCorrectionFactor::getDetectorCode, detectorCode); + } + wrapper.orderByDesc(GardsCorrectionFactor::getId); + IPage pageResult = this.page(page, wrapper); + return Result.OK("分页查询成功", pageResult); + } catch (Exception e) { + log.error("分页查询失败: " + e.getMessage()); + return Result.error("分页查询失败"); + } + } + @Override public List getByStationCode(String stationCode) { @@ -57,18 +171,18 @@ public class GardsCorrectionFactorServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); if (stationCode != null && !stationCode.trim().isEmpty()) { - wrapper.eq(GardsCorrectionFactor::getStationCode, stationCode); + wrapper.like(GardsCorrectionFactor::getStationCode, stationCode); } if (detectorCode != null && !detectorCode.trim().isEmpty()) { - wrapper.eq(GardsCorrectionFactor::getDetectorCode, detectorCode); + wrapper.like(GardsCorrectionFactor::getDetectorCode, detectorCode); } if (manufacturer != null && !manufacturer.trim().isEmpty()) { - wrapper.eq(GardsCorrectionFactor::getManufacturer, manufacturer); + wrapper.like(GardsCorrectionFactor::getManufacturer, manufacturer); } if (model != null && !model.trim().isEmpty()) { - wrapper.eq(GardsCorrectionFactor::getModel, model); + wrapper.like(GardsCorrectionFactor::getModel, model); } - + wrapper.orderByDesc(GardsCorrectionFactor::getId); return this.list(wrapper); } diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearFuelFacilityServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearFuelFacilityServiceImpl.java index 485b7ca..ce83b3c 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearFuelFacilityServiceImpl.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearFuelFacilityServiceImpl.java @@ -2,16 +2,133 @@ 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 io.swagger.v3.oas.annotations.Operation; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.base.entity.configuration.GardsNuclearFuelFacilities; import org.jeecg.modules.base.mapper.GardsNuclearFuelFacilitiesMapper; import org.jeecg.service.GardsNuclearFuelFacilityService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; import java.util.List; + @Service @DS("ora") -public class GardsNuclearFuelFacilityServiceImpl extends ServiceImpl implements GardsNuclearFuelFacilityService { +public class GardsNuclearFuelFacilityServiceImpl extends ServiceImpl implements GardsNuclearFuelFacilityService { + + + /** + * 新增核燃料设施信息 + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result create(GardsNuclearFuelFacilities facility) { + try { + boolean success = this.save(facility); + if (success) { + return Result.OK("核燃料设施信息添加成功", facility); + } else { + return Result.error("核燃料设施信息添加失败"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 根据ID删除核燃料设施信息 + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result delete(Integer id) { + try { + boolean success = this.removeById(id); + if (success) { + return Result.ok("核燃料设施信息删除成功"); + } else { + return Result.error("核燃料设施信息删除失败,可能该记录不存在"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("操作失败 "); + } + } + + /** + * 更新核燃料设施信息 + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result update(GardsNuclearFuelFacilities facility) { + try { + boolean success = this.updateById(facility); + if (success) { + return Result.OK("核燃料设施信息更新成功", facility); + } else { + return Result.error("核燃料设施信息更新失败,可能该记录不存在"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 根据ID查询核燃料设施详情 + */ + @Override + public Result queryById(Integer id) { + try { + GardsNuclearFuelFacilities facility = this.getById(id); + if (facility != null) { + return Result.ok(facility); + } else { + return Result.error("未找到对应的核燃料设施信息"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("查询失败"); + } + } + + /** + * 分页查询核燃料设施列表 + */ + @Override + public Result> page( + Integer pageNum, Integer pageSize, + String facilityType, String facilityStatus, String facilityName, + String country) { + try { + Page page = new Page<>(pageNum, pageSize); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (facilityType != null && !facilityType.trim().isEmpty()) { + wrapper.like(GardsNuclearFuelFacilities::getFacilityType, facilityType); + } + if (facilityStatus != null && !facilityStatus.trim().isEmpty()) { + wrapper.like(GardsNuclearFuelFacilities::getFacilityStatus, facilityStatus); + } + if (facilityName != null && !facilityName.trim().isEmpty()) { + wrapper.like(GardsNuclearFuelFacilities::getFacilityName, facilityName); + } + if (country != null && !country.trim().isEmpty()) { + wrapper.like(GardsNuclearFuelFacilities::getCountry, country); + } + wrapper.orderByDesc(GardsNuclearFuelFacilities::getId); + IPage pageResult = this.page(page, wrapper); + return Result.OK("分页查询成功", pageResult); + } catch ( + Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("分页查询失败"); + } + } @Override @@ -22,25 +139,25 @@ public class GardsNuclearFuelFacilityServiceImpl extends ServiceImpl getByConditions(String facilityType, String facilityStatus, String country,String facilityName, String fuelType) { + public List getByConditions(String facilityType, String facilityStatus, String country, String facilityName, String fuelType) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); if (facilityType != null && !facilityType.trim().isEmpty()) { - wrapper.eq(GardsNuclearFuelFacilities::getFacilityType, facilityType); + wrapper.like(GardsNuclearFuelFacilities::getFacilityType, facilityType); } if (facilityStatus != null && !facilityStatus.trim().isEmpty()) { - wrapper.eq(GardsNuclearFuelFacilities::getFacilityStatus, facilityStatus); + wrapper.like(GardsNuclearFuelFacilities::getFacilityStatus, facilityStatus); } if (country != null && !country.trim().isEmpty()) { - wrapper.eq(GardsNuclearFuelFacilities::getCountry, country); + wrapper.like(GardsNuclearFuelFacilities::getCountry, country); } if (facilityName != null && !facilityName.trim().isEmpty()) { - wrapper.eq(GardsNuclearFuelFacilities::getFacilityName, facilityName); + wrapper.like(GardsNuclearFuelFacilities::getFacilityName, facilityName); } if (fuelType != null && !fuelType.trim().isEmpty()) { - wrapper.eq(GardsNuclearFuelFacilities::getFuelType, fuelType); + wrapper.like(GardsNuclearFuelFacilities::getFuelType, fuelType); } - + wrapper.orderByDesc(GardsNuclearFuelFacilities::getId); return this.list(wrapper); } diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearReactorsServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearReactorsServiceImpl.java index 4b6247f..a0a7d1f 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearReactorsServiceImpl.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearReactorsServiceImpl.java @@ -2,38 +2,178 @@ 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 io.swagger.v3.oas.annotations.Operation; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.base.entity.configuration.GardsNuclearFuelFacilities; import org.jeecg.modules.base.entity.configuration.GardsNuclearReactors; import org.jeecg.modules.base.mapper.GardsNuclearReactorsMapper; import org.jeecg.service.GardsNuclearReactorsService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; import java.util.List; + @Service @DS("ora") public class GardsNuclearReactorsServiceImpl extends ServiceImpl implements GardsNuclearReactorsService { + + /** + * 新增 核设施信息 + * + * @param gardsNuclearReactors + * @return + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result create(GardsNuclearReactors gardsNuclearReactors) { + + try { + boolean success = this.save(gardsNuclearReactors); + if (success) { + return Result.OK("添加核设施信息成功", gardsNuclearReactors); + } else { + return Result.error("添加核设施信息失败"); + } + } catch (Exception e) { + log.error("新增操作失败: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 删除反应堆数据 + * + * @param id + * @return + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result delete(Integer id) { + try { + boolean success = this.removeById(id); + if (success) { + return Result.ok("核设施信息删除成功"); + } + return Result.error("删除核设施信息失败,可能该记录不存在"); + + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 更新反应堆数据 + * + * @param gardsNuclearReactors + * @return + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result update(GardsNuclearReactors gardsNuclearReactors) { + try { + boolean success = this.updateById(gardsNuclearReactors); + if (success) { + return Result.OK("更新成功", gardsNuclearReactors); + } else { + return Result.error("更新失败,或者记录不存在"); + + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 根据Id查询反应堆数据 + * + * @param id + * @return + */ + @Override + public Result queryById(Integer id) { + try { + GardsNuclearReactors nuclearReactors = this.getById(id); + if (nuclearReactors != null) { + return Result.OK(nuclearReactors); + } else { + return Result.error("未找到核设施信息数据"); + } + } catch (Exception e) { + log.error("操作失败: " + e.getMessage()); + return Result.error("查询失败"); + } + + } + + /** + * 分页查询反应堆数据 + * + * @param pageNum 页码 + * @param pageSize 分页大小 + * @param unitName 单位名称 + * @param country 国家 + * @return IPage + */ + @Override + public Result> page( + Integer pageNum, + Integer pageSize, + String unitName, + String country) { + + try { + Page page = new Page<>(pageNum, pageSize); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (unitName != null && !unitName.trim().isEmpty()) { + wrapper.like(GardsNuclearReactors::getUnitName, unitName); + } + if (country != null && !country.trim().isEmpty()) { + wrapper.like(GardsNuclearReactors::getCountry, country); + } + wrapper.orderByDesc(GardsNuclearReactors::getId); + IPage pageResult = this.page(page, wrapper); + + return Result.OK(pageResult); + } catch (Exception e) { + log.error("查询失败: " + e.getMessage()); + return Result.error("查询失败"); + } + + + } + + @Override public List getByConditions(String unitName, String country, String reactorType, String reactorStatus) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); if (unitName != null && !unitName.trim().isEmpty()) { - wrapper.eq(GardsNuclearReactors::getUnitName, unitName); + wrapper.like(GardsNuclearReactors::getUnitName, unitName); } if (country != null && !country.trim().isEmpty()) { - wrapper.eq(GardsNuclearReactors::getCountry, country); + wrapper.like(GardsNuclearReactors::getCountry, country); } if (reactorType != null && !reactorType.trim().isEmpty()) { - wrapper.eq(GardsNuclearReactors::getReactorType, reactorType); + wrapper.like(GardsNuclearReactors::getReactorType, reactorType); } if (reactorStatus != null && !reactorStatus.trim().isEmpty()) { - wrapper.eq(GardsNuclearReactors::getReactorStatus, reactorStatus); + wrapper.like(GardsNuclearReactors::getReactorStatus, reactorStatus); } + wrapper.orderByDesc(GardsNuclearReactors::getId); return this.list(wrapper); } + @Transactional(rollbackFor = Exception.class) @Override public void saveOrUpdateBatchByUniqueFields(List list) { -this.saveOrUpdateBatch(list); + this.saveOrUpdateBatch(list); } } diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearReleaseServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearReleaseServiceImpl.java index 9c0855b..6247a20 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearReleaseServiceImpl.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearReleaseServiceImpl.java @@ -2,33 +2,156 @@ 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 io.swagger.v3.oas.annotations.Operation; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.base.entity.configuration.GardsNuclearReactors; import org.jeecg.modules.base.entity.configuration.GardsNuclearReleaseRecords; import org.jeecg.modules.base.mapper.GardsNuclearReleaseRecordsMapper; import org.jeecg.service.GardsNuclearReleaseService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; import java.util.List; @Service @DS("ora") public class GardsNuclearReleaseServiceImpl extends ServiceImpl implements GardsNuclearReleaseService { + + + /** + * 新增加核设施放射性排放记录信息 + */ @Override - public List getByConditions(String siteName, String nuclide, String nuclideType, String releaseType) { + @Transactional(rollbackFor = RuntimeException.class) + public Result create(@RequestBody GardsNuclearReleaseRecords gardsNuclearReleaseRecords) { + try { + boolean success = this.save(gardsNuclearReleaseRecords); + if (success) { + return Result.OK("添加成功", gardsNuclearReleaseRecords); + } else { + return Result.error("添加失败"); + } + } catch (Exception e) { + log.error("create: " + e.getMessage()); + return Result.error("添加失败"); + } + } + + /** + * 删除核设施放射性排放记录信息 + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result deleteById(@RequestParam 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(@RequestBody GardsNuclearReleaseRecords gardsNuclearReleaseRecords) { + try { + boolean success = this.updateById(gardsNuclearReleaseRecords); + if (success) { + return Result.OK("数据更新成功", gardsNuclearReleaseRecords); + } else { + return Result.error("数据更新失败"); + + } + } catch (Exception e) { + log.error("update: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 查询核设施放射性排放记录信息 + */ + @Override + public Result queryById(@RequestParam Integer id) { + try { + GardsNuclearReleaseRecords 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("查询失败"); + } + } + + /** + * 分页查询 + * + * @param pageNum 页数 + * @param pageSize 每页大小 + * @param facilityName 设施名称 + * @param nuclide 核素 + * @return 分页结果 + */ + @Override + public Result> page( + @RequestParam(defaultValue = "1") Integer pageNum, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String facilityName, + @RequestParam(required = false) String nuclide) { + + try { + Page page = new Page<>(pageNum, pageSize); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (facilityName != null && !facilityName.trim().isEmpty()) { + wrapper.like(GardsNuclearReleaseRecords::getFacilityName, facilityName); + } + if (nuclide != null && !nuclide.trim().isEmpty()) { + wrapper.like(GardsNuclearReleaseRecords::getNuclide, nuclide); + } + wrapper.orderByDesc(GardsNuclearReleaseRecords::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 facilityName, String nuclide, String matterState) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - if (siteName != null && !siteName.trim().isEmpty()) { - queryWrapper.eq(GardsNuclearReleaseRecords::getSiteName, siteName); + if (facilityName != null && !facilityName.trim().isEmpty()) { + queryWrapper.like(GardsNuclearReleaseRecords::getFacilityName, facilityName); } if (nuclide != null && !nuclide.trim().isEmpty()) { - queryWrapper.eq(GardsNuclearReleaseRecords::getNuclide, nuclide); + queryWrapper.like(GardsNuclearReleaseRecords::getNuclide, nuclide); } - if (nuclideType != null && !nuclideType.trim().isEmpty()) { - queryWrapper.eq(GardsNuclearReleaseRecords::getNuclideType, nuclideType); - } - if (releaseType != null && !releaseType.trim().isEmpty()) { - queryWrapper.eq(GardsNuclearReleaseRecords::getReleaseType, releaseType); + + if (matterState != null && !matterState.trim().isEmpty()) { + queryWrapper.like(GardsNuclearReleaseRecords::getMatterState, matterState); } + queryWrapper.orderByDesc(GardsNuclearReleaseRecords::getId); return this.list(queryWrapper); } } diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearTestingPlantServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearTestingPlantServiceImpl.java index f3ef85a..244310b 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearTestingPlantServiceImpl.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsNuclearTestingPlantServiceImpl.java @@ -2,28 +2,145 @@ 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 io.swagger.v3.oas.annotations.Operation; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.base.entity.configuration.GardsNuclearTestingPlant; import org.jeecg.modules.base.mapper.GardsNuclearTestingPlantMapper; import org.jeecg.service.GardsNuclearTestingPlantService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; import java.util.List; @Service @DS("ora") public class GardsNuclearTestingPlantServiceImpl extends ServiceImpl implements GardsNuclearTestingPlantService { + + + /** + * 新增 核试验信息 + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result create(@RequestBody GardsNuclearTestingPlant gardsNuclearTestingPlant) { + try { + boolean success = this.save(gardsNuclearTestingPlant); + if (success) { + return Result.OK("添加成功", gardsNuclearTestingPlant); + } else { + return Result.error("添加失败"); + } + } catch (Exception e) { + log.error("create: " + e.getMessage()); + return Result.error("添加失败"); + } + } + + /** + * 删除核设施放射性排放记录信息 + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result deleteById(@RequestParam 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(@RequestBody GardsNuclearTestingPlant gardsNuclearTestingPlant) { + try { + boolean success = this.updateById(gardsNuclearTestingPlant); + if (success) { + return Result.OK("数据更新成功", gardsNuclearTestingPlant); + } else { + return Result.error("数据更新失败"); + + } + } catch (Exception e) { + log.error("update: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 查询核设施放射性排放记录信息 + */ + @Override + public Result queryById(@RequestParam Integer id) { + try { + GardsNuclearTestingPlant 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("查询失败:" + e.getMessage()); + } + } + + public Result> page( + @RequestParam(defaultValue = "1") Integer pageNum, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String name, + @RequestParam(required = false) String type) { + + try { + Page page = new Page<>(pageNum, pageSize); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (name != null && !name.trim().isEmpty()) { + wrapper.like(GardsNuclearTestingPlant::getName, name); + } + if (type != null && !type.trim().isEmpty()) { + wrapper.like(GardsNuclearTestingPlant::getCountry, type); + } + wrapper.orderByDesc(GardsNuclearTestingPlant::getId); + IPage pageResult = this.page(page, wrapper); + + return Result.OK(pageResult); + } catch (Exception e) { + log.error("page: " + e.getMessage()); + return Result.error("查询失败:" + e.getMessage()); + } + + + } + + + @Override public List getByConditions(String name, String type) { LambdaQueryWrapper query = new LambdaQueryWrapper<>(); if (name != null&&!name.trim().isEmpty()) { - query.eq(GardsNuclearTestingPlant::getName, name); + query.like(GardsNuclearTestingPlant::getName, name); } if (type != null&&!type.trim().isEmpty()) { - query.eq(GardsNuclearTestingPlant::getCountry, type); + query.like(GardsNuclearTestingPlant::getCountry, type); } + query.orderByDesc(GardsNuclearTestingPlant::getId); return this.list(query); } } diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsResearchReactorsServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsResearchReactorsServiceImpl.java index 368eb79..a05a086 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsResearchReactorsServiceImpl.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsResearchReactorsServiceImpl.java @@ -2,33 +2,158 @@ 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 io.swagger.v3.oas.annotations.Operation; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.base.entity.configuration.GardsNuclearTestingPlant; import org.jeecg.modules.base.entity.configuration.GardsResearchReactors; import org.jeecg.modules.base.mapper.GardsResearchReactorsMapper; import org.jeecg.service.GardsResearchReactorsService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; import java.util.List; @Service @DS("ora") public class GardsResearchReactorsServiceImpl extends ServiceImpl implements GardsResearchReactorsService { + + /** + * 新增信息 + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result create( GardsResearchReactors gardsResearchReactors) { + try { + boolean success = this.save(gardsResearchReactors); + if (success) { + return Result.OK("反应堆信息添加成功", gardsResearchReactors); + } 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( GardsResearchReactors gardsResearchReactors) { + try { + boolean success = this.updateById(gardsResearchReactors); + if (success) { + return Result.OK("数据更新成功", gardsResearchReactors); + } else { + return Result.error("数据更新失败"); + + } + } catch (Exception e) { + log.error("update: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 查询信息 + */ + @Override + public Result queryById( Integer id) { + try { + GardsResearchReactors 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("查询失败"); + } + } + + /** + * 分页查询 + * + * @param pageNum + * @param pageSize + * @param facilityName + * @param country + * @return + */ + @Override + public Result> page( + Integer pageNum, + Integer pageSize, + String facilityName, + String country) { + + try { + Page page = new Page<>(pageNum, pageSize); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (facilityName != null && !facilityName.trim().isEmpty()) { + wrapper.like(GardsResearchReactors::getFacilityName, facilityName); + } + if (country != null && !country.trim().isEmpty()) { + wrapper.like(GardsResearchReactors::getCountry, country); + } + wrapper.orderByDesc(GardsResearchReactors::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 facilityName, String country,String reactorType,String status) { LambdaQueryWrapper query = new LambdaQueryWrapper<>(); if (facilityName != null&&!facilityName.trim().isEmpty()) { - query.eq(GardsResearchReactors::getFacilityName, facilityName); + query.like(GardsResearchReactors::getFacilityName, facilityName); } if (country != null&&!country.trim().isEmpty()) { - query.eq(GardsResearchReactors::getCountry, country); + query.like(GardsResearchReactors::getCountry, country); } if (reactorType != null&&!reactorType.trim().isEmpty()) { - query.eq(GardsResearchReactors::getReactorType, reactorType); + query.like(GardsResearchReactors::getReactorType, reactorType); } if (status != null&&!status.trim().isEmpty()) { - query.eq(GardsResearchReactors::getStatus, status); + query.like(GardsResearchReactors::getStatus, status); } + query.orderByDesc(GardsResearchReactors::getId); return this.list(query); } } diff --git a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsStationsServiceImpl.java b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsStationsServiceImpl.java index 1b0cfd0..4214436 100644 --- a/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsStationsServiceImpl.java +++ b/jeecg-module-monitor-info-database/src/main/java/org/jeecg/service/impl/GardsStationsServiceImpl.java @@ -2,12 +2,18 @@ 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 io.swagger.v3.oas.annotations.Operation; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.base.entity.configuration.GardsResearchReactors; import org.jeecg.modules.base.entity.configuration.GardsStations; import org.jeecg.modules.base.mapper.GardsStationsMapper; import org.jeecg.service.GardsStationsService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; import java.util.List; @Service @@ -15,23 +21,142 @@ import java.util.List; public class GardsStationsServiceImpl extends ServiceImpl implements GardsStationsService { + /** + * 新增信息 + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result create( GardsStations gardsStations) { + try { + if (gardsStations.getStationCode().length()>5){ + return Result.error("添加失败:StationCode 最大长度为5,实际长度是:"+gardsStations.getStationCode().length()); + } + + boolean success = this.save(gardsStations); + if (success) { + return Result.OK("添加成功", gardsStations); + } else { + return Result.error("添加失败"); + } + } catch (Exception e) { + log.error("create: " + e.getMessage()); + return Result.error("添加失败"); + } + } + + /** + * 删除信息 + */ + @Override + @Transactional(rollbackFor = RuntimeException.class) + public Result deleteById( Integer stationId) { + try { + boolean success = this.removeById(stationId); + 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(GardsStations gardsStations) { + try { + boolean success = this.updateById(gardsStations); + if (success) { + return Result.OK("数据更新成功", gardsStations); + } else { + return Result.error("数据更新失败"); + + } + } catch (Exception e) { + log.error("update: " + e.getMessage()); + return Result.error("操作失败"); + } + } + + /** + * 查询信息 + */ + @Override + public Result queryById( Integer stationId) { + try { + GardsStations nuclearReactors = this.getById(stationId); + if (nuclearReactors != null) { + return Result.OK(nuclearReactors); + } else { + return Result.error("未找到数据"); + } + } catch (Exception e) { + log.error("getById: " + e.getMessage()); + return Result.error("查询失败" ); + } + } + + /** + * 分页查询 + * + * @param pageNum + * @param pageSize + * @param stationCode + * @param countryCode + * @return + */ + @Override + public Result> page( + Integer pageNum, + Integer pageSize, + String stationCode, + String countryCode) { + + try { + Page page = new Page<>(pageNum, pageSize); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (stationCode != null && !stationCode.trim().isEmpty()) { + wrapper.like(GardsStations::getStationCode, stationCode); + } + if (countryCode != null && !countryCode.trim().isEmpty()) { + wrapper.like(GardsStations::getCountryCode, countryCode); + } + wrapper.orderByDesc(GardsStations::getStationId); + 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 stationCode, String type, String status,String countryCode) { LambdaQueryWrapper query = new LambdaQueryWrapper<>(); if (stationCode != null&&!stationCode.trim().isEmpty()) { - query.eq(GardsStations::getStationCode, stationCode); + query.like(GardsStations::getStationCode, stationCode); } if (type != null&&!type.trim().isEmpty()) { - query.eq(GardsStations::getType, type); + query.like(GardsStations::getType, type); } if (status != null&&!status.trim().isEmpty()) { - query.eq(GardsStations::getStatus, status); + query.like(GardsStations::getStatus, status); } if (countryCode != null&&!countryCode.trim().isEmpty()) { - query.eq(GardsStations::getCountryCode, countryCode); + query.like(GardsStations::getCountryCode, countryCode); } - + query.orderByDesc(GardsStations::getStationId); return this.list(query); } }