From 915803074bba519a3edd25431e5ee878e5fb516a Mon Sep 17 00:00:00 2001 From: feige <feige@qq.com> Date: 星期三, 17 五月 2023 16:02:09 +0800 Subject: [PATCH] 修改了家庭模块的导出模块,可以选择导出了 --- zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 48 insertions(+), 1 deletions(-) diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java index ff09580..41bf507 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java @@ -8,11 +8,15 @@ import com.ruoyi.common.utils.MapUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.domain.ZfDoctor; +import com.ruoyi.domain.ZfEquipment; +import com.ruoyi.domain.ZfPet; import com.ruoyi.mapper.ZfDoctorMapper; import com.ruoyi.service.ZfDoctorService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -31,7 +35,7 @@ @Override public AjaxResult selectDoctorList(ZfDoctor zfDoctor, Integer pageNum, Integer pageSize) { LambdaQueryWrapper<ZfDoctor> lqw = buildCondition(zfDoctor); - lqw.orderByDesc(ZfDoctor::getId); + lqw.orderByDesc(ZfDoctor::getCreateTime); Page<ZfDoctor> ZfDoctorPage = new Page<>(pageNum,pageSize); Page<ZfDoctor> pageResult = page(ZfDoctorPage, lqw); @@ -43,11 +47,54 @@ @Override public List<ZfDoctor> selectByCondition(ZfDoctor zfDoctor) { LambdaQueryWrapper<ZfDoctor> lambdaQueryWrapper = buildCondition(zfDoctor); + lambdaQueryWrapper.orderByDesc(ZfDoctor::getCreateTime); List<ZfDoctor> list = list(lambdaQueryWrapper); log.info("杩斿洖鐨勬暟鎹负:{}",list); return list; } + @Override + public List<ZfDoctor> selectByIds(Long[] ids) { + List<ZfDoctor> list = new ArrayList<>(); + if(ids.length!=0) + list = listByIds(Arrays.asList(ids)); + else + list = list(); + return list; + } + + @Override + public AjaxResult mySave(ZfDoctor zfDoctor) { + //鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹� + LambdaQueryWrapper<ZfDoctor> lqw = uniqueCondition(zfDoctor); + List<ZfDoctor> list = list(lqw); + if(list.size()>0){ + throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁"); + } + + if(save(zfDoctor)){ + return AjaxResult.success(); + }else { + return AjaxResult.error(); + } + + + } + + private LambdaQueryWrapper<ZfDoctor> uniqueCondition(ZfDoctor zfDoctor) { + LambdaQueryWrapper<ZfDoctor> lqw = new LambdaQueryWrapper<>(); + lqw.eq(StringUtils.isNotEmpty(zfDoctor.getType()),ZfDoctor::getType,zfDoctor.getType()); + lqw.eq(StringUtils.isNotEmpty(zfDoctor.getSymptom()),ZfDoctor::getSymptom,zfDoctor.getSymptom()); + lqw.eq(StringUtils.isNotEmpty(zfDoctor.getDuration()),ZfDoctor::getDuration,zfDoctor.getDuration()); + lqw.eq(StringUtils.isNotEmpty(zfDoctor.getCmedical()),ZfDoctor::getCmedical,zfDoctor.getCmedical()); + lqw.eq(StringUtils.isNotEmpty(zfDoctor.getWmedical()),ZfDoctor::getWmedical,zfDoctor.getWmedical()); + lqw.eq(StringUtils.isNotEmpty(zfDoctor.getEffect()),ZfDoctor::getEffect,zfDoctor.getEffect()); + lqw.eq(StringUtils.isNotEmpty(zfDoctor.getSuitable()),ZfDoctor::getSuitable,zfDoctor.getSuitable()); + lqw.eq(StringUtils.isNotEmpty(zfDoctor.getRemark()),ZfDoctor::getRemark,zfDoctor.getRemark()); + return lqw; + + } + private LambdaQueryWrapper<ZfDoctor> buildCondition(ZfDoctor zfDoctor) { LambdaQueryWrapper<ZfDoctor> lqw = new LambdaQueryWrapper<>(); lqw.like(StringUtils.isNotEmpty(zfDoctor.getType()),ZfDoctor::getType,zfDoctor.getType()); -- Gitblit v1.9.1