订阅+收藏修改

This commit is contained in:
xiejunyu
2022-02-24 20:33:32 +08:00
parent 5eae770459
commit bc8e8c3f2a
23 changed files with 620 additions and 150 deletions
@@ -339,12 +339,24 @@ public class SysDictController {
public Result<SysDict> add(@RequestBody SysDict sysDict) {
Result<SysDict> result = new Result<SysDict>();
try {
sysDict.setCreateTime(new Date());
sysDict.setDelFlag(CommonConstant.DEL_FLAG_0);
sysDictService.save(sysDict);
result.success("保存成功!");
//添加成功后需要刷新缓存
sysDictService.refreshCache();
/*if (StringUtils.isNotBlank(sysDict.getDictCode())) {
if(sysDict.getIsTagDict()==1){
sysDict.setDictEnName(sysDict.getDictCode().replace("_", " "));
sysDict.setDictCode(sysDict.getDictEnName().replace(" ", "_"));
}
}*/
if(StringUtils.isEmpty(sysDict.getDictCode())){
//result.error500("字典Code不能为空");
sysDict.setDictCode(sysDict.getDictName());
}else {
sysDict.setCreateTime(new Date());
sysDict.setDelFlag(CommonConstant.DEL_FLAG_0);
sysDictService.save(sysDict);
result.success("保存成功!");
//添加成功后需要刷新缓存
sysDictService.refreshCache();
}
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败");
@@ -365,19 +377,24 @@ public class SysDictController {
SysDict sysdict = sysDictService.getById(sysDict.getId());
if (sysdict == null) {
result.error500("未找到对应实体");
}
else {
if (sysDict.getIsReadOnly() == 1) {
result.error500("固定字段,不能修改");
}
else{
sysDict.setUpdateTime(new Date());
boolean ok = sysDictService.updateById(sysDict);
if (ok) {
result.success("编辑成功!");
//编辑成功后需要刷新缓存
sysDictService.refreshCache();
}
}else {
if (org.apache.commons.lang3.StringUtils.isNotBlank(String.valueOf(sysDict.getIsReadOnly()))) {
/*if (sysDict.getIsReadOnly() == 1) {
result.error500("固定字段,不可删除");
}else{*/
/*if(sysDict.getIsTagDict() == 1) {
sysDict.setDictEnName(sysDict.getDictCode().replace("_", " "));
}
else {*/
sysDict.setUpdateTime(new Date());
boolean ok = sysDictService.updateById(sysDict);
if (ok) {
result.success("编辑成功!");
//编辑成功后需要刷新缓存
sysDictService.refreshCache();
}
//}
// }
}
}
return result;