package com.qnfhq.modules.c2c.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qnfhq.common.service.impl.BaseServiceImpl;
import com.qnfhq.common.service.impl.CrudServiceImpl;
import com.qnfhq.modules.c2c.dao.C2cLegalCoinDao;
import com.qnfhq.modules.c2c.dto.C2cLegalCoinDTO;
import com.qnfhq.modules.c2c.entity.C2cLegalCoinEntity;
import com.qnfhq.modules.c2c.service.C2cLegalCoinService;
import cn.hutool.core.util.StrUtil;
import org.springframework.stereotype.Service;

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

/**
 * c2c法币
 *
 * @author yelz 30262728@qq.com
 * @since 1.0.0 2025-11-18
 */
@Service
public class C2cLegalCoinServiceImpl extends BaseServiceImpl<C2cLegalCoinDao, C2cLegalCoinEntity> implements C2cLegalCoinService {


    @Override
    public C2cLegalCoinEntity selectC2cLegalCoinByLegalCoin(String legalCoin) {
        return baseDao.selectOne(new LambdaQueryWrapper<C2cLegalCoinEntity>()
                .eq(StrUtil.isNotBlank(legalCoin), C2cLegalCoinEntity::getCurrencyCode, legalCoin)
                .eq(C2cLegalCoinEntity::getStatus,1)
                .last(" limit 1")
        );
    }

    @Override
    public List<C2cLegalCoinEntity> selectAllList() {
        return baseDao.selectList(new LambdaQueryWrapper<C2cLegalCoinEntity>()
                .eq(C2cLegalCoinEntity::getStatus,1)
        );
    }
}