package com.dayou.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dayou.entity.AssetsEvaluationTargetType;
import com.dayou.mapper.AssetsEvaluationTargetTypeMapper;
import com.dayou.service.IAssetsEvaluationTargetTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.dayou.utils.ExcelUtil;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.ArrayList;
import org.springframework.transaction.annotation.Transactional;
import com.dayou.enums.BatchTaskTypeEnum;

/**
 * <p>
 * 资产评估对象类型表 服务实现类
 * </p>
 *
 * @author GouGengquan
 * @since 2024-03-28
 */
@Service
public class AssetsEvaluationTargetTypeServiceImpl extends ServiceImpl<AssetsEvaluationTargetTypeMapper, AssetsEvaluationTargetType> implements IAssetsEvaluationTargetTypeService {

    /**
     * 根据父级id获取资产评估对象类型
     * @param parentId 查询条件
     * @return List<AssetsEvaluationTargetType>
     */
    @Override
    public List<AssetsEvaluationTargetType> getTypeList(Long parentId) {
        //根据父级id查询类型列表
        Wrapper<AssetsEvaluationTargetType> wrapper = Wrappers
                .<AssetsEvaluationTargetType>lambdaQuery()
                .eq(AssetsEvaluationTargetType::getParentId, parentId);
        return this.list(wrapper);
    }

    /**
     * 新增资产评估对象类型
     * @param assetsEvaluationTargetType 资产评估对象类型
     * @return Boolean
     */
    @Override
    public Boolean add(AssetsEvaluationTargetType assetsEvaluationTargetType){
        return  this.save(assetsEvaluationTargetType);
    }

    /**
     * 修改资产评估对象类型
     * @param assetsEvaluationTargetType 资产评估对象类型
     * @return Boolean
     */
    @Override
    public Boolean update(AssetsEvaluationTargetType assetsEvaluationTargetType){
        return  this.updateById(assetsEvaluationTargetType);
    }

}
