package com.chinaweal.aiccs.aiccs.fraudreg.service.impl;

import com.chinaweal.aiccs.aiccs.fraudreg.entity.TFraudPerson;
import com.chinaweal.aiccs.aiccs.fraudreg.mapper.TFraudPersonMapper;
import com.chinaweal.aiccs.aiccs.fraudreg.service.ITFraudPersonService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chinaweal.youfool.framework.springboot.mybatis.plus.BaseServiceImpl;
import org.springframework.stereotype.Service;
import com.chinaweal.youfool.framework.springboot.base.query.BaseQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;

/**
 * <p>
 * 涉嫌冒用他人身份取得登记责任人信息表 服务实现类
 * </p>
 *
 * @author chinaweal
 * @since 2021-11-11
 */
@Service
public class TFraudPersonServiceImpl extends BaseServiceImpl<TFraudPersonMapper, TFraudPerson> implements ITFraudPersonService {

    @Override
    public TFraudPerson saveTFraudPerson(TFraudPerson tFraudPerson) {
        save(tFraudPerson);
        return tFraudPerson;
    }

    @Override
    public void updateTFraudPerson(TFraudPerson tFraudPerson) {
        updateById(tFraudPerson);
    }

    @Override
    public IPage<TFraudPerson> listTFraudPerson(BaseQuery<TFraudPerson> query) {
        TFraudPerson entity = query.getEntity(TFraudPerson.class);
        Page<TFraudPerson> page = query.getPage();

        LambdaQueryWrapper<TFraudPerson> lambdaQueryWrapper = Wrappers.lambdaQuery();

        return page(page, lambdaQueryWrapper);
    }

    @Override
    public TFraudPerson getByBizSeq(String bizSeq) {
        return this.lambdaQuery().eq(TFraudPerson::getBizSeq, bizSeq).one();
    }

}
