From 78694f580367d8825025a0d32beccbd9662764b7 Mon Sep 17 00:00:00 2001 From: whywhyo <1511349576@qq.com> Date: 星期六, 13 五月 2023 21:33:54 +0800 Subject: [PATCH] 导入模板 --- zhang-content/src/main/java/com/ruoyi/service/impl/ZfMasterServiceImpl.java | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfMasterServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfMasterServiceImpl.java index 1bbc8a3..c458693 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfMasterServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfMasterServiceImpl.java @@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.domain.ZfMaster; +import com.ruoyi.domain.ZfPet; import com.ruoyi.mapper.ZfMasterMapper; import com.ruoyi.service.ZfMasterService; import lombok.extern.slf4j.Slf4j; @@ -41,6 +42,38 @@ return list; } + @Override + public AjaxResult mySave(ZfMaster zfMaster) { + //鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹� + LambdaQueryWrapper<ZfMaster> lqw = uniqueCondition(zfMaster); + List<ZfMaster> list = list(lqw); + if(list.size()>0){ + throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁"); + } + + if(save(zfMaster)){ + return AjaxResult.success(); + }else { + return AjaxResult.error(); + } + + } + + private LambdaQueryWrapper<ZfMaster> uniqueCondition(ZfMaster zfMaster) { + LambdaQueryWrapper<ZfMaster> lqw = new LambdaQueryWrapper<>(); + lqw.eq(zfMaster.getPetId()!=null,ZfMaster::getPetId,zfMaster.getPetId()); + lqw.eq(StringUtils.isNotEmpty(zfMaster.getName()),ZfMaster::getName,zfMaster.getName()); + lqw.eq(StringUtils.isNotEmpty(zfMaster.getCertificateType()),ZfMaster::getCertificateType,zfMaster.getCertificateType()); + lqw.eq(StringUtils.isNotEmpty(zfMaster.getFixedNo()),ZfMaster::getFixedNo,zfMaster.getFixedNo()); + lqw.eq(StringUtils.isNotEmpty(zfMaster.getPhoneNo()),ZfMaster::getPhoneNo,zfMaster.getPhoneNo()); + lqw.eq(zfMaster.getMany()!=null,ZfMaster::getMany,zfMaster.getMany()); + lqw.eq(StringUtils.isNotEmpty(zfMaster.getAddress()),ZfMaster::getAddress,zfMaster.getAddress()); + lqw.eq(StringUtils.isNotEmpty(zfMaster.getProperty()),ZfMaster::getProperty,zfMaster.getProperty()); + lqw.eq(StringUtils.isNotEmpty(zfMaster.getEmail()),ZfMaster::getEmail,zfMaster.getEmail()); + return lqw; + + } + private LambdaQueryWrapper<ZfMaster> buildCondition(ZfMaster zfMaster) { LambdaQueryWrapper<ZfMaster> lqw = new LambdaQueryWrapper<>(); lqw.like(zfMaster.getPetId()!=null,ZfMaster::getPetId,zfMaster.getPetId()); -- Gitblit v1.9.1