whywhyo
2023-05-13 78694f580367d8825025a0d32beccbd9662764b7
zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java
@@ -11,6 +11,7 @@
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZfEvent;
import com.ruoyi.domain.ZfProperty;
import com.ruoyi.mapper.ZfPropertyMapper;
import com.ruoyi.service.IZfPropertyService;
@@ -278,6 +279,13 @@
            zfProperty.setFamilyId(myFamilyId);
        }
        //判断是否有重复数据
        LambdaQueryWrapper<ZfProperty> lqw = uniqueCondition(zfProperty);
        List<ZfProperty> list = list(lqw);
        if(list.size()>0){
            throw new RuntimeException("请勿新增重复数据");
        }
        if (save(zfProperty)) {
            return AjaxResult.success();
        } else {
@@ -285,6 +293,18 @@
        }
    }
    private LambdaQueryWrapper<ZfProperty> uniqueCondition(ZfProperty zfProperty) {
        LambdaQueryWrapper<ZfProperty> lqw = new LambdaQueryWrapper<>();
        lqw.eq(!StringUtils.isEmpty(zfProperty.getType()), ZfProperty::getType, zfProperty.getType())
                .eq(!StringUtils.isEmpty(zfProperty.getTitle()), ZfProperty::getTitle, zfProperty.getTitle())
                .eq(!StringUtils.isEmpty(zfProperty.getLocation()), ZfProperty::getLocation, zfProperty.getLocation())
                .eq(!StringUtils.isEmpty(zfProperty.getHolder()), ZfProperty::getHolder, zfProperty.getHolder())
                .eq(!StringUtils.isEmpty(zfProperty.getAddress()), ZfProperty::getAddress, zfProperty.getAddress())
                .eq(!StringUtils.isEmpty(zfProperty.getRemark()), ZfProperty::getRemark, zfProperty.getRemark())
                .eq(zfProperty.getHappenTime()!=null,ZfProperty::getHappenTime,zfProperty.getHappenTime());
        return lqw;
    }
    @Override
    @Transactional