package com.simuwang.manage.service.impl;

import com.simuwang.base.common.support.MybatisPage;
import com.simuwang.base.mapper.FundInfoMapper;
import com.simuwang.base.pojo.dto.query.FundInfoPageQuery;
import com.simuwang.base.pojo.dto.query.FundInputPageQuery;
import com.simuwang.base.pojo.vo.FundInformationVO;
import com.simuwang.manage.service.FundInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * FileName: FundInformationServiceImpl
 * Author:   chenjianhua
 * Date:     2024/9/6 15:08
 * Description: ${DESCRIPTION}
 */
@Service
public class FundInformationServiceImpl implements FundInformationService {
    @Autowired
    private FundInfoMapper fundInfoMapper;
    @Override
    public MybatisPage<Map<String,String>> searchFundInfo(FundInputPageQuery fundInputPageQuery) {
        List<Map<String,String>> fundInfoList = fundInfoMapper.searchFundInfoByKeyword(fundInputPageQuery);
        long total = fundInfoMapper.countFundInfoByKeyword(fundInputPageQuery);
        return MybatisPage.of(total,fundInfoList);
    }

    @Override
    public MybatisPage<FundInformationVO> searchFundInfoList(FundInfoPageQuery fundInfoPageQuery) {
        List<FundInformationVO> result = fundInfoMapper.searchFundInfoList(fundInfoPageQuery);
        long total = fundInfoMapper.countFundInfo(fundInfoPageQuery);
        return MybatisPage.of(total,result);
    }
}
