From ad2ec97fe0c60eee4bb7c8cdacff7c876f280ea7 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Mon, 08 Jan 2024 11:30:18 +0800
Subject: [PATCH] 公安安全监管
---
src/main/java/org/springblade/modules/house/service/impl/HouseLabelServiceImpl.java | 36 ++++++++++++++++++++++++++++++++----
1 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/springblade/modules/house/service/impl/HouseLabelServiceImpl.java b/src/main/java/org/springblade/modules/house/service/impl/HouseLabelServiceImpl.java
index e3af77f..ea3c954 100644
--- a/src/main/java/org/springblade/modules/house/service/impl/HouseLabelServiceImpl.java
+++ b/src/main/java/org/springblade/modules/house/service/impl/HouseLabelServiceImpl.java
@@ -16,12 +16,15 @@
*/
package org.springblade.modules.house.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.modules.house.entity.HouseLabelEntity;
-import org.springblade.modules.house.vo.HouseLabelVO;
+import org.springblade.modules.house.vo.UserHouseLabelVO;
import org.springblade.modules.house.mapper.HouseLabelMapper;
import org.springblade.modules.house.service.IHouseLabelService;
-import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.modules.label.entity.LabelEntity;
+import org.springblade.modules.label.service.ILabelService;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -34,10 +37,35 @@
@Service
public class HouseLabelServiceImpl extends ServiceImpl<HouseLabelMapper, HouseLabelEntity> implements IHouseLabelService {
+ @Autowired
+ private ILabelService labelService;
+
@Override
- public IPage<HouseLabelVO> selectHouseLabelPage(IPage<HouseLabelVO> page, HouseLabelVO houseLabel) {
+ public IPage<UserHouseLabelVO> selectHouseLabelPage(IPage<UserHouseLabelVO> page, UserHouseLabelVO houseLabel) {
return page.setRecords(baseMapper.selectHouseLabelPage(page, houseLabel));
}
-
+ /**
+ * 房屋-标签 自定义新增或修改
+ * @param houseLabel
+ * @return
+ */
+ @Override
+ public boolean saveOrUpdateHouseLabel(HouseLabelEntity houseLabel) {
+ // 查询标签名称
+ LabelEntity labelEntity = labelService.getById(houseLabel.getLabelId());
+ houseLabel.setLabelName(labelEntity.getLabelName());
+ // 判断同一个房屋同一个标签是否已存在,已存在则更新,不存在则新增
+ QueryWrapper<HouseLabelEntity> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("house_code",houseLabel.getHouseCode())
+ .eq("label_id",houseLabel.getLabelId());
+ HouseLabelEntity one = getOne(queryWrapper);
+ if (null != one){
+ houseLabel.setId(one.getId());
+ // 更新
+ return updateById(houseLabel);
+ }
+ // 插入
+ return save(houseLabel);
+ }
}
--
Gitblit v1.9.3