package com.quinn.service.impl;

import com.quinn.mapper.FindMapper;
import com.quinn.pojo.FindResult;
import com.quinn.service.FindService;
import com.quinn.vo.MyPageParam;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author limqsh
 * @since 2022-05-08
 */
@Service
public class FindServiceImpl implements FindService {

    @Resource
    FindMapper findMapper;

    @Override
    public List<FindResult> listFinds(String findWhat, MyPageParam myPageParam) {
        int total = findMapper.countListFinds(findWhat);
        myPageParam.setTotal(total);
        if (total > 0){
            return findMapper.listFinds(findWhat,myPageParam);
        }
        return new ArrayList<>();
    }
}
