package com.hzs.bonus.base.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.bonus.base.service.ICuMemberAchieveLogService;
import com.hzs.common.core.constant.MemberFieldConstants;
import com.hzs.common.core.constant.SystemFieldConstants;
import com.hzs.common.core.enums.*;
import com.hzs.common.domain.member.detail.CuMemberAchieveLog;
import com.hzs.bonus.base.mapper.CuMemberAchieveLogMapper;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * <p>
 * 注水业绩记录表 服务实现类
 * </p>
 *
 * @author zhangjing
 * @since 2023-02-03
 */
@Service
public class CuMemberAchieveLogServiceImpl extends ServiceImpl<CuMemberAchieveLogMapper, CuMemberAchieveLog> implements ICuMemberAchieveLogService {

    @Override
    public List<CuMemberAchieveLog> queryMemberAchieveLogByPeriod(Integer period) {
        QueryWrapper<CuMemberAchieveLog> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(MemberFieldConstants.PERIOD, period);
        queryWrapper.in(SystemFieldConstants.APPROVE_STATUS, EApproveStatus.FINISH.getValue());
        queryWrapper.orderByAsc(MemberFieldConstants.PK_MEMBER, SystemFieldConstants.CREATION_TIME);
        return baseMapper.selectList(queryWrapper);
    }

}
