|
@@ -54,21 +54,26 @@ public class EnergyServiceImpl extends ServiceImpl<EnergyMapper, EnergyEntity> i
|
|
|
@Override
|
|
|
public Result saveEntity(BaseDto param) {
|
|
|
Long id = param.getId();
|
|
|
- EnergyEntity entity = null;
|
|
|
- if (id == null){
|
|
|
- entity = new EnergyEntity();
|
|
|
- } else {
|
|
|
- entity = this.getById(id);
|
|
|
- if (entity == null){
|
|
|
- String msg = "对象id不存在 ";
|
|
|
- log.error(msg + id);
|
|
|
- return Result.failure(msg);
|
|
|
- }
|
|
|
- }
|
|
|
+// EnergyEntity entity = null;
|
|
|
+// if (id == null){
|
|
|
+// entity = new EnergyEntity();
|
|
|
+// } else {
|
|
|
+// entity = this.getById(id);
|
|
|
+// if (entity == null){
|
|
|
+// String msg = "对象id不存在 ";
|
|
|
+// log.error(msg + id);
|
|
|
+// return Result.failure(msg);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ EnergyEntity entity = this.getById(id);
|
|
|
+ if (entity == null) {
|
|
|
+ String msg = "对象id不存在 ";
|
|
|
+ log.error(msg + id);
|
|
|
+ return Result.failure(msg);
|
|
|
|
|
|
+ }
|
|
|
BeanUtils.copyProperties(param, entity);
|
|
|
- this.saveOrUpdate(entity);
|
|
|
-
|
|
|
+ this.updateById(entity);
|
|
|
return Result.success();
|
|
|
}
|
|
|
|