收藏
This commit is contained in:
+33
-16
@@ -93,14 +93,20 @@ public class SysDictItemController {
|
||||
public Result<SysDictItem> edit(@RequestBody SysDictItem sysDictItem) {
|
||||
Result<SysDictItem> result = new Result<SysDictItem>();
|
||||
SysDictItem sysdict = sysDictItemService.getById(sysDictItem.getId());
|
||||
if(sysdict==null) {
|
||||
if (sysdict == null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
sysDictItem.setUpdateTime(new Date());
|
||||
boolean ok = sysDictItemService.updateById(sysDictItem);
|
||||
//TODO 返回false说明什么?
|
||||
if(ok) {
|
||||
result.success("编辑成功!");
|
||||
} else {
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(String.valueOf(sysDictItem.getIsReadOnly()))) {
|
||||
if (sysDictItem.getIsReadOnly() == 1) {
|
||||
result.error500("固定字段,不可删除");
|
||||
} else {
|
||||
sysDictItem.setUpdateTime(new Date());
|
||||
boolean ok = sysDictItemService.updateById(sysDictItem);
|
||||
//TODO 返回false说明什么?
|
||||
if (ok) {
|
||||
result.success("编辑成功!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -118,14 +124,19 @@ public class SysDictItemController {
|
||||
public Result<SysDictItem> delete(@RequestParam(name="id",required=true) String id) {
|
||||
Result<SysDictItem> result = new Result<SysDictItem>();
|
||||
SysDictItem joinSystem = sysDictItemService.getById(id);
|
||||
if(joinSystem==null) {
|
||||
if (joinSystem == null) {
|
||||
result.error500("未找到对应实体");
|
||||
}/*else if(joinSystem.getIsReadOnly()==1||joinSystem.getIsTagDict()==1){
|
||||
result.error("固定字段,不可修改");
|
||||
}*/else {
|
||||
boolean ok = sysDictItemService.removeById(id);
|
||||
if(ok) {
|
||||
result.success("删除成功!");
|
||||
}else {
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(String.valueOf(joinSystem.getIsReadOnly()))) {
|
||||
if (joinSystem.getIsReadOnly() == 1) {
|
||||
result.error500("固定字段,不可删除");
|
||||
}
|
||||
else {
|
||||
boolean ok = sysDictItemService.removeById(id);
|
||||
if (ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -147,8 +158,14 @@ public class SysDictItemController {
|
||||
result.error500("参数不识别!");
|
||||
}
|
||||
else {
|
||||
this.sysDictItemService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("批量删除成功!");
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(String.valueOf(sysDictItem.getIsReadOnly()))) {
|
||||
if (sysDictItem.getIsReadOnly() == 1) {
|
||||
result.error500("固定字段,不可删除");
|
||||
} else {
|
||||
this.sysDictItemService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("批量删除成功!");
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user