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.IAssetsEvaluationMethodService;
import com.dayou.entity.AssetsEvaluationMethod;
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-04-07
 */
@RestController
@RequestMapping("assetsEvaluationMethod")
@Slf4j
public class AssetsEvaluationMethodController extends BaseController {
    @Autowired
    private IAssetsEvaluationMethodService assetsEvaluationMethodService;

    /**
     * 获取所有评估方法集合
     * @return RestResponse<List<AssetsEvaluationMethod>>
     */
    @GetMapping("/getAssetsEvaluationMethod")
    public RestResponse<List<AssetsEvaluationMethod>> getAssetsEvaluationMethod() {
        return RestResponse.data(assetsEvaluationMethodService.getAssetsEvaluationMethod());
    }

    /**
    * 资产评估方法表列表
    */
    @GetMapping("")
    public RestResponse<Page<AssetsEvaluationMethod>> page(AssetsEvaluationMethod assetsEvaluationMethod, Page page){
        Page<AssetsEvaluationMethod> pages=assetsEvaluationMethodService.selectPage(page,assetsEvaluationMethod);
        return RestResponse.data(pages);
    }

    /**
     * 资产评估方法表详情
     */
    @GetMapping("/{id}")
    public RestResponse<AssetsEvaluationMethod> detail(@PathVariable Long id){
        AssetsEvaluationMethod xAssetsEvaluationMethod =assetsEvaluationMethodService.detail(id);
        return RestResponse.data(xAssetsEvaluationMethod);
     }

    /**
     * 资产评估方法表新增
     */
    @PostMapping("")
    public RestResponse<Boolean> save(@RequestBody AssetsEvaluationMethod assetsEvaluationMethod) {
        Boolean ret = assetsEvaluationMethodService.add(assetsEvaluationMethod);
        return RestResponse.data(ret);
    }

    /**
     * 资产评估方法表更新
     */
    @PutMapping("")
    public RestResponse<Boolean> update(@RequestBody AssetsEvaluationMethod assetsEvaluationMethod) {
        Boolean ret = assetsEvaluationMethodService.update(assetsEvaluationMethod);
        return RestResponse.data(ret);
    }

    /**
     * 资产评估方法表删除
     */
    @DeleteMapping("/{id}")
    public RestResponse<Boolean> delete(@PathVariable Long id) {
        Boolean ret = assetsEvaluationMethodService.delete(id);
        return RestResponse.data(ret);
    }


}

