/*
 * Author: wangjian
 * 生成ServiceImpl
 */
package com.tofly.feesapi.sfgl.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tofly.feesapi.common.core.dto.Order;
import com.tofly.feesapi.common.core.dto.PageDto;
import com.tofly.feesapi.common.core.vo.PageResult;
import com.tofly.feesapi.sfgl.entity.YyQfmxDzmx;
import com.tofly.feesapi.sfgl.entity.dto.YyQfmxDzmxFilter;
import com.tofly.feesapi.sfgl.entity.vo.YyQfmxDzmxSelect;
import com.tofly.feesapi.sfgl.service.YyQfmxDzmxService;
import org.springframework.stereotype.Service;
import com.tofly.feesapi.sfgl.mapper.YyQfmxDzmxMapper;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 用户呆账明细
 *
 * @author admin
 * @date Fri Apr 25 00:00:00 GMT+08:00 2025
 */
@Service("yyQfmxDzmxService")
public class YyQfmxDzmxServiceImpl extends ServiceImpl<YyQfmxDzmxMapper, YyQfmxDzmx> implements YyQfmxDzmxService {

    @Override
    public PageResult<YyQfmxDzmxSelect> getYyQfmxDzmxPage(PageDto pageDto, YyQfmxDzmxFilter filter) {
        List<Order> orders = pageDto.getOrders();
        if (orders.size() > 0) {
            orders = orders.stream().map(item -> {
                if (item.getColumn().equals("czsj")) {
                    Order order = new Order();
                    order.setColumn("a.czsj");
                    order.setAsc(item.isAsc());
                    return order;
                }
                return item;
            }).collect(Collectors.toList());
        }
        pageDto.setOrders(orders);
        PageDto<YyQfmxDzmxSelect> page = this.baseMapper.getYyQfmxDzmxPage(pageDto, filter);
        return page.toVo();
    }

    @Override
    public List<YyQfmxDzmxSelect> getList(YyQfmxDzmxFilter filter) {
        List<YyQfmxDzmxSelect> list = this.baseMapper.getYyQfmxDzmxPage(filter);
        return list;
    }
}
