package com.fjhx.jushuitan.service.jst.impl;

import com.fjhx.jushuitan.entity.jst.po.JstOrderPayInfo;
import com.fjhx.jushuitan.mapper.jst.JstOrderPayInfoMapper;
import com.fjhx.jushuitan.service.jst.JstOrderPayInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.jushuitan.entity.jst.vo.JstOrderPayInfoVo;
import com.fjhx.jushuitan.entity.jst.dto.JstOrderPayInfoSelectDto;
import com.ruoyi.common.utils.wrapper.IWrapper;
import com.fjhx.jushuitan.entity.jst.dto.JstOrderPayInfoDto;
import cn.hutool.core.bean.BeanUtil;

import java.util.List;

/**
 * <p>
 * 聚水潭支付信息表 服务实现类
 * </p>
 *
 * @author 
 * @since 2024-01-20
 */
@Service
public class JstOrderPayInfoServiceImpl extends ServiceImpl<JstOrderPayInfoMapper, JstOrderPayInfo> implements JstOrderPayInfoService {

    @Override
    public List<JstOrderPayInfoVo> getList(JstOrderPayInfoSelectDto dto) {
        IWrapper<JstOrderPayInfo> wrapper = getWrapper();
        wrapper.orderByDesc("jopi", JstOrderPayInfo::getId);
        List<JstOrderPayInfoVo> list = this.baseMapper.getList(wrapper);
        return list;
    }

    @Override
    public Page<JstOrderPayInfoVo> getPage(JstOrderPayInfoSelectDto dto) {
        IWrapper<JstOrderPayInfo> wrapper = getWrapper();
        wrapper.orderByDesc("jopi", JstOrderPayInfo::getId);
        Page<JstOrderPayInfoVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
        return page;
    }

    @Override
    public JstOrderPayInfoVo detail(Long id) {
        JstOrderPayInfo JstOrderPayInfo = this.getById(id);
        JstOrderPayInfoVo result = BeanUtil.toBean(JstOrderPayInfo, JstOrderPayInfoVo.class);
        return result;
    }

    @Override
    public void add(JstOrderPayInfoDto jstOrderPayInfoDto) {
        this.save(jstOrderPayInfoDto);
    }

    @Override
    public void edit(JstOrderPayInfoDto jstOrderPayInfoDto) {
        this.updateById(jstOrderPayInfoDto);
    }

    @Override
    public void delete(Long id) {
        this.removeById(id);
    }

}
