|
@@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.transaction.Transactional;
|
|
|
+import javax.validation.constraints.NotBlank;
|
|
|
import java.io.IOException;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
@@ -46,12 +47,18 @@ public class SceneInitServiceImpl extends IBaseServiceImpl<SceneInitEntity, Stri
|
|
|
SceneInitEntity entity = null;
|
|
|
String id = param.getId();
|
|
|
if (id == null) {
|
|
|
-
|
|
|
- List<SceneInitEntity> initEntityList = this.findByHouseId(param.getHouseId());
|
|
|
+ String houseId = param.getHouseId();
|
|
|
+ String sceneCode = param.getSceneCode();
|
|
|
+ List<SceneInitEntity> initEntityList = this.findByHouseId(houseId);
|
|
|
if (initEntityList.size() > 3) {
|
|
|
return Result.failure("初始场景不能大于3个" );
|
|
|
}
|
|
|
|
|
|
+ List<SceneInitEntity> initEntities = entityMapper.findByHouseIdAndSceneCode(houseId, sceneCode);
|
|
|
+ if (initEntities.size() > 0) {
|
|
|
+ return Result.failure("初始场景不能重复添加" );
|
|
|
+ }
|
|
|
+
|
|
|
entity = new SceneInitEntity();
|
|
|
BeanUtils.copyProperties(param, entity);
|
|
|
entity.setId(RandomUtils.getUuid("init"));
|