|
@@ -21,7 +21,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
|
|
|
- /**
|
|
|
|
|
|
+/**
|
|
* @Description: 钢坯定尺配置表
|
|
* @Description: 钢坯定尺配置表
|
|
* @Author: jeecg-boot
|
|
* @Author: jeecg-boot
|
|
* @Date: 2024-11-30
|
|
* @Date: 2024-11-30
|
|
@@ -35,7 +35,7 @@ public class BilletRulerConfigController extends JeecgController<BilletRulerConf
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private IBilletRulerConfigService billetRulerConfigService;
|
|
private IBilletRulerConfigService billetRulerConfigService;
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 分页列表查询
|
|
* 分页列表查询
|
|
*
|
|
*
|
|
@@ -57,7 +57,7 @@ public class BilletRulerConfigController extends JeecgController<BilletRulerConf
|
|
IPage<BilletRulerConfig> pageList = billetRulerConfigService.page(page, queryWrapper);
|
|
IPage<BilletRulerConfig> pageList = billetRulerConfigService.page(page, queryWrapper);
|
|
return Result.OK(pageList);
|
|
return Result.OK(pageList);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 添加
|
|
* 添加
|
|
*
|
|
*
|
|
@@ -65,14 +65,18 @@ public class BilletRulerConfigController extends JeecgController<BilletRulerConf
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@AutoLog(value = "钢坯定尺配置表-添加")
|
|
@AutoLog(value = "钢坯定尺配置表-添加")
|
|
- @ApiOperation(value="钢坯定尺配置表-添加", notes="钢坯定尺配置表-添加")
|
|
|
|
|
|
+ @ApiOperation(value = "钢坯定尺配置表-添加", notes = "钢坯定尺配置表-添加")
|
|
@RequiresPermissions("billetRulerConfig:billet_ruler_config:add")
|
|
@RequiresPermissions("billetRulerConfig:billet_ruler_config:add")
|
|
@PostMapping(value = "/add")
|
|
@PostMapping(value = "/add")
|
|
public Result<String> add(@RequestBody BilletRulerConfig billetRulerConfig) {
|
|
public Result<String> add(@RequestBody BilletRulerConfig billetRulerConfig) {
|
|
|
|
+ if (isLengthExists(billetRulerConfig.getLength())) {
|
|
|
|
+ return Result.error("当前定尺已经存在,请重新添加!");
|
|
|
|
+ }
|
|
|
|
+
|
|
billetRulerConfigService.save(billetRulerConfig);
|
|
billetRulerConfigService.save(billetRulerConfig);
|
|
return Result.OK("添加成功!");
|
|
return Result.OK("添加成功!");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 编辑
|
|
* 编辑
|
|
*
|
|
*
|
|
@@ -80,14 +84,22 @@ public class BilletRulerConfigController extends JeecgController<BilletRulerConf
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@AutoLog(value = "钢坯定尺配置表-编辑")
|
|
@AutoLog(value = "钢坯定尺配置表-编辑")
|
|
- @ApiOperation(value="钢坯定尺配置表-编辑", notes="钢坯定尺配置表-编辑")
|
|
|
|
|
|
+ @ApiOperation(value = "钢坯定尺配置表-编辑", notes = "钢坯定尺配置表-编辑")
|
|
@RequiresPermissions("billetRulerConfig:billet_ruler_config:edit")
|
|
@RequiresPermissions("billetRulerConfig:billet_ruler_config:edit")
|
|
- @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
|
|
|
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
|
public Result<String> edit(@RequestBody BilletRulerConfig billetRulerConfig) {
|
|
public Result<String> edit(@RequestBody BilletRulerConfig billetRulerConfig) {
|
|
|
|
+
|
|
|
|
+ // 校验是否存在重复的 length 值(排除当前记录自身)
|
|
|
|
+ if (isLengthExists(billetRulerConfig.getLength(), billetRulerConfig.getId())) {
|
|
|
|
+ return Result.error("当前定尺已经存在,请重新修改!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 更新记录
|
|
billetRulerConfigService.updateById(billetRulerConfig);
|
|
billetRulerConfigService.updateById(billetRulerConfig);
|
|
- return Result.OK("编辑成功!");
|
|
|
|
|
|
+
|
|
|
|
+ return Result.OK("编辑成功!");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 通过id删除
|
|
* 通过id删除
|
|
*
|
|
*
|
|
@@ -102,7 +114,7 @@ public class BilletRulerConfigController extends JeecgController<BilletRulerConf
|
|
billetRulerConfigService.removeById(id);
|
|
billetRulerConfigService.removeById(id);
|
|
return Result.OK("删除成功!");
|
|
return Result.OK("删除成功!");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 批量删除
|
|
* 批量删除
|
|
*
|
|
*
|
|
@@ -117,7 +129,7 @@ public class BilletRulerConfigController extends JeecgController<BilletRulerConf
|
|
this.billetRulerConfigService.removeByIds(Arrays.asList(ids.split(",")));
|
|
this.billetRulerConfigService.removeByIds(Arrays.asList(ids.split(",")));
|
|
return Result.OK("批量删除成功!");
|
|
return Result.OK("批量删除成功!");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 通过id查询
|
|
* 通过id查询
|
|
*
|
|
*
|
|
@@ -160,4 +172,25 @@ public class BilletRulerConfigController extends JeecgController<BilletRulerConf
|
|
return super.importExcel(request, response, BilletRulerConfig.class);
|
|
return super.importExcel(request, response, BilletRulerConfig.class);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ private boolean isLengthExists(Integer length) {
|
|
|
|
+ return billetRulerConfigService.lambdaQuery()
|
|
|
|
+ .eq(BilletRulerConfig::getLength, length)
|
|
|
|
+ .exists();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 校验是否存在重复的 length 值(可排除特定 ID)。
|
|
|
|
+ *
|
|
|
|
+ * @param length 定尺值
|
|
|
|
+ * @param excludeId 排除的记录 ID
|
|
|
|
+ * @return true 如果存在重复的 length 值
|
|
|
|
+ */
|
|
|
|
+ private boolean isLengthExists(Integer length, String excludeId) {
|
|
|
|
+ return billetRulerConfigService.lambdaQuery()
|
|
|
|
+ .eq(BilletRulerConfig::getLength, length)
|
|
|
|
+ .ne(excludeId != null, BilletRulerConfig::getId, excludeId)
|
|
|
|
+ .exists();
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|