package com.unis.reserveLayout.modular.keepWork.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.unis.reserveLayout.modular.keepWork.entity.DemoFumigation;
import com.unis.reserveLayout.modular.keepWork.mapper.DemoFumigationMapper;
import com.unis.reserveLayout.modular.keepWork.param.DemoFumigationPageParam;
import com.unis.reserveLayout.modular.keepWork.service.DemoFumigationService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * <p>
 * 环流熏蒸 服务实现类
 * </p>
 *
 * @author root
 * @since 2024-05-11
 */
@Service
public class DemoFumigationServiceImpl extends ServiceImpl<DemoFumigationMapper, DemoFumigation> implements DemoFumigationService {
    @Resource
    private DemoFumigationMapper fumigationMapper;

    @Override
    public Page<DemoFumigation> selectPageList(DemoFumigationPageParam param) {
        QueryWrapper<DemoFumigation> wrapper = new QueryWrapper<>();
        wrapper.eq("df.org_id", param.getOrgId());
        if (StringUtils.isNotEmpty(param.getOrgName()))
            wrapper.eq("df.org_name", param.getOrgName());
        wrapper.orderByDesc("df.xzsj");
        return fumigationMapper.selectPageList(new Page<>(param.getCurrent(), param.getSize()), wrapper);
    }
}
