update 优化 调用toAjax时的冗余三元操作符
parent
3e2f154907
commit
0995b5e821
|
|
@ -46,7 +46,7 @@ public class TestBatchController extends BaseController {
|
||||||
testDemo.setValue("测试新增");
|
testDemo.setValue("测试新增");
|
||||||
list.add(testDemo);
|
list.add(testDemo);
|
||||||
}
|
}
|
||||||
return toAjax(testDemoMapper.insertBatch(list) ? 1 : 0);
|
return toAjax(testDemoMapper.insertBatch(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -73,7 +73,7 @@ public class TestBatchController extends BaseController {
|
||||||
testDemo.setId(null);
|
testDemo.setId(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return toAjax(testDemoMapper.insertOrUpdateBatch(list) ? 1 : 0);
|
return toAjax(testDemoMapper.insertOrUpdateBatch(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ public class TestDemoController extends BaseController {
|
||||||
// 使用校验工具对标 @Validated(AddGroup.class) 注解
|
// 使用校验工具对标 @Validated(AddGroup.class) 注解
|
||||||
// 用于在非 Controller 的地方校验对象
|
// 用于在非 Controller 的地方校验对象
|
||||||
ValidatorUtils.validate(bo, AddGroup.class);
|
ValidatorUtils.validate(bo, AddGroup.class);
|
||||||
return toAjax(iTestDemoService.insertByBo(bo) ? 1 : 0);
|
return toAjax(iTestDemoService.insertByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -129,7 +129,7 @@ public class TestDemoController extends BaseController {
|
||||||
@RepeatSubmit
|
@RepeatSubmit
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TestDemoBo bo) {
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TestDemoBo bo) {
|
||||||
return toAjax(iTestDemoService.updateByBo(bo) ? 1 : 0);
|
return toAjax(iTestDemoService.updateByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -141,6 +141,6 @@ public class TestDemoController extends BaseController {
|
||||||
@Log(title = "测试单表", businessType = BusinessType.DELETE)
|
@Log(title = "测试单表", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) {
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) {
|
||||||
return toAjax(iTestDemoService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
return toAjax(iTestDemoService.deleteWithValidByIds(Arrays.asList(ids), true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ public class TestTreeController extends BaseController {
|
||||||
@RepeatSubmit
|
@RepeatSubmit
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody TestTreeBo bo) {
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody TestTreeBo bo) {
|
||||||
return toAjax(iTestTreeService.insertByBo(bo) ? 1 : 0);
|
return toAjax(iTestTreeService.insertByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -87,7 +87,7 @@ public class TestTreeController extends BaseController {
|
||||||
@RepeatSubmit
|
@RepeatSubmit
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TestTreeBo bo) {
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TestTreeBo bo) {
|
||||||
return toAjax(iTestTreeService.updateByBo(bo) ? 1 : 0);
|
return toAjax(iTestTreeService.updateByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -99,6 +99,6 @@ public class TestTreeController extends BaseController {
|
||||||
@Log(title = "测试树表", businessType = BusinessType.DELETE)
|
@Log(title = "测试树表", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) {
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) {
|
||||||
return toAjax(iTestTreeService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
return toAjax(iTestTreeService.deleteWithValidByIds(Arrays.asList(ids), true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ public class ${ClassName}Controller extends BaseController {
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
|
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ${ClassName}Bo bo) {
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody ${ClassName}Bo bo) {
|
||||||
return toAjax(i${ClassName}Service.insertByBo(bo) ? 1 : 0);
|
return toAjax(i${ClassName}Service.insertByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -98,7 +98,7 @@ public class ${ClassName}Controller extends BaseController {
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
|
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ${ClassName}Bo bo) {
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ${ClassName}Bo bo) {
|
||||||
return toAjax(i${ClassName}Service.updateByBo(bo) ? 1 : 0);
|
return toAjax(i${ClassName}Service.updateByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -110,6 +110,6 @@ public class ${ClassName}Controller extends BaseController {
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
|
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{${pkColumn.javaField}s}")
|
@DeleteMapping("/{${pkColumn.javaField}s}")
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) {
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) {
|
||||||
return toAjax(i${ClassName}Service.deleteWithValidByIds(Arrays.asList(${pkColumn.javaField}s), true) ? 1 : 0);
|
return toAjax(i${ClassName}Service.deleteWithValidByIds(Arrays.asList(${pkColumn.javaField}s), true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ public class SysOssConfigController extends BaseController {
|
||||||
@Log(title = "对象存储配置", businessType = BusinessType.INSERT)
|
@Log(title = "对象存储配置", businessType = BusinessType.INSERT)
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysOssConfigBo bo) {
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysOssConfigBo bo) {
|
||||||
return toAjax(iSysOssConfigService.insertByBo(bo) ? 1 : 0);
|
return toAjax(iSysOssConfigService.insertByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -73,7 +73,7 @@ public class SysOssConfigController extends BaseController {
|
||||||
@Log(title = "对象存储配置", businessType = BusinessType.UPDATE)
|
@Log(title = "对象存储配置", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysOssConfigBo bo) {
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysOssConfigBo bo) {
|
||||||
return toAjax(iSysOssConfigService.updateByBo(bo) ? 1 : 0);
|
return toAjax(iSysOssConfigService.updateByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -85,7 +85,7 @@ public class SysOssConfigController extends BaseController {
|
||||||
@Log(title = "对象存储配置", businessType = BusinessType.DELETE)
|
@Log(title = "对象存储配置", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ossConfigIds}")
|
@DeleteMapping("/{ossConfigIds}")
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ossConfigIds) {
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ossConfigIds) {
|
||||||
return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true) ? 1 : 0);
|
return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ public class SysOssController extends BaseController {
|
||||||
@Log(title = "OSS对象存储", businessType = BusinessType.DELETE)
|
@Log(title = "OSS对象存储", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ossIds}")
|
@DeleteMapping("/{ossIds}")
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ossIds) {
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ossIds) {
|
||||||
return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0);
|
return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue