套餐设置套餐管理完善
This commit is contained in:
@@ -51,10 +51,11 @@ public class InspectionPackageController extends BaseController {
|
||||
if (result) {
|
||||
log.info("新增检验套餐成功:packageName={}, basicInformationId={}",
|
||||
inspectionPackage.getPackageName(), inspectionPackage.getBasicInformationId());
|
||||
String idStr = inspectionPackage.getBasicInformationId() == null ? null : String.valueOf(inspectionPackage.getBasicInformationId());
|
||||
return AjaxResult.success()
|
||||
.put("packageId", inspectionPackage.getBasicInformationId()) // 保持向后兼容
|
||||
.put("basicInformationId", inspectionPackage.getBasicInformationId())
|
||||
.put("id", inspectionPackage.getBasicInformationId());
|
||||
.put("packageId", idStr) // 保持向后兼容(前端按字符串处理,避免精度丢失)
|
||||
.put("basicInformationId", idStr)
|
||||
.put("id", idStr);
|
||||
} else {
|
||||
return AjaxResult.error("新增失败");
|
||||
}
|
||||
@@ -102,7 +103,7 @@ public class InspectionPackageController extends BaseController {
|
||||
* 查询检验套餐详情
|
||||
*/
|
||||
@GetMapping("/{basicInformationId}")
|
||||
public AjaxResult getInfo(@PathVariable String basicInformationId) {
|
||||
public AjaxResult getInfo(@PathVariable Long basicInformationId) {
|
||||
InspectionPackage inspectionPackage = inspectionPackageService.selectPackageById(basicInformationId);
|
||||
if (inspectionPackage == null) {
|
||||
return AjaxResult.error("套餐不存在");
|
||||
@@ -121,15 +122,57 @@ public class InspectionPackageController extends BaseController {
|
||||
if (pageNum == null) pageNum = 1;
|
||||
if (pageSize == null) pageSize = 10;
|
||||
|
||||
List<InspectionPackage> list = inspectionPackageService.selectPackageList(inspectionPackage, pageNum, pageSize);
|
||||
return getDataTable(list);
|
||||
// 使用MyBatis Plus分页查询
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page<InspectionPackage> page =
|
||||
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageNum, pageSize);
|
||||
|
||||
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<InspectionPackage> queryWrapper =
|
||||
new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<>();
|
||||
|
||||
// 构建查询条件
|
||||
if (inspectionPackage != null) {
|
||||
if (inspectionPackage.getPackageName() != null && !inspectionPackage.getPackageName().isEmpty()) {
|
||||
queryWrapper.like("package_name", inspectionPackage.getPackageName());
|
||||
}
|
||||
if (inspectionPackage.getPackageLevel() != null && !inspectionPackage.getPackageLevel().isEmpty()) {
|
||||
queryWrapper.eq("package_level", inspectionPackage.getPackageLevel());
|
||||
}
|
||||
if (inspectionPackage.getDepartment() != null && !inspectionPackage.getDepartment().isEmpty()) {
|
||||
queryWrapper.eq("department", inspectionPackage.getDepartment());
|
||||
}
|
||||
if (inspectionPackage.getPackageCategory() != null && !inspectionPackage.getPackageCategory().isEmpty()) {
|
||||
queryWrapper.eq("package_category", inspectionPackage.getPackageCategory());
|
||||
}
|
||||
if (inspectionPackage.getIsDisabled() != null) {
|
||||
queryWrapper.eq("is_disabled", inspectionPackage.getIsDisabled());
|
||||
}
|
||||
}
|
||||
|
||||
// 默认只查询未删除的记录
|
||||
queryWrapper.eq("del_flag", false);
|
||||
|
||||
// 排序
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
|
||||
// 执行分页查询
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page<InspectionPackage> resultPage =
|
||||
inspectionPackageService.page(page, queryWrapper);
|
||||
|
||||
// 构建返回结果
|
||||
TableDataInfo dataTable = new TableDataInfo();
|
||||
dataTable.setCode(com.core.common.constant.HttpStatus.SUCCESS);
|
||||
dataTable.setMsg("查询成功");
|
||||
dataTable.setRows(resultPage.getRecords());
|
||||
dataTable.setTotal(resultPage.getTotal());
|
||||
|
||||
return dataTable;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除检验套餐
|
||||
*/
|
||||
@DeleteMapping("/{basicInformationId}")
|
||||
public AjaxResult remove(@PathVariable String basicInformationId) {
|
||||
public AjaxResult remove(@PathVariable Long basicInformationId) {
|
||||
// 校验套餐是否存在
|
||||
InspectionPackage existing = inspectionPackageService.selectPackageById(basicInformationId);
|
||||
if (existing == null) {
|
||||
@@ -178,7 +221,7 @@ public class InspectionPackageController extends BaseController {
|
||||
* 查询检验套餐明细列表
|
||||
*/
|
||||
@GetMapping("/details/{basicInformationId}")
|
||||
public AjaxResult getDetails(@PathVariable String basicInformationId) {
|
||||
public AjaxResult getDetails(@PathVariable Long basicInformationId) {
|
||||
// 校验套餐是否存在
|
||||
InspectionPackage inspectionPackage = inspectionPackageService.selectPackageById(basicInformationId);
|
||||
if (inspectionPackage == null) {
|
||||
@@ -235,11 +278,11 @@ public class InspectionPackageController extends BaseController {
|
||||
|
||||
// 请求DTO类
|
||||
public static class BatchSaveDetailRequest {
|
||||
private String basicInformationId;
|
||||
private Long basicInformationId;
|
||||
private List<InspectionPackageDetail> details;
|
||||
|
||||
public String getBasicInformationId() { return basicInformationId; }
|
||||
public void setBasicInformationId(String basicInformationId) { this.basicInformationId = basicInformationId; }
|
||||
public Long getBasicInformationId() { return basicInformationId; }
|
||||
public void setBasicInformationId(Long basicInformationId) { this.basicInformationId = basicInformationId; }
|
||||
public List<InspectionPackageDetail> getDetails() { return details; }
|
||||
public void setDetails(List<InspectionPackageDetail> details) { this.details = details; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user