package com.dayou.controller;

import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.RestController;
import com.dayou.controller.BaseController;
import com.dayou.service.IAssetsEvaluationTargetTypeService;
import com.dayou.entity.AssetsEvaluationTargetType;
import com.dayou.common.RestResponse;
import org.springframework.web.bind.annotation.*;
import com.dayou.utils.ConvertUtil;
import com.dayou.utils.HttpKit;
import com.dayou.exception.ErrorCode;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.http.MediaType;
import org.springframework.web.multipart.MultipartFile;
/**
 * 资产评估对象类型表
 *
 * @author GouGengquan
 * @since 2024-03-28
 */
@RestController
@RequestMapping("assetsEvaluationTargetType")
@Slf4j
public class AssetsEvaluationTargetTypeController extends BaseController {

    @Autowired
    private IAssetsEvaluationTargetTypeService assetsEvaluationTargetTypeService;

    /**
     * 根据父级id获取资产评估对象类型
     * @param parentId 父级id
     * @return RestResponse<List<AssetsEvaluationTargetType>>
     */
    @GetMapping("/getTypeList/{parentId}")
    public RestResponse<List<AssetsEvaluationTargetType>> getTypeList(@PathVariable Long parentId){
        return RestResponse.data(assetsEvaluationTargetTypeService.getTypeList(parentId));
    }

    /**
     * 资产评估对象类型表新增
     */
    @PostMapping("")
    public RestResponse<Boolean> save(@RequestBody AssetsEvaluationTargetType assetsEvaluationTargetType) {
        Boolean ret = assetsEvaluationTargetTypeService.add(assetsEvaluationTargetType);
        return RestResponse.data(ret);
    }

    /**
     * 资产评估对象类型表更新
     */
    @PutMapping("")
    public RestResponse<Boolean> update(@RequestBody AssetsEvaluationTargetType assetsEvaluationTargetType) {
        Boolean ret = assetsEvaluationTargetTypeService.update(assetsEvaluationTargetType);
        return RestResponse.data(ret);
    }


}

