package com.hzs.member.account.service.impl;


import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.common.domain.member.account.CuMemberAccountLog;
import com.hzs.member.account.dto.MemberAccountAudit;
import com.hzs.member.account.mapper.CuMemberAccountLogMapper;
import com.hzs.member.account.service.ICuMemberAccountLogService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 会员锁定账户日志表 服务实现类
 * </p>
 *
 * @author hzs
 * @since 2023-03-11
 */
@Service
public class CuMemberAccountLogServiceImpl extends ServiceImpl<CuMemberAccountLogMapper, CuMemberAccountLog> implements ICuMemberAccountLogService {

    @Override
    public CuMemberAccountLog queryCuMemberAccountLogByBusinessCode(String businessCode) {
        QueryWrapper<CuMemberAccountLog> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("APPROVAL_CODE", businessCode);
        return baseMapper.selectOne(queryWrapper);
    }

    @Override
    public Integer updateMemberAccountLogByCode(MemberAccountAudit memberAccountAudit) {
        CuMemberAccountLog memberAccountLog = BeanUtil.copyProperties(memberAccountAudit, CuMemberAccountLog.class);
        memberAccountLog.setApprovalCode(memberAccountAudit.getBusinessCode());
        return baseMapper.updateMemberAccountLogByCode(memberAccountLog);
    }

}
