|
|
@@ -3,6 +3,7 @@ package com.nb.web.service.bus.service;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.nb.auth.utils.SecurityUtil;
|
|
|
import com.nb.web.api.entity.common.BusDeviceRunningEntity;
|
|
|
import com.nb.web.api.entity.BusHospitalConfigEntity;
|
|
|
import com.nb.web.api.feign.IHospitalConfigClient;
|
|
|
@@ -64,6 +65,28 @@ public class LocalBusHospitalConfigService extends BaseService<BusHospitalConfig
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean save(BusHospitalConfigEntity entity) {
|
|
|
+ this.validateBeforeSave(entity);
|
|
|
+ String tenantId = SecurityUtil.getTenantId();
|
|
|
+ BusHospitalConfigEntity hospitalConfig = this.getOne(new QueryWrapper<BusHospitalConfigEntity>()
|
|
|
+ .lambda()
|
|
|
+ .eq(BusHospitalConfigEntity::getType, entity.getType().getValue())
|
|
|
+ .eq(BusHospitalConfigEntity::getTenantId, tenantId)
|
|
|
+ .last("limit 1"));
|
|
|
+ if(hospitalConfig!=null){
|
|
|
+ entity.setId(hospitalConfig.getId());
|
|
|
+ return this.updateById(entity);
|
|
|
+ }else {
|
|
|
+ if (super.save(entity)) {
|
|
|
+ postSave(entity);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public void postSave(BusHospitalConfigEntity entity) {
|
|
|
BusHospitalConfigEntity configEntity = this.getById(entity.getId());
|