修改监测综合信息库查询为模糊查询

This commit is contained in:
duwenyuan 2025-12-18 15:13:06 +08:00
parent 989710266b
commit b2a591e366
25 changed files with 1737 additions and 885 deletions

View File

@ -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<GardsAccelerator> 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);
}
/**
@ -126,117 +88,106 @@ public class GardsAcceleratorController {
@RequestParam(required = false) String country,
@RequestParam(required = false) String facilityName
) {
try {
Page<GardsAccelerator> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsAccelerator> 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<GardsAccelerator> 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<GardsAccelerator>> list() {
try {
List<GardsAccelerator> 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<GardsAccelerator>> list() {
// try {
// List<GardsAccelerator> 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<GardsAccelerator> 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<List<GardsAccelerator>> getByCountry(@RequestParam String country) {
// try {
// List<GardsAccelerator> 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<List<GardsAccelerator>> getByOperationalStatus(@RequestParam Integer isOperational) {
// try {
// List<GardsAccelerator> list = gardsAcceleratorService.getByOperationalStatus(isOperational);
// return Result.ok(list);
// } catch (Exception e) {
// log.error("查询失败: " + e.getMessage());
// return Result.error("查询失败");
// }
// }
//
// /**
// * 条件组合查询
// */
// @GetMapping("/search")
// @Operation(summary = "条件组合查询")
// public Result<List<GardsAccelerator>> search(
// @RequestParam(required = false) String country,
// @RequestParam(required = false) String category,
// @RequestParam(required = false) Integer isOperational) {
// try {
// LambdaQueryWrapper<GardsAccelerator> 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<GardsAccelerator> 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<GardsAccelerator> 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<List<GardsAccelerator>> getByCountry(@RequestParam String country) {
try {
List<GardsAccelerator> 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<List<GardsAccelerator>> getByOperationalStatus(@RequestParam Integer isOperational) {
try {
List<GardsAccelerator> list = gardsAcceleratorService.getByOperationalStatus(isOperational);
return Result.ok(list);
} catch (Exception e) {
log.error("查询失败: " + e.getMessage());
return Result.error("查询失败");
}
}
/**
* 条件组合查询
*/
@GetMapping("/search")
@Operation(summary = "条件组合查询")
public Result<List<GardsAccelerator>> search(
@RequestParam(required = false) String country,
@RequestParam(required = false) String category,
@RequestParam(required = false) Integer isOperational) {
try {
LambdaQueryWrapper<GardsAccelerator> 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<GardsAccelerator> 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<GardsAccelerator> 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<GardsAccelerator> list = gardsAcceleratorService.list(wrapper);
ExcelExportUtil.exportExcel(params, GardsAccelerator.class, list).write(response.getOutputStream());
}

View File

@ -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<GardsCorrectionFactor> 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<GardsCorrectionFactor> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsCorrectionFactor> 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);
return gardsCorrectionFactorService.page(pageNum, pageSize, stationCode, detectorCode);
}
IPage<GardsCorrectionFactor> pageResult = gardsCorrectionFactorService.page(page, wrapper);
return Result.OK ("分页查询成功", pageResult);
} catch (Exception e) {
log.error("分页查询失败: " + e.getMessage());
return Result.error("分页查询失败");
}
}
/**
* 查询所有校正因子列表
*/
@GetMapping("/list")
@Operation(summary = "查询所有校正因子列表")
public Result<List<GardsCorrectionFactor>> list() {
try {
List<GardsCorrectionFactor> list = gardsCorrectionFactorService.list();
return Result.OK ("查询成功", list);
} catch (Exception e) {
log.error("查询失败: " + e.getMessage());
return Result.error("查询失败" );
}
}
/**
* 根据站点代码查询
*/
@GetMapping("/by-station")
@Operation(summary = "根据站点代码查询")
public Result<List<GardsCorrectionFactor>> getByStationCode(@RequestParam(name = "stationCode") String stationCode) {
try {
List<GardsCorrectionFactor> 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<List<GardsCorrectionFactor>> getByDetectorCode(@RequestParam(name="detectorCode") String detectorCode) {
try {
List<GardsCorrectionFactor> 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<List<GardsCorrectionFactor>> getByStationAndDetector(
@RequestParam String stationCode,
@RequestParam String detectorCode) {
try {
List<GardsCorrectionFactor> 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<List<GardsCorrectionFactor>> getByManufacturer(@RequestParam String manufacturer) {
try {
List<GardsCorrectionFactor> 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<List<GardsCorrectionFactor>> getByModel(@RequestParam String model) {
try {
List<GardsCorrectionFactor> list = gardsCorrectionFactorService.getByModel(model);
return Result.OK ("查询成功", list);
} catch (Exception e) {
log.error("查询失败: " + e.getMessage());
return Result.error("查询失败");
}
}
/**
* 多条件组合查询
*/
@GetMapping("/search")
@Operation(summary = "校正因子多条件组合查询")
public Result<List<GardsCorrectionFactor>> search(
@RequestParam(required = false) String stationCode,
@RequestParam(required = false) String detectorCode,
@RequestParam(required = false) String manufacturer,
@RequestParam(required = false) String model) {
try {
List<GardsCorrectionFactor> 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<GardsCorrectionFactor> 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<GardsCorrectionFactor>> list() {
// try {
// List<GardsCorrectionFactor> list = gardsCorrectionFactorService.list();
// return Result.OK ("查询成功", list);
// } catch (Exception e) {
// log.error("查询失败: " + e.getMessage());
// return Result.error("查询失败" );
// }
// }
//
// /**
// * 根据站点代码查询
// */
// @GetMapping("/by-station")
// @Operation(summary = "根据站点代码查询")
// public Result<List<GardsCorrectionFactor>> getByStationCode(@RequestParam(name = "stationCode") String stationCode) {
// try {
// List<GardsCorrectionFactor> 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<List<GardsCorrectionFactor>> getByDetectorCode(@RequestParam(name="detectorCode") String detectorCode) {
// try {
// List<GardsCorrectionFactor> 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<List<GardsCorrectionFactor>> getByStationAndDetector(
// @RequestParam String stationCode,
// @RequestParam String detectorCode) {
// try {
// List<GardsCorrectionFactor> 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<List<GardsCorrectionFactor>> getByManufacturer(@RequestParam String manufacturer) {
// try {
// List<GardsCorrectionFactor> 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<List<GardsCorrectionFactor>> getByModel(@RequestParam String model) {
// try {
// List<GardsCorrectionFactor> list = gardsCorrectionFactorService.getByModel(model);
// return Result.OK ("查询成功", list);
// } catch (Exception e) {
// log.error("查询失败: " + e.getMessage());
// return Result.error("查询失败");
// }
// }
//
// /**
// * 多条件组合查询
// */
// @GetMapping("/search")
// @Operation(summary = "校正因子多条件组合查询")
// public Result<List<GardsCorrectionFactor>> search(
// @RequestParam(required = false) String stationCode,
// @RequestParam(required = false) String detectorCode,
// @RequestParam(required = false) String manufacturer,
// @RequestParam(required = false) String model) {
// try {
// List<GardsCorrectionFactor> 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<GardsCorrectionFactor> 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 = "导出模版")

View File

@ -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<GardsNuclearFuelFacilities> 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<GardsNuclearFuelFacilities> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsNuclearFuelFacilities> 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);
return nuclearFuelFacilitiesService.page(pageNum, pageSize, facilityType, facilityStatus, facilityName, country);
}
IPage<GardsNuclearFuelFacilities> pageResult = nuclearFuelFacilitiesService.page(page, wrapper);
return Result.OK("分页查询成功", pageResult);
} catch (Exception e) {
log.error("操作失败: " + e.getMessage());
return Result.error("分页查询失败");
}
}
//region 注释代码
/**
* 查询所有核燃料设施列表
*/
@GetMapping("/list")
@Operation(summary = "查询所有核燃料设施列表")
public Result<List<GardsNuclearFuelFacilities>> list() {
try {
List<GardsNuclearFuelFacilities> list = nuclearFuelFacilitiesService.list();
return Result.OK("查询成功", list);
} catch (Exception e) {
log.error("操作失败: " + e.getMessage());
return Result.error("查询失败");
}
}
// /**
// * 查询所有核燃料设施列表
// */
// @GetMapping("/list")
// @Operation(summary = "查询所有核燃料设施列表")
// public Result<List<GardsNuclearFuelFacilities>> list() {
// try {
// List<GardsNuclearFuelFacilities> list = nuclearFuelFacilitiesService.list();
// return Result.OK("查询成功", list);
// } catch (Exception e) {
// log.error("操作失败: " + e.getMessage());
// return Result.error("查询失败");
// }
// }
//
// /**
// * 根据设施名称模糊查询
// */
// @GetMapping("/by-name")
// @Operation(summary = "根据设施名称模糊查询")
// public Result<List<GardsNuclearFuelFacilities>> getByFacilityNameLike(@RequestParam String facilityName) {
// try {
// List<GardsNuclearFuelFacilities> list = nuclearFuelFacilitiesService.getByFacilityNameLike(facilityName);
// return Result.OK("查询成功", list);
// } catch (Exception e) {
// log.error("操作失败: " + e.getMessage());
// return Result.error("查询失败");
// }
// }
//
//
// /**
// * 多条件组合查询
// */
// @GetMapping("/search")
// @Operation(summary = "多条件组合查询")
// public Result<List<GardsNuclearFuelFacilities>> 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<GardsNuclearFuelFacilities> list = nuclearFuelFacilitiesService.getByConditions(
// facilityType, facilityStatus, country, facilityName, fuelType);
// return Result.OK("查询成功", list);
// } catch (Exception e) {
// log.error("操作失败: " + e.getMessage());
// return Result.error("条件查询失败");
// }
// }
/**
* 根据设施名称模糊查询
*/
@GetMapping("/by-name")
@Operation(summary = "根据设施名称模糊查询")
public Result<List<GardsNuclearFuelFacilities>> getByFacilityNameLike(@RequestParam String facilityName) {
try {
List<GardsNuclearFuelFacilities> list = nuclearFuelFacilitiesService.getByFacilityNameLike(facilityName);
return Result.OK("查询成功", list);
} catch (Exception e) {
log.error("操作失败: " + e.getMessage());
return Result.error("查询失败");
}
}
/**
* 多条件组合查询
*/
@GetMapping("/search")
@Operation(summary = "多条件组合查询")
public Result<List<GardsNuclearFuelFacilities>> 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<GardsNuclearFuelFacilities> 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 = "导出模版")

View File

@ -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<GardsNuclearReactors> 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<GardsNuclearReactors> 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<GardsNuclearReactors> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsNuclearReactors> 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<GardsNuclearReactors> 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<List<GardsNuclearReactors>> search(@RequestParam(required = false) String unitName,
@RequestParam(required = false) String country,
@RequestParam(required = false) String reactorType,
@RequestParam(required = false) String reactorStatus) {
//region 注释代码
try {
List<GardsNuclearReactors> 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<List<GardsNuclearReactors>> search(@RequestParam(required = false) String unitName,
// @RequestParam(required = false) String country,
// @RequestParam(required = false) String reactorType,
// @RequestParam(required = false) String reactorStatus) {
//
// try {
// List<GardsNuclearReactors> 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 = "核设施信息导出模版")

View File

@ -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<GardsNuclearReleaseRecords> 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<IPage<GardsNuclearReleaseRecords>> 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<GardsNuclearReleaseRecords> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsNuclearReleaseRecords> 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<GardsNuclearReleaseRecords> 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<List<GardsNuclearReleaseRecords>> 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<List<GardsNuclearReleaseRecords>> search(
// @RequestParam(required = false) String siteName,
// @RequestParam(required = false) String nuclide,
// @RequestParam(required = false) String nuclideType,
// @RequestParam(required = false) String releaseType) {
//
// try {
// List<GardsNuclearReleaseRecords> list = gardsNuclearReleaseService.getByConditions(siteName, nuclide, nuclideType, releaseType);
// return Result.OK(list);
// } catch (Exception e) {
// log.error("条件查询失败: " + e.getMessage());
// return Result.error("查询失败");
// }
//
// }
try {
List<GardsNuclearReleaseRecords> 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<GardsNuclearReleaseRecords> list = gardsNuclearReleaseService.getByConditions(siteName, nuclide, nuclideType, releaseType);
List<GardsNuclearReleaseRecords> list = gardsNuclearReleaseService.getByConditions(facilityName, nuclide, matterState);
ExcelExportUtil.exportExcel(params, GardsNuclearReleaseRecords.class, list).write(response.getOutputStream());
}

View File

@ -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<GardsNuclearTestingPlant> 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<GardsNuclearTestingPlant> page = new Page<>(pageNum, pageSize);

View File

@ -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<GardsResearchReactors> 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<GardsResearchReactors> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsResearchReactors> 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<GardsResearchReactors> 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);
}

View File

@ -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<GardsStations> 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<GardsStations> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsStations> 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<GardsStations> 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);
}
/**

View File

@ -1,4 +0,0 @@
package org.jeecg.controller;
public class Test {
}

View File

@ -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<GardsAccelerator> {
Result<?> create(GardsAccelerator gardsAccelerator);
Result<?> delete(Integer id);
Result<?> update(GardsAccelerator gardsAccelerator);
Result<GardsAccelerator> queryById(Integer id);
Result<IPage<GardsAccelerator>> queryPage(Integer pageNum, Integer pageSize, String country, String facilityName);
/**
* 根据设施代码查询设施信息
* 根据设施代码查询设施信息
*/
GardsAccelerator getByFacilityCode(String facilityCode);

View File

@ -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<GardsCorrectionFactor> {
/**
* 新增校正因子
*/
Result<?> create(GardsCorrectionFactor gardsCorrectionFactor) ;
/**
* 根据ID删除校正因子
*/
Result<?> delete( Integer id);
/**
* 更新校正因子信息
*/
Result<?> update(GardsCorrectionFactor gardsCorrectionFactor) ;
/**
* 根据ID查询校正因子详情
*/
Result<GardsCorrectionFactor> queryById(Integer id);
/**
* 分页查询校正因子列表
*/
Result<IPage<GardsCorrectionFactor>> page(Integer pageNum, Integer pageSize, String stationCode, String detectorCode);
/**
* 根据站点代码查询校正因子列表
*/

View File

@ -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<GardsNuclearFuelFacilities> {
/**
* 新增核燃料设施信息
*/
Result<?> create(GardsNuclearFuelFacilities facility);
/**
* 根据ID删除核燃料设施信息
*/
Result<?> delete(Integer id);
/**
* 更新核燃料设施信息
*/
Result<?> update(GardsNuclearFuelFacilities facility);
/**
* 根据ID查询核燃料设施详情
*/
Result<GardsNuclearFuelFacilities> queryById(Integer id);
/**
* 分页查询核燃料设施列表
*/
Result<IPage<GardsNuclearFuelFacilities>> page(Integer pageNum, Integer pageSize,
String facilityType,
String facilityStatus,
String facilityName,
String country);
/**
* 根据设施名称模糊查询
*/
@ -26,5 +68,4 @@ public interface GardsNuclearFuelFacilityService extends IService<GardsNuclearFu
boolean updateBatchFacilityStatus(List<Long> ids, String status);
}

View File

@ -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<GardsNuclearReactors> {
/**
* 新增 核设施信息
*
* @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<GardsNuclearReactors> queryById(@RequestParam Integer id);
/**
* 分页查询反应堆数据
*
* @param pageNum 页码
* @param pageSize 分页大小
* @param unitName 单位名称
* @param country 国家
* @return
*/
Result<IPage<GardsNuclearReactors>> page( Integer pageNum,
Integer pageSize,
String unitName,
String country);
/**
* 多条件组合查询
* @return List

View File

@ -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<GardsNuclearReleaseRecords> {
/**
* 新增加核设施放射性排放记录信息
*/
Result<?> create(GardsNuclearReleaseRecords gardsNuclearReleaseRecords);
/**
* 删除核设施放射性排放记录信息
*/
Result<?> deleteById(Integer id);
/**
* 更新核设施放射性排放记录信息
*/
Result<?> update(GardsNuclearReleaseRecords gardsNuclearReleaseRecords);
/**
* 查询核设施放射性排放记录信息
*/
Result<GardsNuclearReleaseRecords> queryById(Integer id);
/**
* 分页查询
*
* @param pageNum 页数
* @param pageSize 每页大小
* @param facilityName 设施名称
* @param nuclide 核素
* @return 分页结果
*/
Result<IPage<GardsNuclearReleaseRecords>> page(Integer pageNum, Integer pageSize, String facilityName, String nuclide);
/**
* 多条件组合查询
* @param siteName 站点/电厂名称
*
* @param facilityName 站点/电厂名称
* @param nuclide 具体核素
* @param nuclideType 核素类别
* @param releaseType 排放类型
* @param matterState 物质状态 1-气体,2-气溶胶
* @return List
*/
List<GardsNuclearReleaseRecords> getByConditions(String siteName, String nuclide, String nuclideType, String releaseType);
List<GardsNuclearReleaseRecords> getByConditions(String facilityName, String nuclide, String matterState);
}

View File

@ -1,16 +1,54 @@
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<GardsNuclearTestingPlant> {
/**
* 新增 核试验信息
*/
Result<?> create(GardsNuclearTestingPlant gardsNuclearTestingPlant);
/**
* 删除核设施放射性排放记录信息
*/
Result<?> deleteById(Integer id);
/**
* 更新核设施放射性排放记录信息
*/
Result<?> update(GardsNuclearTestingPlant gardsNuclearTestingPlant);
/**
* 查询核设施放射性排放记录信息
*/
Result<GardsNuclearTestingPlant> queryById(Integer id);
Result<IPage<GardsNuclearTestingPlant>> page(
Integer pageNum,
Integer pageSize,
String name,
String type);
/**
* 多条件组合查询
*
* @param name 名称
* @param type 类型
* @return List

View File

@ -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<GardsResearchReactors> {
/**
* 新增信息
*/
Result<?> create(@RequestBody GardsResearchReactors gardsResearchReactors);
/**
* 删除信息
*/
Result<?> deleteById(@RequestParam Integer id) ;
/**
* 更新反应堆信息
*/
Result<?> update(@RequestBody GardsResearchReactors gardsResearchReactors) ;
/**
* 查询信息
*/
Result<GardsResearchReactors> queryById(@RequestParam Integer id) ;
/**
* 分页查询
*
* @param pageNum
* @param pageSize
* @param facilityName
* @param country
* @return
*/
Result<IPage<GardsResearchReactors>> page(
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(required = false) String facilityName,
@RequestParam(required = false) String country) ;
/**
* 多条件组合查询

View File

@ -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<GardsStations> {
/**
* 新增信息
*/
Result<?> create( GardsStations gardsStations) ;
/**
* 删除信息
*/
Result<?> deleteById( Integer stationId) ;
/**
* 更新信息
*/
Result<?> update( GardsStations gardsStations);
/**
* 查询信息
*/
Result<GardsStations> queryById( Integer stationId) ;
/**
* 分页查询
*
* @param pageNum
* @param pageSize
* @param stationCode
* @param countryCode
* @return
*/
Result<IPage<GardsStations>> page(
Integer pageNum,
Integer pageSize,
String stationCode,
String countryCode);
/**
* 多条件组合查询
* @param stationCode 名称

View File

@ -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<GardsAcceleratorMapper,GardsAccelerator> 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<IPage<GardsAccelerator>> queryPage(Integer pageNum, Integer pageSize, String country, String facilityName)
{
try {
Page<GardsAccelerator> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsAccelerator> 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<GardsAccelerator> pageResult = this.page(page, wrapper);
return Result.ok(pageResult);
} catch (Exception e) {
log.error("分页查询失败: " + e.getMessage());
return Result.error("分页查询失败");
}
}
@Override
public Result<GardsAccelerator> 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<GardsAccelerator> wrapper = new LambdaQueryWrapper<>();

View File

@ -2,12 +2,19 @@ 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;
@ -15,6 +22,113 @@ import java.util.List;
@DS("ora")
public class GardsCorrectionFactorServiceImpl extends ServiceImpl<GardsCorrectionFactorMapper, GardsCorrectionFactor> 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<GardsCorrectionFactor> 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<IPage<GardsCorrectionFactor>> page(
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(required = false) String stationCode,
@RequestParam(required = false) String detectorCode) {
try {
Page<GardsCorrectionFactor> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsCorrectionFactor> 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<GardsCorrectionFactor> pageResult = this.page(page, wrapper);
return Result.OK("分页查询成功", pageResult);
} catch (Exception e) {
log.error("分页查询失败: " + e.getMessage());
return Result.error("分页查询失败");
}
}
@Override
public List<GardsCorrectionFactor> getByStationCode(String stationCode) {
LambdaQueryWrapper<GardsCorrectionFactor> wrapper = new LambdaQueryWrapper<>();
@ -57,18 +171,18 @@ public class GardsCorrectionFactorServiceImpl extends ServiceImpl<GardsCorrectio
LambdaQueryWrapper<GardsCorrectionFactor> 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);
}

View File

@ -2,18 +2,135 @@ 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<GardsNuclearFuelFacilitiesMapper, GardsNuclearFuelFacilities> 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<GardsNuclearFuelFacilities> 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<IPage<GardsNuclearFuelFacilities>> page(
Integer pageNum, Integer pageSize,
String facilityType, String facilityStatus, String facilityName,
String country) {
try {
Page<GardsNuclearFuelFacilities> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsNuclearFuelFacilities> 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<GardsNuclearFuelFacilities> pageResult = this.page(page, wrapper);
return Result.OK("分页查询成功", pageResult);
} catch (
Exception e) {
log.error("操作失败: " + e.getMessage());
return Result.error("分页查询失败");
}
}
@Override
public List<GardsNuclearFuelFacilities> getByFacilityNameLike(String facilityName) {
LambdaQueryWrapper<GardsNuclearFuelFacilities> wrapper = new LambdaQueryWrapper<>();
@ -26,21 +143,21 @@ public class GardsNuclearFuelFacilityServiceImpl extends ServiceImpl<GardsNuclea
LambdaQueryWrapper<GardsNuclearFuelFacilities> 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);
}

View File

@ -2,35 +2,175 @@ 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<GardsNuclearReactorsMapper, GardsNuclearReactors> 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<GardsNuclearReactors> 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<IPage<GardsNuclearReactors>> page(
Integer pageNum,
Integer pageSize,
String unitName,
String country) {
try {
Page<GardsNuclearReactors> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsNuclearReactors> 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<GardsNuclearReactors> pageResult = this.page(page, wrapper);
return Result.OK(pageResult);
} catch (Exception e) {
log.error("查询失败: " + e.getMessage());
return Result.error("查询失败");
}
}
@Override
public List<GardsNuclearReactors> getByConditions(String unitName, String country, String reactorType, String reactorStatus) {
LambdaQueryWrapper<GardsNuclearReactors> 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<GardsNuclearReactors> list) {

View File

@ -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<GardsNuclearReleaseRecordsMapper, GardsNuclearReleaseRecords> implements GardsNuclearReleaseService {
@Override
public List<GardsNuclearReleaseRecords> getByConditions(String siteName, String nuclide, String nuclideType, String releaseType) {
LambdaQueryWrapper<GardsNuclearReleaseRecords> queryWrapper = new LambdaQueryWrapper<>();
if (siteName != null && !siteName.trim().isEmpty()) {
queryWrapper.eq(GardsNuclearReleaseRecords::getSiteName, siteName);
/**
* 新增加核设施放射性排放记录信息
*/
@Override
@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<GardsNuclearReleaseRecords> 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<IPage<GardsNuclearReleaseRecords>> page(
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(required = false) String facilityName,
@RequestParam(required = false) String nuclide) {
try {
Page<GardsNuclearReleaseRecords> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsNuclearReleaseRecords> wrapper = new LambdaQueryWrapper<>();
if (facilityName != null && !facilityName.trim().isEmpty()) {
wrapper.like(GardsNuclearReleaseRecords::getFacilityName, facilityName);
}
if (nuclide != null && !nuclide.trim().isEmpty()) {
queryWrapper.eq(GardsNuclearReleaseRecords::getNuclide, nuclide);
wrapper.like(GardsNuclearReleaseRecords::getNuclide, nuclide);
}
if (nuclideType != null && !nuclideType.trim().isEmpty()) {
queryWrapper.eq(GardsNuclearReleaseRecords::getNuclideType, nuclideType);
wrapper.orderByDesc(GardsNuclearReleaseRecords::getId);
IPage<GardsNuclearReleaseRecords> pageResult = this.page(page, wrapper);
return Result.OK(pageResult);
} catch (Exception e) {
log.error("page: " + e.getMessage());
return Result.error("查询失败:");
}
if (releaseType != null && !releaseType.trim().isEmpty()) {
queryWrapper.eq(GardsNuclearReleaseRecords::getReleaseType, releaseType);
}
@Override
public List<GardsNuclearReleaseRecords> getByConditions(String facilityName, String nuclide, String matterState) {
LambdaQueryWrapper<GardsNuclearReleaseRecords> queryWrapper = new LambdaQueryWrapper<>();
if (facilityName != null && !facilityName.trim().isEmpty()) {
queryWrapper.like(GardsNuclearReleaseRecords::getFacilityName, facilityName);
}
if (nuclide != null && !nuclide.trim().isEmpty()) {
queryWrapper.like(GardsNuclearReleaseRecords::getNuclide, nuclide);
}
if (matterState != null && !matterState.trim().isEmpty()) {
queryWrapper.like(GardsNuclearReleaseRecords::getMatterState, matterState);
}
queryWrapper.orderByDesc(GardsNuclearReleaseRecords::getId);
return this.list(queryWrapper);
}
}

View File

@ -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<GardsNuclearTestingPlantMapper, GardsNuclearTestingPlant> 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<GardsNuclearTestingPlant> 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<IPage<GardsNuclearTestingPlant>> page(
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(required = false) String name,
@RequestParam(required = false) String type) {
try {
Page<GardsNuclearTestingPlant> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsNuclearTestingPlant> 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<GardsNuclearTestingPlant> 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<GardsNuclearTestingPlant> getByConditions(String name, String type) {
LambdaQueryWrapper<GardsNuclearTestingPlant> 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);
}
}

View File

@ -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<GardsResearchReactorsMapper, GardsResearchReactors> 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<GardsResearchReactors> 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<IPage<GardsResearchReactors>> page(
Integer pageNum,
Integer pageSize,
String facilityName,
String country) {
try {
Page<GardsResearchReactors> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsResearchReactors> 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<GardsResearchReactors> pageResult = this.page(page, wrapper);
return Result.OK(pageResult);
} catch (Exception e) {
log.error("page: " + e.getMessage());
return Result.error("查询失败" );
}
}
@Override
public List<GardsResearchReactors> getByConditions(String facilityName, String country,String reactorType,String status) {
LambdaQueryWrapper<GardsResearchReactors> 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);
}
}

View File

@ -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<GardsStationsMapper, GardsStations> 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<GardsStations> 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<IPage<GardsStations>> page(
Integer pageNum,
Integer pageSize,
String stationCode,
String countryCode) {
try {
Page<GardsStations> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsStations> 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<GardsStations> pageResult = this.page(page, wrapper);
return Result.OK(pageResult);
} catch (Exception e) {
log.error("page: " + e.getMessage());
return Result.error("查询失败");
}
}
@Override
public List<GardsStations> getByConditions(String stationCode, String type, String status,String countryCode) {
LambdaQueryWrapper<GardsStations> 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);
}
}