|
@@ -72,6 +72,10 @@ public class TbAssetInformationController extends BaseController
|
|
|
return success(tbAssetInformationService.selectTbAssetInformationById(id));
|
|
|
}
|
|
|
|
|
|
+ private boolean checkNumber(String number) {
|
|
|
+ return number.matches("^[A-Fa-f0-9]+$");
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 新增资产信息
|
|
|
*/
|
|
@@ -80,6 +84,12 @@ public class TbAssetInformationController extends BaseController
|
|
|
@PostMapping
|
|
|
public AjaxResult add(@RequestBody TbAssetInformation tbAssetInformation)
|
|
|
{
|
|
|
+ String number = tbAssetInformation.getNumber();
|
|
|
+ boolean flag = checkNumber(number);
|
|
|
+ if (!flag) {
|
|
|
+ return error("资产编号格式仅限[A-Fa-f0-9]");
|
|
|
+ }
|
|
|
+ tbAssetInformation.setCode(number);
|
|
|
return toAjax(tbAssetInformationService.insertTbAssetInformation(tbAssetInformation));
|
|
|
}
|
|
|
|
|
@@ -91,6 +101,12 @@ public class TbAssetInformationController extends BaseController
|
|
|
@PutMapping
|
|
|
public AjaxResult edit(@RequestBody TbAssetInformation tbAssetInformation)
|
|
|
{
|
|
|
+ String number = tbAssetInformation.getNumber();
|
|
|
+ boolean flag = checkNumber(number);
|
|
|
+ if (!flag) {
|
|
|
+ return error("资产编号格式仅限[A-Fa-f0-9]");
|
|
|
+ }
|
|
|
+ tbAssetInformation.setCode(number);
|
|
|
return toAjax(tbAssetInformationService.updateTbAssetInformation(tbAssetInformation));
|
|
|
}
|
|
|
|