package com.dayou.service.impl;

import com.dayou.common.BaseEntity;
import com.dayou.entity.AssetsEvaluationTarget;
import com.dayou.mapper.AssetsEvaluationTargetMapper;
import com.dayou.service.IAssetsEvaluationTargetService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dayou.vo.AssetsEvaluationTargetVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import java.util.List;

/**
 * <p>
 * 资产评估对象表 服务实现类
 * </p>
 *
 * @author GouGengquan
 * @since 2024-03-28
 */
@Service
public class AssetsEvaluationTargetServiceImpl extends ServiceImpl<AssetsEvaluationTargetMapper, AssetsEvaluationTarget> implements IAssetsEvaluationTargetService {

    @Autowired
    private AssetsEvaluationTargetMapper assetsEvaluationTargetMapper;

    /**
     * 根据资产业务订单id获取评估对象信息
     * @param id 资产订单id
     * @return List<AssetsEvaluationTargetVO>
     */
    @Override
    public List<AssetsEvaluationTargetVO> getAETargetListByAssetsId(Long id, String statementNo, String reportNo) {
        return assetsEvaluationTargetMapper.getAETargetListByAssetsId(id,statementNo,reportNo);
    }

    @Override
    @SuppressWarnings("unchecked")
    public Page<AssetsEvaluationTarget> selectPage(Page page,AssetsEvaluationTarget assetsEvaluationTarget){
        return this.page(page, new QueryWrapper<AssetsEvaluationTarget>(assetsEvaluationTarget));
    }


    @Override
    public AssetsEvaluationTarget detail(Long id){
        return this.getById(id);
    }

    @Override
    public Boolean add(AssetsEvaluationTarget assetsEvaluationTarget){
        return  this.save(assetsEvaluationTarget);
    }

    @Override
    public Boolean update(AssetsEvaluationTarget assetsEvaluationTarget){
        return  this.updateById(assetsEvaluationTarget);
    }

    @Override
    public Boolean delete(Long id){
        //逻辑删除
        return this.removeById(id);
    }

    /**
     * 评估对象审核定价
     * @param assetsEvaluationTarget 审核定价信息
     * @return Boolean
     */
    @Override
    public Boolean checkValue(AssetsEvaluationTarget assetsEvaluationTarget) {
        return assetsEvaluationTargetMapper.checkValue(assetsEvaluationTarget);
    }
}
