| | |
| | | package com.ruoyi.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.MapUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.domain.ZfDoctor; |
| | | import com.ruoyi.mapper.ZfDoctorMapper; |
| | | import com.ruoyi.service.ZfDoctorService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2023-03-12 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class ZfDoctorServiceImpl extends ServiceImpl<ZfDoctorMapper, ZfDoctor> implements ZfDoctorService { |
| | | |
| | | @Override |
| | | public AjaxResult selectDoctorList(ZfDoctor zfDoctor, Integer pageNum, Integer pageSize) { |
| | | LambdaQueryWrapper<ZfDoctor> lqw = buildCondition(zfDoctor); |
| | | |
| | | Page<ZfDoctor> ZfDoctorPage = new Page<>(pageNum,pageSize); |
| | | Page<ZfDoctor> pageResult = page(ZfDoctorPage, lqw); |
| | | |
| | | HashMap<String, Object> data = MapUtils.getResult(pageResult); |
| | | return AjaxResult.success(data); |
| | | } |
| | | |
| | | @Override |
| | | public List<ZfDoctor> selectByCondition(ZfDoctor zfDoctor) { |
| | | LambdaQueryWrapper<ZfDoctor> lambdaQueryWrapper = buildCondition(zfDoctor); |
| | | List<ZfDoctor> list = list(lambdaQueryWrapper); |
| | | log.info("返回的数据为:{}",list); |
| | | return list; |
| | | } |
| | | |
| | | private LambdaQueryWrapper<ZfDoctor> buildCondition(ZfDoctor zfDoctor) { |
| | | LambdaQueryWrapper<ZfDoctor> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.like(StringUtils.isNotEmpty(zfDoctor.getType()),ZfDoctor::getType,zfDoctor.getType()); |
| | | lqw.like(StringUtils.isNotEmpty(zfDoctor.getSymptom()),ZfDoctor::getSymptom,zfDoctor.getSymptom()); |
| | | lqw.like(StringUtils.isNotEmpty(zfDoctor.getDuration()),ZfDoctor::getDuration,zfDoctor.getDuration()); |
| | | lqw.like(StringUtils.isNotEmpty(zfDoctor.getCmedical()),ZfDoctor::getCmedical,zfDoctor.getCmedical()); |
| | | lqw.like(StringUtils.isNotEmpty(zfDoctor.getWmedical()),ZfDoctor::getWmedical,zfDoctor.getWmedical()); |
| | | lqw.like(StringUtils.isNotEmpty(zfDoctor.getEffect()),ZfDoctor::getEffect,zfDoctor.getEffect()); |
| | | lqw.like(StringUtils.isNotEmpty(zfDoctor.getSuitable()),ZfDoctor::getSuitable,zfDoctor.getSuitable()); |
| | | lqw.like(StringUtils.isNotEmpty(zfDoctor.getRemark()),ZfDoctor::getRemark,zfDoctor.getRemark()); |
| | | return lqw; |
| | | } |
| | | } |