格式化代码

This commit is contained in:
duwenyuan 2025-12-31 21:36:00 +08:00
parent bec7452eaa
commit 9e1fd90578
28 changed files with 613 additions and 1547 deletions

View File

@ -2,7 +2,6 @@ package org.jeecg.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@ -10,9 +9,7 @@ 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;
import org.jeecg.modules.base.entity.configuration.GardsAccelerator;
import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor;
import org.jeecg.service.GardsAcceleratorService;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
@ -20,7 +17,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -30,11 +27,14 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 加速器信息
*/
@Slf4j
@RestController
@RequestMapping("/gards-accelerator")
public class GardsAcceleratorController {
final short titleHeight = 8;
@Autowired
private GardsAcceleratorService gardsAcceleratorService;
@ -45,7 +45,8 @@ public class GardsAcceleratorController {
@Operation(summary = "新增加速器信息")
@PostMapping("create")
public Result<?> create(@RequestBody GardsAccelerator gardsAccelerator) {
return gardsAcceleratorService.create(gardsAccelerator);
gardsAcceleratorService.create(gardsAccelerator);
return Result.OK("新增成功!");
}
/**
@ -55,7 +56,8 @@ public class GardsAcceleratorController {
@Operation(summary = "删除加速器信息")
@DeleteMapping("/delete")
public Result<?> delete(@RequestParam Integer id) {
return gardsAcceleratorService.delete(id);
gardsAcceleratorService.delete(id);
return Result.OK("删除成功!");
}
/**
@ -64,8 +66,8 @@ public class GardsAcceleratorController {
@Operation(summary = "更新加速器信息")
@PutMapping("/update")
public Result<?> update(@RequestBody GardsAccelerator gardsAccelerator) {
return gardsAcceleratorService.update(gardsAccelerator);
gardsAcceleratorService.update(gardsAccelerator);
return Result.OK();
}
/**
@ -74,7 +76,7 @@ public class GardsAcceleratorController {
@Operation(summary = "查询加速器信息")
@GetMapping("/queryById")
public Result<GardsAccelerator> getById(@RequestParam Integer id) {
return gardsAcceleratorService.queryById(id);
return Result.OK(gardsAcceleratorService.queryById(id));
}
/**
@ -88,107 +90,10 @@ public class GardsAcceleratorController {
@RequestParam(required = false) String country,
@RequestParam(required = false) String facilityName
) {
return gardsAcceleratorService.queryPage(pageNum, pageSize, country, facilityName);
return Result.OK(
gardsAcceleratorService.queryPage(pageNum, pageSize, country, facilityName));
}
//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("条件查询失败");
// }
// }
//endregion
@AutoLog(value = "导出模版")
@Operation(summary = "加速器信息导出模版")
@GetMapping("/exportTemplate")
@ -196,9 +101,10 @@ public class GardsAcceleratorController {
ExportParams params = new ExportParams();
params.setTitle("加速器信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
ExcelExportUtil.exportExcel(params, GardsAccelerator.class, new ArrayList<>()).write(response.getOutputStream());
ExcelExportUtil.exportExcel(params, GardsAccelerator.class, new ArrayList<>())
.write(response.getOutputStream());
}
@AutoLog(value = "导出数据")
@ -211,7 +117,7 @@ public class GardsAcceleratorController {
ExportParams params = new ExportParams();
params.setTitle("加速器信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
LambdaQueryWrapper<GardsAccelerator> wrapper = new LambdaQueryWrapper<>();
@ -228,7 +134,8 @@ public class GardsAcceleratorController {
wrapper.orderByDesc(GardsAccelerator::getId);
List<GardsAccelerator> list = gardsAcceleratorService.list(wrapper);
ExcelExportUtil.exportExcel(params, GardsAccelerator.class, list).write(response.getOutputStream());
ExcelExportUtil.exportExcel(params, GardsAccelerator.class, list)
.write(response.getOutputStream());
}
@ -259,11 +166,15 @@ public class GardsAcceleratorController {
try {
// 3. 使用 AutoPoi 工具类解析 Excel
List<GardsAccelerator> list = ExcelImportUtil.importExcel(file.getInputStream(), GardsAccelerator.class, params);
List<GardsAccelerator> list =
ExcelImportUtil.importExcel(file.getInputStream(), GardsAccelerator.class,
params);
// 4. 批量保存数据到数据库
gardsAcceleratorService.saveBatch(list);
//gardsAcceleratorService.saveBatch(list);
if (!CollectionUtils.isEmpty(list)) {
list.forEach(item -> gardsAcceleratorService.save(item));
}
return Result.OK("文件导入成功!数据行数:" + list.size());
} catch (Exception e) {
return Result.error("文件导入失败:" + e.getMessage());

View File

@ -1,16 +1,12 @@
package org.jeecg.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.base.entity.configuration.GardsAccelerator;
import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor;
import org.jeecg.service.GardsCorrectionFactorService;
import org.jeecgframework.poi.excel.ExcelExportUtil;
@ -19,6 +15,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -28,11 +25,14 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 校正因子
*/
@Slf4j
@RestController
@RequestMapping("/gardsCorrectionFactor")
public class GardsCorrectionFactorController {
final short titleHeight = 8;
@Autowired
private GardsCorrectionFactorService gardsCorrectionFactorService;
@ -42,7 +42,8 @@ public class GardsCorrectionFactorController {
@PostMapping("/create")
@Operation(summary = "新增校正因子")
public Result<?> create(@RequestBody GardsCorrectionFactor gardsCorrectionFactor) {
return gardsCorrectionFactorService.create(gardsCorrectionFactor);
gardsCorrectionFactorService.create(gardsCorrectionFactor);
return Result.OK("新增成功!");
}
/**
@ -50,8 +51,9 @@ public class GardsCorrectionFactorController {
*/
@DeleteMapping("/delete")
@Operation(summary = "根据ID删除校正因子")
public Result<?> delete(@RequestParam(name="id") Integer id) {
return gardsCorrectionFactorService.delete(id);
public Result<?> delete(@RequestParam(name = "id") Integer id) {
gardsCorrectionFactorService.delete(id);
return Result.OK("删除成功!");
}
/**
@ -60,7 +62,8 @@ public class GardsCorrectionFactorController {
@PutMapping("/update")
@Operation(summary = "更新校正因子信息")
public Result<?> update(@RequestBody GardsCorrectionFactor gardsCorrectionFactor) {
return gardsCorrectionFactorService.update(gardsCorrectionFactor);
gardsCorrectionFactorService.update(gardsCorrectionFactor);
return Result.OK();
}
/**
@ -68,8 +71,8 @@ public class GardsCorrectionFactorController {
*/
@GetMapping("/queryById")
@Operation(summary = "根据ID查询校正因子详情")
public Result<GardsCorrectionFactor> getById(@RequestParam(name="id") Integer id) {
return gardsCorrectionFactorService.queryById(id);
public Result<GardsCorrectionFactor> getById(@RequestParam(name = "id") Integer id) {
return Result.OK(gardsCorrectionFactorService.queryById(id));
}
/**
@ -82,147 +85,10 @@ public class GardsCorrectionFactorController {
@RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(required = false) String stationCode,
@RequestParam(required = false) String detectorCode) {
return gardsCorrectionFactorService.page(pageNum, pageSize, stationCode, detectorCode);
return Result.OK(
gardsCorrectionFactorService.page(pageNum, pageSize, stationCode, detectorCode));
}
//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 = "导出模版")
@ -231,28 +97,30 @@ public class GardsCorrectionFactorController {
ExportParams params = new ExportParams();
params.setTitle("探测器模拟及联符合校正因子信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
ExcelExportUtil.exportExcel(params, GardsCorrectionFactor.class,new ArrayList<>()).write(response.getOutputStream());
ExcelExportUtil.exportExcel(params, GardsCorrectionFactor.class, new ArrayList<>())
.write(response.getOutputStream());
}
@AutoLog(value = "导出Excel")
@Operation(summary = "导出校正因子Excel")
@GetMapping("/exportExcel")
public void exportExcel(HttpServletResponse response,@RequestParam(required = false) String stationCode,
public void exportExcel(HttpServletResponse response,
@RequestParam(required = false) String stationCode,
@RequestParam(required = false) String detectorCode,
@RequestParam(required = false) String manufacturer,
@RequestParam(required = false) String model) throws IOException {
ExportParams params = new ExportParams();
params.setTitle("探测器模拟及联符合校正因子信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
List<GardsCorrectionFactor> list = gardsCorrectionFactorService.getByConditions(
stationCode, detectorCode, manufacturer, model);
ExcelExportUtil.exportExcel(params, GardsCorrectionFactor.class,list).write(response.getOutputStream());
ExcelExportUtil.exportExcel(params, GardsCorrectionFactor.class, list)
.write(response.getOutputStream());
}
@ -264,7 +132,7 @@ public class GardsCorrectionFactorController {
*/
@AutoLog(value = "导入GardsAccelerator数据")
@PostMapping(value = "/importExcel")
public Result<?> importExcel(HttpServletRequest request ) {
public Result<?> importExcel(HttpServletRequest request) {
// 1. 获取上传文件
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
@ -282,11 +150,14 @@ public class GardsCorrectionFactorController {
try {
// 3. 使用 AutoPoi 工具类解析 Excel
List<GardsCorrectionFactor> list = ExcelImportUtil.importExcel(file.getInputStream(), GardsCorrectionFactor.class, params);
List<GardsCorrectionFactor> list =
ExcelImportUtil.importExcel(file.getInputStream(),
GardsCorrectionFactor.class, params);
// 4. 批量保存数据到数据库
gardsCorrectionFactorService.saveBatch(list);
if (!CollectionUtils.isEmpty(list)) {
list.forEach(item -> gardsCorrectionFactorService.save(item));
}
return Result.OK("文件导入成功!数据行数:" + list.size());
} catch (Exception e) {
return Result.error("文件导入失败:" + e.getMessage());
@ -302,5 +173,4 @@ public class GardsCorrectionFactorController {
}
}

View File

@ -1,15 +1,12 @@
package org.jeecg.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.base.entity.configuration.GardsCorrectionFactor;
import org.jeecg.modules.base.entity.configuration.GardsNuclearFuelFacilities;
import org.jeecg.service.GardsNuclearFuelFacilityService;
import org.jeecgframework.poi.excel.ExcelExportUtil;
@ -18,6 +15,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -27,11 +25,14 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 后处理厂信息
*/
@Slf4j
@RestController
@RequestMapping("/gardsNuclearFuelFacility")
public class GardsNuclearFuelFacilityController {
final short titleHeight = 8;
@Autowired
private GardsNuclearFuelFacilityService nuclearFuelFacilitiesService;
@ -41,7 +42,8 @@ public class GardsNuclearFuelFacilityController {
@PostMapping("/create")
@Operation(summary = "新增核燃料设施信息")
public Result<?> create(@RequestBody GardsNuclearFuelFacilities facility) {
return nuclearFuelFacilitiesService.create(facility);
nuclearFuelFacilitiesService.create(facility);
return Result.OK("新增成功!");
}
/**
@ -50,7 +52,8 @@ public class GardsNuclearFuelFacilityController {
@DeleteMapping("/delete")
@Operation(summary = "根据ID删除核燃料设施信息")
public Result<?> delete(@RequestParam Integer id) {
return nuclearFuelFacilitiesService.delete(id);
nuclearFuelFacilitiesService.delete(id);
return Result.OK("删除成功!");
}
/**
@ -59,7 +62,8 @@ public class GardsNuclearFuelFacilityController {
@PutMapping("/update")
@Operation(summary = "更新核燃料设施信息")
public Result<?> update(@RequestBody GardsNuclearFuelFacilities facility) {
return nuclearFuelFacilitiesService.update(facility);
nuclearFuelFacilitiesService.update(facility);
return Result.OK("");
}
/**
@ -68,7 +72,8 @@ public class GardsNuclearFuelFacilityController {
@GetMapping("/getById")
@Operation(summary = "根据ID查询核燃料设施详情")
public Result<GardsNuclearFuelFacilities> getById(@RequestParam Integer id) {
return nuclearFuelFacilitiesService.queryById(id);
nuclearFuelFacilitiesService.queryById(id);
return Result.OK("");
}
/**
@ -81,66 +86,14 @@ public class GardsNuclearFuelFacilityController {
@RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(required = false) String facilityType,
@RequestParam(required = false) String facilityStatus,
@RequestParam(required = false) String facilityName,
@RequestParam(required = false) String facility_name,
@RequestParam(required = false) String country) {
return nuclearFuelFacilitiesService.page(pageNum, pageSize, facilityType, facilityStatus, facilityName, country);
IPage<GardsNuclearFuelFacilities> page =
nuclearFuelFacilitiesService.page(pageNum, pageSize, facilityType, facilityStatus,
facility_name, country);
return Result.OK("", page);
}
//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("/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 = "导出模版")
@ -149,15 +102,17 @@ public class GardsNuclearFuelFacilityController {
ExportParams params = new ExportParams();
params.setTitle("后处理厂设施信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
ExcelExportUtil.exportExcel(params, GardsNuclearFuelFacilities.class, new ArrayList<>()).write(response.getOutputStream());
ExcelExportUtil.exportExcel(params, GardsNuclearFuelFacilities.class, new ArrayList<>())
.write(response.getOutputStream());
}
@AutoLog(value = "导出Excel")
@Operation(summary = "导出Excel")
@GetMapping("/exportExcel")
public void exportExcel(HttpServletResponse response, @RequestParam(required = false) String facilityType,
public void exportExcel(HttpServletResponse response,
@RequestParam(required = false) String facilityType,
@RequestParam(required = false) String facilityStatus,
@RequestParam(required = false) String country,
@RequestParam(required = false) String facilityName,
@ -165,11 +120,12 @@ public class GardsNuclearFuelFacilityController {
ExportParams params = new ExportParams();
params.setTitle("后处理厂设施信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
List<GardsNuclearFuelFacilities> list = nuclearFuelFacilitiesService.getByConditions(
facilityType, facilityStatus, country, facilityName, fuelType);
ExcelExportUtil.exportExcel(params, GardsNuclearFuelFacilities.class, list).write(response.getOutputStream());
ExcelExportUtil.exportExcel(params, GardsNuclearFuelFacilities.class, list)
.write(response.getOutputStream());
}
@ -200,16 +156,16 @@ public class GardsNuclearFuelFacilityController {
try {
// 3. 使用 AutoPoi 工具类解析 Excel
List<GardsNuclearFuelFacilities> list = ExcelImportUtil.importExcel(file.getInputStream(), GardsNuclearFuelFacilities.class, params);
List<GardsNuclearFuelFacilities> list =
ExcelImportUtil.importExcel(file.getInputStream(),
GardsNuclearFuelFacilities.class, params);
// 4. 批量保存数据到数据库
boolean success = nuclearFuelFacilitiesService.saveBatch(list, 500);
if (success) {
return Result.OK("文件导入成功!数据行数:" + list.size());
} else {
return Result.error("文件导入失败");
//boolean success = nuclearFuelFacilitiesService.saveBatch(list, 500);
if (!CollectionUtils.isEmpty(list)) {
list.forEach(item -> nuclearFuelFacilitiesService.save(item));
}
return Result.OK("文件导入成功!数据行数:" + list.size());
} catch (Exception e) {
return Result.error("文件导入失败:" + e.getMessage());
} finally {

View File

@ -1,18 +1,13 @@
package org.jeecg.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.log4j.Log4j;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.base.entity.configuration.GardsNuclearFuelFacilities;
import org.jeecg.modules.base.entity.configuration.GardsNuclearReactors;
import org.jeecg.modules.base.mapper.GardsNuclearReactorsMapper;
import org.jeecg.service.GardsNuclearReactorsService;
import org.jeecg.util.BizUpsertUtil;
import org.jeecgframework.poi.excel.ExcelExportUtil;
@ -21,6 +16,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -30,12 +26,17 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 核设施信息
*/
@Slf4j
@RestController
@RequestMapping("/gardsNuclearReactors")
public class GardsNuclearReactorsController {
final short titleHeight = 8;
@Autowired
private GardsNuclearReactorsService gardsNuclearReactorsService;
@ -48,8 +49,8 @@ public class GardsNuclearReactorsController {
@PostMapping("/create")
@Operation(summary = "新增核设施信息")
public Result<?> create(@RequestBody GardsNuclearReactors gardsNuclearReactors) {
return gardsNuclearReactorsService.create(gardsNuclearReactors);
gardsNuclearReactorsService.save(gardsNuclearReactors);
return Result.OK("新增成功!");
}
/**
@ -61,7 +62,8 @@ public class GardsNuclearReactorsController {
@DeleteMapping("/delete")
@Operation(summary = "删除核设施信息数据")
public Result<?> delete(@RequestParam Integer id) {
return gardsNuclearReactorsService.delete(id);
gardsNuclearReactorsService.removeById(id);
return Result.OK("删除成功!");
}
/**
@ -73,7 +75,8 @@ public class GardsNuclearReactorsController {
@PutMapping("/update")
@Operation(summary = "更新核设施数据")
public Result<?> update(@RequestBody GardsNuclearReactors gardsNuclearReactors) {
return gardsNuclearReactorsService.update(gardsNuclearReactors);
gardsNuclearReactorsService.update(gardsNuclearReactors);
return Result.OK("");
}
/**
@ -85,7 +88,7 @@ public class GardsNuclearReactorsController {
@GetMapping("/getById")
@Operation(summary = "根据Id查询反应堆数据")
public Result<GardsNuclearReactors> queryById(@RequestParam Integer id) {
return gardsNuclearReactorsService.queryById(id);
return Result.OK(gardsNuclearReactorsService.queryById(id));
}
@ -105,44 +108,13 @@ public class GardsNuclearReactorsController {
@RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(required = false) String unitName,
@RequestParam(required = false) String country) {
return gardsNuclearReactorsService.page(pageNum, pageSize, unitName, country);
IPage<GardsNuclearReactors> page =
gardsNuclearReactorsService.page(pageNum, pageSize, unitName, country);
return Result.OK(page);
}
//region 注释代码
// /**
// * 组合条件查询
// *
// * @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 = "核设施信息导出模版")
@GetMapping("/exportTemplate")
@ -150,9 +122,10 @@ public class GardsNuclearReactorsController {
ExportParams params = new ExportParams();
params.setTitle("核设施信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
ExcelExportUtil.exportExcel(params, GardsNuclearReactors.class, new ArrayList<>()).write(response.getOutputStream());
ExcelExportUtil.exportExcel(params, GardsNuclearReactors.class, new ArrayList<>())
.write(response.getOutputStream());
}
@AutoLog(value = "导出Excel")
@ -162,14 +135,18 @@ public class GardsNuclearReactorsController {
@RequestParam(required = false) String unitName,
@RequestParam(required = false) String country,
@RequestParam(required = false) String reactorType,
@RequestParam(required = false) String reactorStatus) throws IOException {
@RequestParam(required = false) String reactorStatus)
throws IOException {
ExportParams params = new ExportParams();
params.setTitle("核设施信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
List<GardsNuclearReactors> list = gardsNuclearReactorsService.getByConditions(unitName, country, reactorType, reactorStatus);
ExcelExportUtil.exportExcel(params, GardsNuclearReactors.class, list).write(response.getOutputStream());
List<GardsNuclearReactors> list =
gardsNuclearReactorsService.getByConditions(unitName, country, reactorType,
reactorStatus);
ExcelExportUtil.exportExcel(params, GardsNuclearReactors.class, list)
.write(response.getOutputStream());
}
@ -189,7 +166,8 @@ public class GardsNuclearReactorsController {
// 1. 关键修复检查请求是否为 multipart 请求
// 如果前端没有使用 form-data 格式提交或者 Content-Type 不对这里会拦截
if (!(request instanceof MultipartHttpServletRequest)) {
return Result.error("请求不是文件上传格式,请检查 Content-Type 是否为 multipart/form-data");
return Result.error(
"请求不是文件上传格式,请检查 Content-Type 是否为 multipart/form-data");
}
// 2. 安全转换为 MultipartHttpServletRequest
@ -222,32 +200,36 @@ public class GardsNuclearReactorsController {
try (InputStream inputStream = file.getInputStream()) {
// 使用 AutoPoi 工具类解析 Excel
List<GardsNuclearReactors> list = ExcelImportUtil.importExcel(inputStream, GardsNuclearReactors.class, params);
List<GardsNuclearReactors> list =
ExcelImportUtil.importExcel(inputStream, GardsNuclearReactors.class,
params);
// 简单的校验防止空列表报错
if (list == null || list.isEmpty()) {
return Result.error("导入失败:文件中没有数据");
}
// 批量保存数据到数据库
boolean success = BizUpsertUtil.upsert(gardsNuclearReactorsService, list, GardsNuclearReactors::getUnitName);
//gardsNuclearReactorsService.saveBatch(list);
if (success) {
return Result.OK("文件导入成功!数据行数:" + list.size());
} else {
Result.error("文件导入失败");
// 提取 unitName
List<String> unitNames = list.stream()
.map(GardsNuclearReactors::getUnitName)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (unitNames.isEmpty()) {
return Result.error("所有记录的 UNIT_NAME 为空,无法导入");
}
// 批量保存数据到数据库
boolean success = BizUpsertUtil.upsert(gardsNuclearReactorsService, list,
GardsNuclearReactors::getUnitName);
//gardsNuclearReactorsService.saveBatch(list);
// if (!CollectionUtils.isEmpty(list)) {
// list.forEach(item -> gardsNuclearReactorsService.save(item));
// }
return Result.OK("文件导入成功!数据行数:" + list.size());
} catch (Exception e) {
log.error(e.getMessage(), e);
return Result.error("文件导入失败: " + e.getMessage());
}
}
return Result.error("文件导入失败,未找到有效文件!");
}
}

View File

@ -1,15 +1,12 @@
package org.jeecg.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.base.entity.configuration.GardsNuclearReactors;
import org.jeecg.modules.base.entity.configuration.GardsNuclearReleaseRecords;
import org.jeecg.service.GardsNuclearReleaseService;
import org.jeecgframework.poi.excel.ExcelExportUtil;
@ -18,6 +15,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -27,11 +25,14 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 核设施放射性排放记录信息
*/
@Slf4j
@RestController
@RequestMapping("/gardsNuclearReleaseRecords")
public class GardsNuclearReleaseController {
final short titleHeight = 8;
@Autowired
private GardsNuclearReleaseService gardsNuclearReleaseService;
@ -41,7 +42,8 @@ public class GardsNuclearReleaseController {
@PostMapping("/create")
@Operation(summary = "新增加核设施放射性排放记录信息")
public Result<?> create(@RequestBody GardsNuclearReleaseRecords gardsNuclearReleaseRecords) {
return gardsNuclearReleaseService.create(gardsNuclearReleaseRecords);
gardsNuclearReleaseService.save(gardsNuclearReleaseRecords);
return Result.OK("新增成功!");
}
/**
@ -50,7 +52,8 @@ public class GardsNuclearReleaseController {
@DeleteMapping("/delete")
@Operation(summary = "删除核设施放射性排放记录信息")
public Result<?> deleteById(@RequestParam Integer id) {
return gardsNuclearReleaseService.deleteById(id);
gardsNuclearReleaseService.removeById(id);
return Result.OK("删除成功!");
}
/**
@ -59,7 +62,8 @@ public class GardsNuclearReleaseController {
@PutMapping("/update")
@Operation(summary = "更新核设施放射性排放记录信息")
public Result<?> update(@RequestBody GardsNuclearReleaseRecords gardsNuclearReleaseRecords) {
return gardsNuclearReleaseService.update(gardsNuclearReleaseRecords);
gardsNuclearReleaseService.update(gardsNuclearReleaseRecords);
return Result.OK("");
}
/**
@ -68,14 +72,14 @@ public class GardsNuclearReleaseController {
@GetMapping("/queryById")
@Operation(summary = "查询核设施放射性排放记录信息")
public Result<GardsNuclearReleaseRecords> getById(@RequestParam Integer id) {
return gardsNuclearReleaseService.queryById(id);
return Result.OK(gardsNuclearReleaseService.queryById(id));
}
/**
* 分页查询
*
* @param pageNum 页数
* @param pageSize 每页大小
* @param pageNum 页数
* @param pageSize 每页大小
* @param facilityName
* @param nuclide
* @return
@ -87,41 +91,11 @@ public class GardsNuclearReleaseController {
@RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(required = false) String facilityName,
@RequestParam(required = false) String nuclide) {
return gardsNuclearReleaseService.page(pageNum, pageSize, facilityName, nuclide);
return Result.OK(gardsNuclearReleaseService.page(pageNum, pageSize, facilityName, nuclide));
}
//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("查询失败");
// }
//
// }
//endregion
@AutoLog(value = "导出模版")
@Operation(summary = "核设施放射性排放记录导出模版")
@ -130,9 +104,10 @@ public class GardsNuclearReleaseController {
ExportParams params = new ExportParams();
params.setTitle("核设施放射性排放记录信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
ExcelExportUtil.exportExcel(params, GardsNuclearReleaseRecords.class, new ArrayList<>()).write(response.getOutputStream());
ExcelExportUtil.exportExcel(params, GardsNuclearReleaseRecords.class, new ArrayList<>())
.write(response.getOutputStream());
}
@ -146,10 +121,12 @@ public class GardsNuclearReleaseController {
ExportParams params = new ExportParams();
params.setTitle("核设施放射性排放记录信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
List<GardsNuclearReleaseRecords> list = gardsNuclearReleaseService.getByConditions(facilityName, nuclide, matterState);
ExcelExportUtil.exportExcel(params, GardsNuclearReleaseRecords.class, list).write(response.getOutputStream());
List<GardsNuclearReleaseRecords> list =
gardsNuclearReleaseService.getByConditions(facilityName, nuclide, matterState);
ExcelExportUtil.exportExcel(params, GardsNuclearReleaseRecords.class, list)
.write(response.getOutputStream());
}
@ -181,11 +158,13 @@ public class GardsNuclearReleaseController {
try {
// 3. 使用 AutoPoi 工具类解析 Excel
List<GardsNuclearReleaseRecords> list = ExcelImportUtil.importExcel(file.getInputStream(), GardsNuclearReleaseRecords.class, params);
List<GardsNuclearReleaseRecords> list =
ExcelImportUtil.importExcel(file.getInputStream(),
GardsNuclearReleaseRecords.class, params);
// 4. 批量保存数据到数据库
gardsNuclearReleaseService.saveBatch(list);
if (!CollectionUtils.isEmpty(list)) {
list.forEach(item -> gardsNuclearReleaseService.save(item));
}
return Result.OK("文件导入成功!数据行数:" + list.size());
} catch (Exception e) {
return Result.error("文件导入失败:" + e.getMessage());

View File

@ -10,9 +10,7 @@ import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.base.entity.configuration.GardsNuclearReleaseRecords;
import org.jeecg.modules.base.entity.configuration.GardsNuclearTestingPlant;
import org.jeecg.service.GardsNuclearReleaseService;
import org.jeecg.service.GardsNuclearTestingPlantService;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
@ -20,6 +18,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -28,11 +27,15 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 核试验信息
*/
@Slf4j
@RestController
@RequestMapping("/gardsNuclearTestingPlant")
public class GardsNuclearTestingPlantController {
final short titleHeight = 8;
@Autowired
private GardsNuclearTestingPlantService gardsNuclearTestingPlantService;
@ -42,7 +45,8 @@ public class GardsNuclearTestingPlantController {
@PostMapping("/create")
@Operation(summary = "新增核试验信息")
public Result<?> create(@RequestBody GardsNuclearTestingPlant gardsNuclearTestingPlant) {
return gardsNuclearTestingPlantService.create(gardsNuclearTestingPlant);
gardsNuclearTestingPlantService.save(gardsNuclearTestingPlant);
return Result.OK("新增成功!");
}
/**
@ -51,7 +55,8 @@ public class GardsNuclearTestingPlantController {
@DeleteMapping("/delete")
@Operation(summary = "删除核试验信息")
public Result<?> deleteById(@RequestParam Integer id) {
return gardsNuclearTestingPlantService.deleteById(id);
gardsNuclearTestingPlantService.removeById(id);
return Result.OK("删除成功!");
}
/**
@ -60,7 +65,8 @@ public class GardsNuclearTestingPlantController {
@PutMapping("/update")
@Operation(summary = "更新核试验信息")
public Result<?> update(@RequestBody GardsNuclearTestingPlant gardsNuclearTestingPlant) {
return gardsNuclearTestingPlantService.update(gardsNuclearTestingPlant);
gardsNuclearTestingPlantService.update(gardsNuclearTestingPlant);
return Result.OK("");
}
/**
@ -69,7 +75,7 @@ public class GardsNuclearTestingPlantController {
@GetMapping("/queryById")
@Operation(summary = "查询核试验信息")
public Result<GardsNuclearTestingPlant> getById(@RequestParam Integer id) {
return gardsNuclearTestingPlantService.queryById(id);
return Result.OK(gardsNuclearTestingPlantService.queryById(id));
}
/**
@ -88,48 +94,10 @@ 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);
IPage<GardsNuclearTestingPlant> pageResult =
gardsNuclearTestingPlantService.page(pageNum, pageSize, name, type);
return Result.OK(pageResult);
LambdaQueryWrapper<GardsNuclearTestingPlant> wrapper = new LambdaQueryWrapper<>();
if (name != null && !name.trim().isEmpty()) {
wrapper.eq(GardsNuclearTestingPlant::getName, name);
}
if (type != null && !type.trim().isEmpty()) {
wrapper.eq(GardsNuclearTestingPlant::getCountry, type);
}
IPage<GardsNuclearTestingPlant> pageResult = gardsNuclearTestingPlantService.page(page, wrapper);
return Result.OK(pageResult);
} catch (Exception e) {
log.error("page: " + e.getMessage());
return Result.error("查询失败:" + e.getMessage());
}
}
/**
* 组合条件查询
*
* @param name 地点名称
* @param type 具体核素
* @return
*/
@GetMapping("/search")
@Operation(summary = "核试验信息组合条件查询")
public Result<List<GardsNuclearTestingPlant>> search(
@RequestParam(required = false) String name,
@RequestParam(required = false) String type) {
try {
List<GardsNuclearTestingPlant> list = gardsNuclearTestingPlantService.getByConditions(name, type);
return Result.OK(list);
} catch (Exception e) {
log.error("search: " + e.getMessage());
return Result.error("查询失败");
}
}
@ -141,9 +109,10 @@ public class GardsNuclearTestingPlantController {
ExportParams params = new ExportParams();
params.setTitle("核试验信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
ExcelExportUtil.exportExcel(params, GardsNuclearTestingPlant.class, new ArrayList<>()).write(response.getOutputStream());
ExcelExportUtil.exportExcel(params, GardsNuclearTestingPlant.class, new ArrayList<>())
.write(response.getOutputStream());
}
@AutoLog(value = "导出Excel")
@ -155,10 +124,12 @@ public class GardsNuclearTestingPlantController {
ExportParams params = new ExportParams();
params.setTitle("核试验信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
List<GardsNuclearTestingPlant> list = gardsNuclearTestingPlantService.getByConditions(name, type);
ExcelExportUtil.exportExcel(params, GardsNuclearTestingPlant.class, list).write(response.getOutputStream());
List<GardsNuclearTestingPlant> list =
gardsNuclearTestingPlantService.getByConditions(name, type);
ExcelExportUtil.exportExcel(params, GardsNuclearTestingPlant.class, list)
.write(response.getOutputStream());
}
@ -189,7 +160,9 @@ public class GardsNuclearTestingPlantController {
try {
// 3. 使用 AutoPoi 工具类解析 Excel
List<GardsNuclearTestingPlant> list = ExcelImportUtil.importExcel(file.getInputStream(), GardsNuclearTestingPlant.class, params);
List<GardsNuclearTestingPlant> list =
ExcelImportUtil.importExcel(file.getInputStream(),
GardsNuclearTestingPlant.class, params);
list.forEach(testingPlant -> {
if (StringUtils.isNotBlank(testingPlant.getInfo())) {
@ -205,8 +178,10 @@ public class GardsNuclearTestingPlantController {
}
});
// 4. 批量保存数据到数据库
gardsNuclearTestingPlantService.saveBatch(list,5);
//gardsNuclearTestingPlantService.saveBatch(list,5);
if (!CollectionUtils.isEmpty(list)) {
list.forEach(item -> gardsNuclearTestingPlantService.save(item));
}
return Result.OK("文件导入成功!数据行数:" + list.size());
} catch (Exception e) {
return Result.error("文件导入失败:" + e.getMessage());

View File

@ -15,6 +15,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -24,10 +25,14 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 核素衰变信息
*/
@RestController
@RequestMapping("/getGardsNuclideDecay")
@Slf4j
public class GardsNuclideDecayController {
final short titleHeight = 8;
@Autowired
private GardsNuclideDecayService gardsNuclideDecayService;
@ -37,7 +42,8 @@ public class GardsNuclideDecayController {
@PostMapping("/create")
@Operation(summary = "新增信息")
public Result<?> create(@RequestBody GardsNuclideDecay gardsNuclideDecay) {
return gardsNuclideDecayService.create(gardsNuclideDecay);
gardsNuclideDecayService.save(gardsNuclideDecay);
return Result.OK("新增成功!");
}
/**
@ -45,8 +51,9 @@ public class GardsNuclideDecayController {
*/
@DeleteMapping("/delete")
@Operation(summary = "删除信息")
public Result<?> deleteById(@RequestParam Integer Id) {
return gardsNuclideDecayService.deleteById(Id);
public Result<?> deleteById(Integer id) {
gardsNuclideDecayService.removeById(id);
return Result.OK("删除成功!");
}
/**
@ -55,7 +62,8 @@ public class GardsNuclideDecayController {
@PutMapping("/update")
@Operation(summary = "更新信息")
public Result<?> update(@RequestBody GardsNuclideDecay gardsNuclideDecay) {
return gardsNuclideDecayService.update(gardsNuclideDecay);
gardsNuclideDecayService.update(gardsNuclideDecay);
return Result.OK("");
}
/**
@ -63,8 +71,9 @@ public class GardsNuclideDecayController {
*/
@GetMapping("/queryById")
@Operation(summary = "查询信息")
public Result<GardsNuclideDecay> getById(@RequestParam Integer Id) {
return gardsNuclideDecayService.queryById(Id);
public Result<GardsNuclideDecay> getById(@RequestParam Integer id) {
return Result.OK(gardsNuclideDecayService.queryById(id));
}
/**
@ -72,7 +81,7 @@ public class GardsNuclideDecayController {
*
* @param pageNum
* @param pageSize
* @param nuclide 核素名称
* @param nuclide 核素名称
* @return
*/
@GetMapping("/page")
@ -80,29 +89,10 @@ public class GardsNuclideDecayController {
public Result<IPage<GardsNuclideDecay>> page(
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(required = false) String nuclide) {
return gardsNuclideDecayService.page(pageNum, pageSize, nuclide);
}
/**
* 组合条件查询
*
* @param nuclide 名称
* @return
*/
@GetMapping("/search")
@Operation(summary = "组合条件查询")
public Result<List<GardsNuclideDecay>> search(@RequestParam(required = false) String nuclide ) {
try {
List<GardsNuclideDecay> list = gardsNuclideDecayService.getByConditions(nuclide);
return Result.OK(list);
} catch (Exception e) {
log.error("search: " + e.getMessage());
return Result.error("查询失败");
}
@RequestParam(required = false) String nuclide,
@RequestParam(required = false) String energy) {
return Result.OK(gardsNuclideDecayService.page(pageNum, pageSize, nuclide, energy));
}
@AutoLog(value = "导出模版")
@ -112,23 +102,26 @@ public class GardsNuclideDecayController {
ExportParams params = new ExportParams();
params.setTitle("加合峰信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
ExcelExportUtil.exportExcel(params, GardsNuclideDecay.class, new ArrayList<>()).write(response.getOutputStream());
ExcelExportUtil.exportExcel(params, GardsNuclideDecay.class, new ArrayList<>())
.write(response.getOutputStream());
}
@AutoLog(value = "导出Excel")
@Operation(summary = "台站导出Excel")
@GetMapping("/exportExcel")
public void exportExcel(HttpServletResponse response,
@RequestParam(required = false) String nuclide) throws IOException {
@RequestParam(required = false) String nuclide,
@RequestParam(required = false) String energy) throws IOException {
ExportParams params = new ExportParams();
params.setTitle("加合峰信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
List<GardsNuclideDecay> list = gardsNuclideDecayService.getByConditions(nuclide);
ExcelExportUtil.exportExcel(params, GardsNuclideDecay.class, list).write(response.getOutputStream());
List<GardsNuclideDecay> list = gardsNuclideDecayService.getByConditions(nuclide, energy);
ExcelExportUtil.exportExcel(params, GardsNuclideDecay.class, list)
.write(response.getOutputStream());
}
/**
@ -158,11 +151,15 @@ public class GardsNuclideDecayController {
try {
// 3. 使用 AutoPoi 工具类解析 Excel
List<GardsNuclideDecay> list = ExcelImportUtil.importExcel(file.getInputStream(), GardsNuclideDecay.class, params);
List<GardsNuclideDecay> list =
ExcelImportUtil.importExcel(file.getInputStream(), GardsNuclideDecay.class,
params);
// 4. 批量保存数据到数据库
gardsNuclideDecayService.saveBatch(list);
//gardsNuclideDecayService.saveBatch(list);
if (!CollectionUtils.isEmpty(list)) {
list.forEach(item -> gardsNuclideDecayService.save(item));
}
return Result.OK("文件导入成功!数据行数:" + list.size());
} catch (Exception e) {
return Result.error("文件导入失败:" + e.getMessage());

View File

@ -1,18 +1,13 @@
package org.jeecg.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.base.entity.configuration.GardsNuclearTestingPlant;
import org.jeecg.modules.base.entity.configuration.GardsResearchReactors;
import org.jeecg.modules.base.entity.configuration.GardsResearchReactors;
import org.jeecg.service.GardsResearchReactorsService;
import org.jeecg.service.GardsResearchReactorsService;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
@ -20,6 +15,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -28,10 +24,15 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 研究型生产反应堆信息
*/
@Slf4j
@RestController
@RequestMapping("/gardsResearchReactors")//C17ZNRJDMD6N
public class GardsResearchReactorsController {
final short titleHeight = 8;
@Autowired
private GardsResearchReactorsService gardsResearchReactorsService;
@ -41,7 +42,8 @@ public class GardsResearchReactorsController {
@PostMapping("/create")
@Operation(summary = "新增反应堆信息")
public Result<?> create(@RequestBody GardsResearchReactors gardsResearchReactors) {
return gardsResearchReactorsService.create(gardsResearchReactors);
gardsResearchReactorsService.save(gardsResearchReactors);
return Result.OK("新增成功!");
}
/**
@ -50,7 +52,8 @@ public class GardsResearchReactorsController {
@DeleteMapping("/delete")
@Operation(summary = "删除反应堆信息")
public Result<?> deleteById(@RequestParam Integer id) {
return gardsResearchReactorsService.deleteById(id);
gardsResearchReactorsService.removeById(id);
return Result.OK("删除成功!");
}
/**
@ -59,7 +62,8 @@ public class GardsResearchReactorsController {
@PutMapping("/update")
@Operation(summary = "更新反应堆信息")
public Result<?> update(@RequestBody GardsResearchReactors gardsResearchReactors) {
return gardsResearchReactorsService.update(gardsResearchReactors);
gardsResearchReactorsService.update(gardsResearchReactors);
return Result.OK("");
}
/**
@ -68,7 +72,7 @@ public class GardsResearchReactorsController {
@GetMapping("/queryById")
@Operation(summary = "查询反应堆信息")
public Result<GardsResearchReactors> getById(@RequestParam Integer id) {
return gardsResearchReactorsService.queryById(id);
return Result.OK(gardsResearchReactorsService.queryById(id));
}
/**
@ -88,33 +92,8 @@ public class GardsResearchReactorsController {
@RequestParam(required = false) String facilityName,
@RequestParam(required = false) String country) {
return gardsResearchReactorsService.page(pageNum, pageSize,facilityName,country);
}
/**
* 组合条件查询
*
* @param facilityName 地点名称
* @param country 具体核素
* @return
*/
@GetMapping("/search")
@Operation(summary = "反应堆信息组合条件查询")
public Result<List<GardsResearchReactors>> search(@RequestParam(required = false) String facilityName,
@RequestParam(required = false) String country,
@RequestParam(required = false) String reactorType,
@RequestParam(required = false) String status) {
try {
List<GardsResearchReactors> list = gardsResearchReactorsService.getByConditions(facilityName, country, reactorType, status);
return Result.OK(list);
} catch (Exception e) {
log.error("search: " + e.getMessage());
return Result.error("查询失败");
}
return Result.OK(
gardsResearchReactorsService.page(pageNum, pageSize, facilityName, country));
}
@AutoLog(value = "导出模版")
@ -124,9 +103,10 @@ public class GardsResearchReactorsController {
ExportParams params = new ExportParams();
params.setTitle("反应堆信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
ExcelExportUtil.exportExcel(params, GardsResearchReactors.class, new ArrayList<>()).write(response.getOutputStream());
ExcelExportUtil.exportExcel(params, GardsResearchReactors.class, new ArrayList<>())
.write(response.getOutputStream());
}
@AutoLog(value = "导出Excel")
@ -142,8 +122,11 @@ public class GardsResearchReactorsController {
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setType(ExcelType.XSSF);
List<GardsResearchReactors> list = gardsResearchReactorsService.getByConditions(facilityName, country, reactorType, status);
ExcelExportUtil.exportExcel(params, GardsResearchReactors.class, list).write(response.getOutputStream());
List<GardsResearchReactors> list =
gardsResearchReactorsService.getByConditions(facilityName, country, reactorType,
status);
ExcelExportUtil.exportExcel(params, GardsResearchReactors.class, list)
.write(response.getOutputStream());
}
@ -174,11 +157,14 @@ public class GardsResearchReactorsController {
try {
// 3. 使用 AutoPoi 工具类解析 Excel
List<GardsResearchReactors> list = ExcelImportUtil.importExcel(file.getInputStream(), GardsResearchReactors.class, params);
List<GardsResearchReactors> list =
ExcelImportUtil.importExcel(file.getInputStream(),
GardsResearchReactors.class, params);
// 4. 批量保存数据到数据库
gardsResearchReactorsService.saveBatch(list);
if (!CollectionUtils.isEmpty(list)) {
list.forEach(item -> gardsResearchReactorsService.save(item));
}
return Result.OK("文件导入成功!数据行数:" + list.size());
} catch (Exception e) {
return Result.error("文件导入失败:" + e.getMessage());

View File

@ -1,17 +1,13 @@
package org.jeecg.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.base.entity.configuration.GardsResearchReactors;
import org.jeecg.modules.base.entity.configuration.GardsStations;
import org.jeecg.service.GardsResearchReactorsService;
import org.jeecg.service.GardsStationsService;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
@ -27,10 +23,15 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 台站信息
*/
@Slf4j
@RestController
@RequestMapping("/gardsStations")
public class GardsStationsController {
final short titleHeight = 8;
@Autowired
private GardsStationsService gardsStationsService;
@ -40,7 +41,8 @@ public class GardsStationsController {
@PostMapping("/create")
@Operation(summary = "新增台站信息")
public Result<?> create(@RequestBody GardsStations gardsStations) {
return gardsStationsService.create(gardsStations);
gardsStationsService.save(gardsStations);
return Result.OK("新增成功!");
}
/**
@ -49,7 +51,8 @@ public class GardsStationsController {
@DeleteMapping("/delete")
@Operation(summary = "删除台站信息")
public Result<?> deleteById(@RequestParam Integer stationId) {
return gardsStationsService.deleteById(stationId);
gardsStationsService.removeById(stationId);
return Result.OK("删除成功!");
}
/**
@ -58,7 +61,8 @@ public class GardsStationsController {
@PutMapping("/update")
@Operation(summary = "更新台站信息")
public Result<?> update(@RequestBody GardsStations gardsStations) {
return gardsStationsService.update(gardsStations);
gardsStationsService.update(gardsStations);
return Result.OK();
}
/**
@ -67,7 +71,7 @@ public class GardsStationsController {
@GetMapping("/queryById")
@Operation(summary = "查询台站信息")
public Result<GardsStations> getById(@RequestParam Integer stationId) {
return gardsStationsService.queryById(stationId);
return Result.OK(gardsStationsService.queryById(stationId));
}
/**
@ -87,32 +91,9 @@ public class GardsStationsController {
@RequestParam(required = false) String stationCode,
@RequestParam(required = false) String countryCode) {
return gardsStationsService.page(pageNum, pageSize, stationCode, countryCode);
return Result.OK(gardsStationsService.page(pageNum, pageSize, stationCode, countryCode));
}
/**
* 组合条件查询
*
* @param stationCode 地点名称
* @param type 类型
* @return
*/
@GetMapping("/search")
@Operation(summary = "台站组合条件查询")
public Result<List<GardsStations>> search(@RequestParam(required = false) String stationCode,
@RequestParam(required = false) String type,
@RequestParam(required = false) String status,
@RequestParam(required = false) String countryCode) {
try {
List<GardsStations> list = gardsStationsService.getByConditions(stationCode, type, status, countryCode);
return Result.OK(list);
} catch (Exception e) {
log.error("search: " + e.getMessage());
return Result.error("查询失败");
}
}
@AutoLog(value = "导出模版")
@Operation(summary = "台站导出模版")
@ -121,9 +102,10 @@ public class GardsStationsController {
ExportParams params = new ExportParams();
params.setTitle("台站信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
ExcelExportUtil.exportExcel(params, GardsStations.class, new ArrayList<>()).write(response.getOutputStream());
ExcelExportUtil.exportExcel(params, GardsStations.class, new ArrayList<>())
.write(response.getOutputStream());
}
@AutoLog(value = "导出Excel")
@ -137,10 +119,12 @@ public class GardsStationsController {
ExportParams params = new ExportParams();
params.setTitle("台站信息");
params.setFixedTitle(true);
params.setTitleHeight((short) 8);
params.setTitleHeight(titleHeight);
params.setType(ExcelType.XSSF);
List<GardsStations> list = gardsStationsService.getByConditions(stationCode, type, status, countryCode);
ExcelExportUtil.exportExcel(params, GardsStations.class, list).write(response.getOutputStream());
List<GardsStations> list =
gardsStationsService.getByConditions(stationCode, type, status, countryCode);
ExcelExportUtil.exportExcel(params, GardsStations.class, list)
.write(response.getOutputStream());
}
/**
@ -170,11 +154,13 @@ public class GardsStationsController {
try {
// 3. 使用 AutoPoi 工具类解析 Excel
List<GardsStations> list = ExcelImportUtil.importExcel(file.getInputStream(), GardsStations.class, params);
List<GardsStations> list =
ExcelImportUtil.importExcel(file.getInputStream(), GardsStations.class,
params);
// 4. 批量保存数据到数据库
gardsStationsService.saveBatch(list);
//gardsStationsService.saveBatch(list);
list.forEach(item -> gardsStationsService.save(item));
return Result.OK("文件导入成功!数据行数:" + list.size());
} catch (Exception e) {
return Result.error("文件导入失败:" + e.getMessage());

View File

@ -11,41 +11,14 @@ import java.util.List;
public interface GardsAcceleratorService extends IService<GardsAccelerator> {
Result<?> create(GardsAccelerator gardsAccelerator);
void create(GardsAccelerator gardsAccelerator);
Result<?> delete(Integer id);
void delete(Integer id);
Result<?> update(GardsAccelerator gardsAccelerator);
void update(GardsAccelerator gardsAccelerator);
Result<GardsAccelerator> queryById(Integer id);
GardsAccelerator queryById(Integer id);
Result<IPage<GardsAccelerator>> queryPage(Integer pageNum, Integer pageSize, String country, String facilityName);
/**
* 根据设施代码查询设施信息
* 根据设施代码查询设施信息
*/
GardsAccelerator getByFacilityCode(String facilityCode);
/**
* 根据国家查询设施列表
*/
List<GardsAccelerator> getByCountry(String country);
/**
* 根据运行状态查询设施列表
*/
List<GardsAccelerator> getByOperationalStatus(Integer isOperational);
/**
* 根据分类查询设施列表
*/
List<GardsAccelerator> getByCategory(String category);
/**
* 条件查询国家 + 运行状态
*/
List<GardsAccelerator> getByCountryAndStatus(String country, Integer isOperational);
IPage<GardsAccelerator> queryPage(Integer pageNum, Integer pageSize, String country, String facilityName);
}

View File

@ -18,58 +18,30 @@ public interface GardsCorrectionFactorService extends IService<GardsCorrectionFa
* 新增校正因子
*/
Result<?> create(GardsCorrectionFactor gardsCorrectionFactor) ;
void create(GardsCorrectionFactor gardsCorrectionFactor);
/**
* 根据ID删除校正因子
*/
Result<?> delete( Integer id);
void delete(Integer id);
/**
* 更新校正因子信息
*/
Result<?> update(GardsCorrectionFactor gardsCorrectionFactor) ;
void update(GardsCorrectionFactor gardsCorrectionFactor);
/**
* 根据ID查询校正因子详情
*/
Result<GardsCorrectionFactor> queryById(Integer id);
GardsCorrectionFactor queryById(Integer id);
/**
* 分页查询校正因子列表
*/
Result<IPage<GardsCorrectionFactor>> page(Integer pageNum, Integer pageSize, String stationCode, String detectorCode);
/**
* 根据站点代码查询校正因子列表
*/
List<GardsCorrectionFactor> getByStationCode(String stationCode);
/**
* 根据探测器代码查询校正因子列表
*/
List<GardsCorrectionFactor> getByDetectorCode(String detectorCode);
/**
* 根据站点和探测器代码查询校正因子
*/
List<GardsCorrectionFactor> getByStationAndDetector(String stationCode, String detectorCode);
/**
* 根据制造商查询校正因子列表
*/
List<GardsCorrectionFactor> getByManufacturer(String manufacturer);
/**
* 根据型号查询校正因子列表
*/
List<GardsCorrectionFactor> getByModel(String model);
IPage<GardsCorrectionFactor> page(Integer pageNum, Integer pageSize, String stationCode, String detectorCode);
/**
* 条件组合查询
@ -77,9 +49,4 @@ public interface GardsCorrectionFactorService extends IService<GardsCorrectionFa
List<GardsCorrectionFactor> getByConditions(String stationCode, String detectorCode,
String manufacturer, String model);
/**
* 批量更新校正因子
*/
boolean updateBatchCorrectionFactors(List<GardsCorrectionFactor> factors);
}

View File

@ -21,51 +21,40 @@ public interface GardsNuclearFuelFacilityService extends IService<GardsNuclearFu
* 新增核燃料设施信息
*/
Result<?> create(GardsNuclearFuelFacilities facility);
void create(GardsNuclearFuelFacilities facility);
/**
* 根据ID删除核燃料设施信息
*/
Result<?> delete(Integer id);
void delete(Integer id);
/**
* 更新核燃料设施信息
*/
Result<?> update(GardsNuclearFuelFacilities facility);
void update(GardsNuclearFuelFacilities facility);
/**
* 根据ID查询核燃料设施详情
*/
Result<GardsNuclearFuelFacilities> queryById(Integer id);
GardsNuclearFuelFacilities queryById(Integer id);
/**
* 分页查询核燃料设施列表
*/
Result<IPage<GardsNuclearFuelFacilities>> page(Integer pageNum, Integer pageSize,
IPage<GardsNuclearFuelFacilities> page(Integer pageNum, Integer pageSize,
String facilityType,
String facilityStatus,
String facilityName,
String country);
/**
* 根据设施名称模糊查询
*/
List<GardsNuclearFuelFacilities> getByFacilityNameLike(String facilityName);
/**
* 多条件组合查询
*/
List<GardsNuclearFuelFacilities> getByConditions(String facilityType, String facilityStatus, String country, String facilityName, String fuelType);
/**
* 批量更新设施状态
*/
boolean updateBatchFacilityStatus(List<Long> ids, String status);
}

View File

@ -21,7 +21,7 @@ public interface GardsNuclearReactorsService extends IService<GardsNuclearReacto
* @return
*/
Result<?> create(@RequestBody GardsNuclearReactors gardsNuclearReactors);
void create(@RequestBody GardsNuclearReactors gardsNuclearReactors);
/**
* 删除反应堆数据
@ -30,7 +30,7 @@ public interface GardsNuclearReactorsService extends IService<GardsNuclearReacto
* @return
*/
Result<?> delete(@RequestParam Integer id);
void delete(@RequestParam Integer id);
/**
* 更新反应堆数据
@ -39,7 +39,7 @@ public interface GardsNuclearReactorsService extends IService<GardsNuclearReacto
* @return
*/
Result<?> update(@RequestBody GardsNuclearReactors gardsNuclearReactors);
void update(@RequestBody GardsNuclearReactors gardsNuclearReactors);
/**
* 根据Id查询反应堆数据
@ -48,7 +48,7 @@ public interface GardsNuclearReactorsService extends IService<GardsNuclearReacto
* @return
*/
Result<GardsNuclearReactors> queryById(@RequestParam Integer id);
GardsNuclearReactors queryById(@RequestParam Integer id);
/**
* 分页查询反应堆数据
@ -60,19 +60,17 @@ public interface GardsNuclearReactorsService extends IService<GardsNuclearReacto
* @return
*/
Result<IPage<GardsNuclearReactors>> page( Integer pageNum,
Integer pageSize,
String unitName,
String country);
IPage<GardsNuclearReactors> page(Integer pageNum,
Integer pageSize,
String unitName,
String country);
/**
* 多条件组合查询
*
* @return List
*/
List<GardsNuclearReactors> getByConditions(String unitName,String country,String reactorType,String reactorStatus);
void saveOrUpdateBatchByUniqueFields(List<GardsNuclearReactors> list);
List<GardsNuclearReactors> getByConditions(String unitName, String country, String reactorType, String reactorStatus);
}

View File

@ -18,45 +18,45 @@ public interface GardsNuclearReleaseService extends IService<GardsNuclearRelease
* 新增加核设施放射性排放记录信息
*/
Result<?> create(GardsNuclearReleaseRecords gardsNuclearReleaseRecords);
void create(GardsNuclearReleaseRecords gardsNuclearReleaseRecords);
/**
* 删除核设施放射性排放记录信息
*/
Result<?> deleteById(Integer id);
void deleteById(Integer id);
/**
* 更新核设施放射性排放记录信息
*/
Result<?> update(GardsNuclearReleaseRecords gardsNuclearReleaseRecords);
void update(GardsNuclearReleaseRecords gardsNuclearReleaseRecords);
/**
* 查询核设施放射性排放记录信息
*/
Result<GardsNuclearReleaseRecords> queryById(Integer id);
GardsNuclearReleaseRecords queryById(Integer id);
/**
* 分页查询
*
* @param pageNum 页数
* @param pageSize 每页大小
* @param pageNum 页数
* @param pageSize 每页大小
* @param facilityName 设施名称
* @param nuclide 核素
* @param nuclide 核素
* @return 分页结果
*/
Result<IPage<GardsNuclearReleaseRecords>> page(Integer pageNum, Integer pageSize, String facilityName, String nuclide);
IPage<GardsNuclearReleaseRecords> page(Integer pageNum, Integer pageSize, String facilityName, String nuclide);
/**
* 多条件组合查询
*
* @param facilityName 站点/电厂名称
* @param nuclide 具体核素
* @param matterState 物质状态 1-气体,2-气溶胶
* @param facilityName 站点/电厂名称
* @param nuclide 具体核素
* @param matterState 物质状态 1-气体,2-气溶胶
* @return List
*/
List<GardsNuclearReleaseRecords> getByConditions(String facilityName, String nuclide, String matterState);

View File

@ -19,27 +19,27 @@ public interface GardsNuclearTestingPlantService extends IService<GardsNuclearTe
* 新增 核试验信息
*/
Result<?> create(GardsNuclearTestingPlant gardsNuclearTestingPlant);
void create(GardsNuclearTestingPlant gardsNuclearTestingPlant);
/**
* 删除核设施放射性排放记录信息
*/
Result<?> deleteById(Integer id);
void deleteById(Integer id);
/**
* 更新核设施放射性排放记录信息
*/
Result<?> update(GardsNuclearTestingPlant gardsNuclearTestingPlant);
void update(GardsNuclearTestingPlant gardsNuclearTestingPlant);
/**
* 查询核设施放射性排放记录信息
*/
Result<GardsNuclearTestingPlant> queryById(Integer id);
GardsNuclearTestingPlant queryById(Integer id);
Result<IPage<GardsNuclearTestingPlant>> page(
IPage<GardsNuclearTestingPlant> page(
Integer pageNum,
Integer pageSize,
String name,

View File

@ -14,22 +14,22 @@ public interface GardsNuclideDecayService extends IService<GardsNuclideDecay> {
* 新增信息
*/
Result<?> create(GardsNuclideDecay gardsNuclideDecay);
void create(GardsNuclideDecay GardsNuclideDecay);
/**
* 删除信息
*/
Result<?> deleteById(Integer Id);
void deleteById(Integer id);
/**
* 更新信息
*/
Result<?> update(GardsNuclideDecay gardsNuclideDecay);
void update(GardsNuclideDecay GardsNuclideDecay);
/**
* 查询信息
*/
Result<GardsNuclideDecay> queryById(Integer Id);
GardsNuclideDecay queryById(Integer id);
/**
* 分页查询
@ -39,10 +39,11 @@ public interface GardsNuclideDecayService extends IService<GardsNuclideDecay> {
* @param nuclide
* @return
*/
Result<IPage<GardsNuclideDecay>> page(
IPage<GardsNuclideDecay> page(
Integer pageNum,
Integer pageSize,
String nuclide);
String nuclide,
String energy);
/**
* 多条件组合查询
@ -50,7 +51,7 @@ public interface GardsNuclideDecayService extends IService<GardsNuclideDecay> {
* @param nuclide 名称
* @return List
*/
List<GardsNuclideDecay> getByConditions(String nuclide);
List<GardsNuclideDecay> getByConditions(String nuclide, String energy);
}

View File

@ -18,25 +18,25 @@ public interface GardsResearchReactorsService extends IService<GardsResearchReac
* 新增信息
*/
Result<?> create(@RequestBody GardsResearchReactors gardsResearchReactors);
void create(@RequestBody GardsResearchReactors gardsResearchReactors);
/**
* 删除信息
*/
Result<?> deleteById(@RequestParam Integer id) ;
void deleteById(@RequestParam Integer id) ;
/**
* 更新反应堆信息
*/
Result<?> update(@RequestBody GardsResearchReactors gardsResearchReactors) ;
void update(@RequestBody GardsResearchReactors gardsResearchReactors) ;
/**
* 查询信息
*/
Result<GardsResearchReactors> queryById(@RequestParam Integer id) ;
GardsResearchReactors queryById(@RequestParam Integer id) ;
/**
* 分页查询
@ -48,7 +48,7 @@ public interface GardsResearchReactorsService extends IService<GardsResearchReac
* @return
*/
Result<IPage<GardsResearchReactors>> page(
IPage<GardsResearchReactors> page(
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(required = false) String facilityName,

View File

@ -15,27 +15,26 @@ import java.util.List;
public interface GardsStationsService extends IService<GardsStations> {
/**
* 新增信息
*/
Result<?> create( GardsStations gardsStations) ;
void create(GardsStations gardsStations);
/**
* 删除信息
*/
Result<?> deleteById( Integer stationId) ;
void deleteById(Integer stationId);
/**
* 更新信息
*/
Result<?> update( GardsStations gardsStations);
void update(GardsStations gardsStations);
/**
* 查询信息
*/
Result<GardsStations> queryById( Integer stationId) ;
GardsStations queryById(Integer stationId);
/**
* 分页查询
@ -46,23 +45,19 @@ public interface GardsStationsService extends IService<GardsStations> {
* @param countryCode
* @return
*/
Result<IPage<GardsStations>> page(
Integer pageNum,
IPage<GardsStations> page(
Integer pageNum,
Integer pageSize,
String stationCode,
String countryCode);
/**
* 多条件组合查询
* @param stationCode 名称
* @param type 类型
*
* @param stationCode 名称
* @param type 类型
* @return List
*/
List<GardsStations> getByConditions(String stationCode, String type, String status,String countryCode);
List<GardsStations> getByConditions(String stationCode, String type, String status, String countryCode);
}

View File

@ -5,141 +5,60 @@ 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;
import java.util.Objects;
@Service
@DS("ora")
public class GardsAcceleratorServiceImpl extends ServiceImpl<GardsAcceleratorMapper,GardsAccelerator> implements GardsAcceleratorService {
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("操作失败");
}
public void create(GardsAccelerator gardsAccelerator) {
this.save(gardsAccelerator);
}
@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("操作失败");
public void delete(Integer id) {
this.removeById(id);
}
@Override
@Transactional(rollbackFor = RuntimeException.class)
public void update(GardsAccelerator gardsAccelerator) {
this.updateById(gardsAccelerator);
}
@Override
public IPage<GardsAccelerator> queryPage(Integer pageNum, Integer pageSize, String country,
String facilityName) {
Page<GardsAccelerator> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsAccelerator> wrapper = new LambdaQueryWrapper<>();
if (facilityName != null && !facilityName.trim().isEmpty()) {
wrapper.like(GardsAccelerator::getFacilityName, facilityName);
}
}
@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("分页查询失败");
if (country != null && !country.trim().isEmpty()) {
wrapper.like(GardsAccelerator::getCountry, country);
}
wrapper.orderByDesc(GardsAccelerator::getId);
return this.page(page, wrapper);
}
@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("查询失败");
public GardsAccelerator queryById(Integer id) {
GardsAccelerator facility = this.getById(id);
if (Objects.isNull(facility)) {
throw new RuntimeException("未找到对应的数据");
}
}
@Override
public GardsAccelerator getByFacilityCode(String facilityCode) {
LambdaQueryWrapper<GardsAccelerator> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsAccelerator::getFacilityCode, facilityCode);
return this.getOne(wrapper);
}
@Override
public List<GardsAccelerator> getByCountry(String country) {
LambdaQueryWrapper<GardsAccelerator> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsAccelerator::getCountry, country);
return this.list(wrapper);
}
@Override
public List<GardsAccelerator> getByOperationalStatus(Integer isOperational) {
LambdaQueryWrapper<GardsAccelerator> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsAccelerator::getIsOperational, isOperational);
return this.list(wrapper);
}
@Override
public List<GardsAccelerator> getByCategory(String category) {
LambdaQueryWrapper<GardsAccelerator> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsAccelerator::getCategory, category);
return this.list(wrapper);
}
@Override
public List<GardsAccelerator> getByCountryAndStatus(String country, Integer isOperational) {
LambdaQueryWrapper<GardsAccelerator> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsAccelerator::getCountry, country)
.eq(GardsAccelerator::getIsOperational, isOperational);
return this.list(wrapper);
return facility;
}
}

View File

@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
@Service
@DS("ora")
@ -28,38 +29,17 @@ public class GardsCorrectionFactorServiceImpl extends ServiceImpl<GardsCorrectio
*/
@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("操作失败");
}
public void create(@RequestBody GardsCorrectionFactor gardsCorrectionFactor) {
this.save(gardsCorrectionFactor);
}
/**
* 根据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("操作失败");
}
public void delete(Integer id) {
this.removeById(id);
}
/**
@ -67,18 +47,8 @@ public class GardsCorrectionFactorServiceImpl extends ServiceImpl<GardsCorrectio
*/
@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("操作失败");
}
public void update(GardsCorrectionFactor gardsCorrectionFactor) {
this.updateById(gardsCorrectionFactor);
}
/**
@ -86,33 +56,25 @@ public class GardsCorrectionFactorServiceImpl extends ServiceImpl<GardsCorrectio
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Result<GardsCorrectionFactor> queryById(Integer id) {
try {
public GardsCorrectionFactor queryById(Integer id) {
GardsCorrectionFactor factor = this.getById(id);
if (factor != null) {
return Result.OK("查询成功", factor);
} else {
return Result.error("未找到对应的校正因子信息");
if (Objects.isNull(factor)) {
throw new RuntimeException("未找到对应的数据");
}
} catch (Exception e) {
log.error("操作失败: " + e.getMessage());
return Result.error("查询失败");
}
return factor;
}
/**
* 分页查询校正因子列表
*/
@Override
public Result<IPage<GardsCorrectionFactor>> page(
public 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);
}
@ -120,49 +82,7 @@ public class GardsCorrectionFactorServiceImpl extends ServiceImpl<GardsCorrectio
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<>();
wrapper.eq(GardsCorrectionFactor::getStationCode, stationCode);
return this.list(wrapper);
}
@Override
public List<GardsCorrectionFactor> getByDetectorCode(String detectorCode) {
LambdaQueryWrapper<GardsCorrectionFactor> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsCorrectionFactor::getDetectorCode, detectorCode);
return this.list(wrapper);
}
@Override
public List<GardsCorrectionFactor> getByStationAndDetector(String stationCode, String detectorCode) {
LambdaQueryWrapper<GardsCorrectionFactor> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsCorrectionFactor::getStationCode, stationCode)
.eq(GardsCorrectionFactor::getDetectorCode, detectorCode);
return this.list(wrapper);
}
@Override
public List<GardsCorrectionFactor> getByManufacturer(String manufacturer) {
LambdaQueryWrapper<GardsCorrectionFactor> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsCorrectionFactor::getManufacturer, manufacturer);
return this.list(wrapper);
}
@Override
public List<GardsCorrectionFactor> getByModel(String model) {
LambdaQueryWrapper<GardsCorrectionFactor> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GardsCorrectionFactor::getModel, model);
return this.list(wrapper);
return this.page(page, wrapper);
}
@Override
@ -186,8 +106,4 @@ public class GardsCorrectionFactorServiceImpl extends ServiceImpl<GardsCorrectio
return this.list(wrapper);
}
@Override
public boolean updateBatchCorrectionFactors(List<GardsCorrectionFactor> factors) {
return this.updateBatchById(factors);
}
}

View File

@ -5,8 +5,6 @@ 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;
@ -15,10 +13,13 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
@Service
@DS("ora")
public class GardsNuclearFuelFacilityServiceImpl extends ServiceImpl<GardsNuclearFuelFacilitiesMapper, GardsNuclearFuelFacilities> implements GardsNuclearFuelFacilityService {
public class GardsNuclearFuelFacilityServiceImpl
extends ServiceImpl<GardsNuclearFuelFacilitiesMapper, GardsNuclearFuelFacilities>
implements GardsNuclearFuelFacilityService {
/**
@ -26,18 +27,8 @@ public class GardsNuclearFuelFacilityServiceImpl extends ServiceImpl<GardsNuclea
*/
@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("操作失败");
}
public void create(GardsNuclearFuelFacilities facility) {
this.save(facility);
}
/**
@ -45,18 +36,8 @@ public class GardsNuclearFuelFacilityServiceImpl extends ServiceImpl<GardsNuclea
*/
@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("操作失败 ");
}
public void delete(Integer id) {
this.removeById(id);
}
/**
@ -64,82 +45,55 @@ public class GardsNuclearFuelFacilityServiceImpl extends ServiceImpl<GardsNuclea
*/
@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("操作失败");
}
public void update(GardsNuclearFuelFacilities facility) {
this.updateById(facility);
}
/**
* 根据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("查询失败");
public GardsNuclearFuelFacilities queryById(Integer id) {
GardsNuclearFuelFacilities facility = this.getById(id);
if (Objects.isNull(facility)) {
throw new RuntimeException("未找到对应数据");
}
return facility;
}
/**
* 分页查询核燃料设施列表
*/
@Override
public Result<IPage<GardsNuclearFuelFacilities>> page(
public 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) {
Page<GardsNuclearFuelFacilities> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsNuclearFuelFacilities> wrapper = new LambdaQueryWrapper<>();
wrapper.like(GardsNuclearFuelFacilities::getFacilityName, facilityName);
return this.list(wrapper);
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 pageResult;
}
@Override
public List<GardsNuclearFuelFacilities> getByConditions(String facilityType, String facilityStatus, String country, String facilityName, String fuelType) {
public List<GardsNuclearFuelFacilities> getByConditions(String facilityType,
String facilityStatus, String country,
String facilityName, String fuelType) {
LambdaQueryWrapper<GardsNuclearFuelFacilities> wrapper = new LambdaQueryWrapper<>();
if (facilityType != null && !facilityType.trim().isEmpty()) {
@ -161,13 +115,4 @@ public class GardsNuclearFuelFacilityServiceImpl extends ServiceImpl<GardsNuclea
return this.list(wrapper);
}
@Override
public boolean updateBatchFacilityStatus(List<Long> ids, String status) {
LambdaQueryWrapper<GardsNuclearFuelFacilities> wrapper = new LambdaQueryWrapper<>();
wrapper.in(GardsNuclearFuelFacilities::getId, ids);
GardsNuclearFuelFacilities updateEntity = new GardsNuclearFuelFacilities();
return this.update(updateEntity, wrapper);
}
}

View File

@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
@Service
@DS("ora")
@ -29,19 +30,8 @@ public class GardsNuclearReactorsServiceImpl extends ServiceImpl<GardsNuclearRea
*/
@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("操作失败");
}
public void create(GardsNuclearReactors gardsNuclearReactors) {
this.save(gardsNuclearReactors);
}
/**
@ -52,18 +42,8 @@ public class GardsNuclearReactorsServiceImpl extends ServiceImpl<GardsNuclearRea
*/
@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("操作失败");
}
public void delete(Integer id) {
this.removeById(id);
}
/**
@ -74,19 +54,8 @@ public class GardsNuclearReactorsServiceImpl extends ServiceImpl<GardsNuclearRea
*/
@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("操作失败");
}
public void update(GardsNuclearReactors gardsNuclearReactors) {
this.updateById(gardsNuclearReactors);
}
/**
@ -96,19 +65,13 @@ public class GardsNuclearReactorsServiceImpl extends ServiceImpl<GardsNuclearRea
* @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("查询失败");
}
public GardsNuclearReactors queryById(Integer id) {
GardsNuclearReactors nuclearReactors = this.getById(id);
if (Objects.isNull(nuclearReactors)) {
throw new RuntimeException("未找到对应的数据");
}
return nuclearReactors;
}
/**
@ -121,39 +84,29 @@ public class GardsNuclearReactorsServiceImpl extends ServiceImpl<GardsNuclearRea
* @return IPage
*/
@Override
public Result<IPage<GardsNuclearReactors>> page(
public IPage<GardsNuclearReactors> page(
Integer pageNum,
Integer pageSize,
String unitName,
String country) {
Page<GardsNuclearReactors> page = new Page<>(pageNum, pageSize);
try {
Page<GardsNuclearReactors> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsNuclearReactors> wrapper = new LambdaQueryWrapper<>();
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("查询失败");
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 pageResult;
}
@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.like(GardsNuclearReactors::getUnitName, unitName);
@ -170,10 +123,4 @@ public class GardsNuclearReactorsServiceImpl extends ServiceImpl<GardsNuclearRea
wrapper.orderByDesc(GardsNuclearReactors::getId);
return this.list(wrapper);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveOrUpdateBatchByUniqueFields(List<GardsNuclearReactors> list) {
this.saveOrUpdateBatch(list);
}
}

View File

@ -16,6 +16,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
@Service
@DS("ora")
public class GardsNuclearReleaseServiceImpl extends ServiceImpl<GardsNuclearReleaseRecordsMapper, GardsNuclearReleaseRecords> implements GardsNuclearReleaseService {
@ -26,18 +28,8 @@ public class GardsNuclearReleaseServiceImpl extends ServiceImpl<GardsNuclearRele
*/
@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("添加失败");
}
public void create(@RequestBody GardsNuclearReleaseRecords gardsNuclearReleaseRecords) {
this.save(gardsNuclearReleaseRecords);
}
/**
@ -45,19 +37,8 @@ public class GardsNuclearReleaseServiceImpl extends ServiceImpl<GardsNuclearRele
*/
@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("操作失败");
}
public void deleteById(@RequestParam Integer id) {
this.removeById(id);
}
/**
@ -65,89 +46,60 @@ public class GardsNuclearReleaseServiceImpl extends ServiceImpl<GardsNuclearRele
*/
@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("操作失败");
}
public void update(@RequestBody GardsNuclearReleaseRecords gardsNuclearReleaseRecords) {
this.updateById(gardsNuclearReleaseRecords);
}
/**
* 查询核设施放射性排放记录信息
*/
@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("查询失败");
public GardsNuclearReleaseRecords queryById(@RequestParam Integer id) {
GardsNuclearReleaseRecords nuclearReactors = this.getById(id);
if (Objects.isNull(nuclearReactors)) {
throw new RuntimeException("未找到对应的数据");
}
return nuclearReactors;
}
/**
* 分页查询
*
* @param pageNum 页数
* @param pageSize 每页大小
* @param pageNum 页数
* @param pageSize 每页大小
* @param facilityName 设施名称
* @param nuclide 核素
* @param nuclide 核素
* @return 分页结果
*/
@Override
public Result<IPage<GardsNuclearReleaseRecords>> page(
public 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()) {
wrapper.like(GardsNuclearReleaseRecords::getNuclide, nuclide);
}
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("查询失败:");
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()) {
wrapper.like(GardsNuclearReleaseRecords::getNuclide, nuclide);
}
wrapper.orderByDesc(GardsNuclearReleaseRecords::getId);
IPage<GardsNuclearReleaseRecords> pageResult = this.page(page, wrapper);
return pageResult;
}
@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);
}

View File

@ -15,29 +15,20 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
@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("添加失败");
}
public void create(@RequestBody GardsNuclearTestingPlant gardsNuclearTestingPlant) {
this.save(gardsNuclearTestingPlant);
}
/**
@ -45,19 +36,8 @@ public class GardsNuclearTestingPlantServiceImpl extends ServiceImpl<GardsNuclea
*/
@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("操作失败:");
}
public void deleteById(@RequestParam Integer id) {
this.removeById(id);
}
/**
@ -65,50 +45,29 @@ public class GardsNuclearTestingPlantServiceImpl extends ServiceImpl<GardsNuclea
*/
@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("操作失败");
}
public void update(@RequestBody GardsNuclearTestingPlant gardsNuclearTestingPlant) {
this.updateById(gardsNuclearTestingPlant);
}
/**
* 查询核设施放射性排放记录信息
*/
@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 GardsNuclearTestingPlant queryById(@RequestParam Integer id) {
GardsNuclearTestingPlant nuclearReactors = this.getById(id);
if (Objects.isNull(nuclearReactors)) {
throw new RuntimeException("未找到对应的数据");
}
return nuclearReactors;
}
public Result<IPage<GardsNuclearTestingPlant>> page(
public 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);
}
@ -118,26 +77,19 @@ public class GardsNuclearTestingPlantServiceImpl extends ServiceImpl<GardsNuclea
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());
}
return pageResult ;
}
@Override
public List<GardsNuclearTestingPlant> getByConditions(String name, String type) {
LambdaQueryWrapper<GardsNuclearTestingPlant> query = new LambdaQueryWrapper<>();
if (name != null&&!name.trim().isEmpty()) {
if (name != null && !name.trim().isEmpty()) {
query.like(GardsNuclearTestingPlant::getName, name);
}
if (type != null&&!type.trim().isEmpty()) {
if (type != null && !type.trim().isEmpty()) {
query.like(GardsNuclearTestingPlant::getCountry, type);
}
query.orderByDesc(GardsNuclearTestingPlant::getId);

View File

@ -5,17 +5,15 @@ 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.GardsNuclideDecay;
import org.jeecg.modules.base.entity.configuration.GardsStations;
import org.jeecg.modules.base.entity.configuration.GardsNuclideDecay;
import org.jeecg.modules.base.mapper.GardsNuclideDecayMapper;
import org.jeecg.modules.base.mapper.GardsNuclideDecayMapper;
import org.jeecg.service.GardsNuclideDecayService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
@Service
@DS("ora")
public class GardsNuclideDecayServiceImpl extends ServiceImpl<GardsNuclideDecayMapper, GardsNuclideDecay> implements GardsNuclideDecayService {
@ -24,20 +22,8 @@ public class GardsNuclideDecayServiceImpl extends ServiceImpl<GardsNuclideDecayM
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Result<?> create(GardsNuclideDecay gardsNuclideDecay) {
try {
boolean success = this.save(gardsNuclideDecay);
if (success) {
return Result.OK("添加成功", gardsNuclideDecay);
} else {
return Result.error("添加失败");
}
} catch (Exception e) {
log.error("create: " + e.getMessage());
return Result.error("添加失败");
}
public void create(GardsNuclideDecay gardsNuclideDecay) {
this.save(gardsNuclideDecay);
}
/**
@ -45,19 +31,8 @@ public class GardsNuclideDecayServiceImpl extends ServiceImpl<GardsNuclideDecayM
*/
@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("操作失败");
}
public void deleteById(Integer id) {
this.removeById(id);
}
/**
@ -65,67 +40,46 @@ public class GardsNuclideDecayServiceImpl extends ServiceImpl<GardsNuclideDecayM
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Result<?> update(GardsNuclideDecay gardsNuclideDecay) {
try {
boolean success = this.updateById(gardsNuclideDecay);
if (success) {
return Result.OK("数据更新成功", gardsNuclideDecay);
} else {
return Result.error("数据更新失败");
}
} catch (Exception e) {
log.error("update: " + e.getMessage());
return Result.error("操作失败");
}
public void update(GardsNuclideDecay gardsNuclideDecay) {
this.updateById(gardsNuclideDecay);
}
/**
* 查询信息
*/
@Override
public Result<GardsNuclideDecay> queryById(Integer Id) {
try {
GardsNuclideDecay 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("查询失败");
public GardsNuclideDecay queryById(Integer id) {
GardsNuclideDecay nuclearReactors = this.getById(id);
if (Objects.isNull(nuclearReactors)) {
throw new RuntimeException("未找到对应的数据");
}
return nuclearReactors;
}
@Override
public Result<IPage<GardsNuclideDecay>> page(Integer pageNum, Integer pageSize, String nuclide) {
try {
Page<GardsNuclideDecay> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsNuclideDecay> wrapper = new LambdaQueryWrapper<>();
if (nuclide != null && !nuclide.trim().isEmpty()) {
wrapper.like(GardsNuclideDecay::getNuclide, nuclide);
}
wrapper.orderByDesc(GardsNuclideDecay::getId);
IPage<GardsNuclideDecay> pageResult = this.page(page, wrapper);
return Result.OK(pageResult);
} catch (Exception e) {
log.error("page: " + e.getMessage());
return Result.error("查询失败");
public IPage<GardsNuclideDecay> page(Integer pageNum, Integer pageSize, String nuclide, String energy) {
Page<GardsNuclideDecay> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsNuclideDecay> wrapper = new LambdaQueryWrapper<>();
if (nuclide != null && !nuclide.trim().isEmpty()) {
wrapper.like(GardsNuclideDecay::getNuclide, nuclide);
}
if (energy != null && !energy.trim().isEmpty()) {
wrapper.like(GardsNuclideDecay::getEnergy, energy);
}
wrapper.orderByDesc(GardsNuclideDecay::getId);
IPage<GardsNuclideDecay> pageResult = this.page(page, wrapper);
return pageResult;
}
@Override
public List<GardsNuclideDecay> getByConditions(String nuclide) {
public List<GardsNuclideDecay> getByConditions(String nuclide, String energy) {
LambdaQueryWrapper<GardsNuclideDecay> query = new LambdaQueryWrapper<>();
if (nuclide != null && !nuclide.trim().isEmpty()) {
query.like(GardsNuclideDecay::getNuclide, nuclide);
}
if (energy != null && !energy.trim().isEmpty()) {
query.like(GardsNuclideDecay::getEnergy, energy);
}
query.orderByDesc(GardsNuclideDecay::getId);
return this.list(query);
}

View File

@ -16,6 +16,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
@Service
@DS("ora")
public class GardsResearchReactorsServiceImpl extends ServiceImpl<GardsResearchReactorsMapper, GardsResearchReactors> implements GardsResearchReactorsService {
@ -25,18 +27,8 @@ public class GardsResearchReactorsServiceImpl extends ServiceImpl<GardsResearchR
*/
@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("添加失败");
}
public void create(GardsResearchReactors gardsResearchReactors) {
this.save(gardsResearchReactors);
}
/**
@ -44,19 +36,8 @@ public class GardsResearchReactorsServiceImpl extends ServiceImpl<GardsResearchR
*/
@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("操作失败");
}
public void deleteById(Integer id) {
this.removeById(id);
}
/**
@ -64,37 +45,20 @@ public class GardsResearchReactorsServiceImpl extends ServiceImpl<GardsResearchR
*/
@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("操作失败");
}
public void update(GardsResearchReactors gardsResearchReactors) {
this.updateById(gardsResearchReactors);
}
/**
* 查询信息
*/
@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("查询失败");
public GardsResearchReactors queryById(Integer id) {
GardsResearchReactors nuclearReactors = this.getById(id);
if (Objects.isNull(nuclearReactors)) {
throw new RuntimeException("未找到对应的数据");
}
return nuclearReactors;
}
/**
@ -107,50 +71,41 @@ public class GardsResearchReactorsServiceImpl extends ServiceImpl<GardsResearchR
* @return
*/
@Override
public Result<IPage<GardsResearchReactors>> page(
Integer pageNum,
Integer pageSize,
String facilityName,
String country) {
public IPage<GardsResearchReactors> page(
Integer pageNum,
Integer pageSize,
String facilityName,
String country) {
Page<GardsResearchReactors> page = new Page<>(pageNum, pageSize);
try {
Page<GardsResearchReactors> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<GardsResearchReactors> wrapper = new LambdaQueryWrapper<>();
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("查询失败" );
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 pageResult;
}
@Override
public List<GardsResearchReactors> getByConditions(String facilityName, String country,String reactorType,String status) {
public List<GardsResearchReactors> getByConditions(String facilityName, String country, String reactorType, String status) {
LambdaQueryWrapper<GardsResearchReactors> query = new LambdaQueryWrapper<>();
if (facilityName != null&&!facilityName.trim().isEmpty()) {
if (facilityName != null && !facilityName.trim().isEmpty()) {
query.like(GardsResearchReactors::getFacilityName, facilityName);
}
if (country != null&&!country.trim().isEmpty()) {
if (country != null && !country.trim().isEmpty()) {
query.like(GardsResearchReactors::getCountry, country);
}
if (reactorType != null&&!reactorType.trim().isEmpty()) {
if (reactorType != null && !reactorType.trim().isEmpty()) {
query.like(GardsResearchReactors::getReactorType, reactorType);
}
if (status != null&&!status.trim().isEmpty()) {
if (status != null && !status.trim().isEmpty()) {
query.like(GardsResearchReactors::getStatus, status);
}
query.orderByDesc(GardsResearchReactors::getId);

View File

@ -5,9 +5,6 @@ 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;
@ -16,32 +13,27 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
@Service
@DS("ora")
public class GardsStationsServiceImpl extends ServiceImpl<GardsStationsMapper, GardsStations> implements GardsStationsService {
public class GardsStationsServiceImpl extends ServiceImpl<GardsStationsMapper, GardsStations>
implements GardsStationsService {
final Integer stationLength = 5;
/**
* 新增信息
*/
@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("添加失败");
public void create(GardsStations gardsStations) {
if (gardsStations.getStationCode().length() > stationLength) {
throw new RuntimeException("添加失败:StationCode 最大长度为5实际长度是"
+ gardsStations.getStationCode().length());
}
this.save(gardsStations);
}
/**
@ -49,19 +41,8 @@ public class GardsStationsServiceImpl extends ServiceImpl<GardsStationsMapper, G
*/
@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("操作失败");
}
public void deleteById(Integer stationId) {
this.removeById(stationId);
}
/**
@ -69,37 +50,20 @@ public class GardsStationsServiceImpl extends ServiceImpl<GardsStationsMapper, G
*/
@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("操作失败");
}
public void update(GardsStations gardsStations) {
this.updateById(gardsStations);
}
/**
* 查询信息
*/
@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("查询失败" );
public GardsStations queryById(Integer stationId) {
GardsStations nuclearReactors = this.getById(stationId);
if (Objects.isNull(nuclearReactors)) {
throw new RuntimeException("未找到对应的数据");
}
return nuclearReactors;
}
/**
@ -112,48 +76,40 @@ public class GardsStationsServiceImpl extends ServiceImpl<GardsStationsMapper, G
* @return
*/
@Override
public Result<IPage<GardsStations>> page(
public IPage<GardsStations> page(
Integer pageNum,
Integer pageSize,
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("查询失败");
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 pageResult;
}
@Override
public List<GardsStations> getByConditions(String stationCode, String type, String status,String countryCode) {
public List<GardsStations> getByConditions(String stationCode, String type, String status,
String countryCode) {
LambdaQueryWrapper<GardsStations> query = new LambdaQueryWrapper<>();
if (stationCode != null&&!stationCode.trim().isEmpty()) {
if (stationCode != null && !stationCode.trim().isEmpty()) {
query.like(GardsStations::getStationCode, stationCode);
}
if (type != null&&!type.trim().isEmpty()) {
if (type != null && !type.trim().isEmpty()) {
query.like(GardsStations::getType, type);
}
if (status != null&&!status.trim().isEmpty()) {
if (status != null && !status.trim().isEmpty()) {
query.like(GardsStations::getStatus, status);
}
if (countryCode != null&&!countryCode.trim().isEmpty()) {
if (countryCode != null && !countryCode.trim().isEmpty()) {
query.like(GardsStations::getCountryCode, countryCode);
}
query.orderByDesc(GardsStations::getStationId);

View File

@ -23,7 +23,9 @@ public class BizUpsertUtil {
//
public static <T> boolean upsertByColumnNames(IService<T> service, List<T> list,
String... uniqueColumnNames) {
if (list.isEmpty()) return true;
if (list.isEmpty()) {
return true;
}
String firstCol = uniqueColumnNames[0];
@ -92,9 +94,12 @@ public class BizUpsertUtil {
.map(col -> Objects.toString(getFieldValue(entity, col), "NULL"))
.collect(Collectors.joining("::"));
}
public static <T> boolean upsert(IService<T> service, List<T> list,
List<SFunction<T, ?>> uniqueColumns) {
if (list == null || list.isEmpty()) return true;
if (list == null || list.isEmpty()) {
return true;
}
// 1. 提取所有业务唯一键用于匹配
Map<String, T> keyToEntity = new HashMap<>();
@ -113,7 +118,7 @@ public class BizUpsertUtil {
.toList();
List<T> existList = service.list(
(new LambdaQueryWrapper<T>()).in( firstCol, firstColumnValues)
(new LambdaQueryWrapper<T>()).in(firstCol, firstColumnValues)
);
// 3. 构建已存在记录的 key 映射
@ -138,7 +143,7 @@ public class BizUpsertUtil {
}
}
boolean ok1 = insertList.isEmpty() || service.saveBatch(insertList, 1000);
boolean ok1 = insertList.isEmpty() || service.saveBatch(insertList, 1);
boolean ok2 = updateList.isEmpty() || service.updateBatchById(updateList, 1000);
System.out.println("插入: " + insertList.size() + ", 更新: " + updateList.size());